From 6d3223f962f7cfda1131ee7e9e0a7545fd9b32df Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 27 Nov 2018 19:31:45 +0100 Subject: [PATCH] Hass: Restart if topic is changed --- sonoff/xdrv_12_home_assistant.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonoff/xdrv_12_home_assistant.ino b/sonoff/xdrv_12_home_assistant.ino index 20e03fd99203..e5f5a5324594 100644 --- a/sonoff/xdrv_12_home_assistant.ino +++ b/sonoff/xdrv_12_home_assistant.ino @@ -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)) {