Hass: Restart if topic is changed

This commit is contained in:
Erik 2018-11-27 19:31:45 +01:00
parent be358b3314
commit 6d3223f962

View File

@ -428,8 +428,10 @@ void HAssDiscovery(uint8_t mode)
Settings.flag.decimal_text = 1; // Respond with decimal color values 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.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 // 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)); strncpy_P(Settings.mqtt_fulltopic, PSTR("%topic%/%prefix%/"), sizeof(Settings.mqtt_fulltopic));
restart_flag = 2;
}
} }
if (Settings.flag.hass_discovery || (1 == mode)) { if (Settings.flag.hass_discovery || (1 == mode)) {