Skip to content

Commit 8b08a3d

Browse files
authored
Merge pull request #4471 from emontnemery/hass_fix_topic
Hass: Restart if topic is changed
2 parents be358b3 + 6d3223f commit 8b08a3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sonoff/xdrv_12_home_assistant.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,10 @@ void HAssDiscovery(uint8_t mode)
428428
Settings.flag.decimal_text = 1; // Respond with decimal color values
429429
Settings.flag3.hass_tele_as_result = 1; // send tele/STATE message as stat/RESULT
430430
// Settings.light_scheme = 0; // To just control color it needs to be Scheme 0
431-
if (!string_ends_with(Settings.mqtt_fulltopic, "%prefix%/"))
431+
if (!string_ends_with(Settings.mqtt_fulltopic, "%prefix%/")) {
432432
strncpy_P(Settings.mqtt_fulltopic, PSTR("%topic%/%prefix%/"), sizeof(Settings.mqtt_fulltopic));
433+
restart_flag = 2;
434+
}
433435
}
434436

435437
if (Settings.flag.hass_discovery || (1 == mode)) {

0 commit comments

Comments
 (0)