Skip to content

Commit

Permalink
Hass: Restart if topic is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed Nov 27, 2018
1 parent be358b3 commit 6d3223f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sonoff/xdrv_12_home_assistant.ino
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,10 @@ void HAssDiscovery(uint8_t mode)
Settings.flag.decimal_text = 1; // Respond with decimal color values
Settings.flag3.hass_tele_as_result = 1; // send tele/STATE message as stat/RESULT
// Settings.light_scheme = 0; // To just control color it needs to be Scheme 0
if (!string_ends_with(Settings.mqtt_fulltopic, "%prefix%/"))
if (!string_ends_with(Settings.mqtt_fulltopic, "%prefix%/")) {
strncpy_P(Settings.mqtt_fulltopic, PSTR("%topic%/%prefix%/"), sizeof(Settings.mqtt_fulltopic));
restart_flag = 2;
}
}

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

0 comments on commit 6d3223f

Please sign in to comment.