Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hass: Restart if topic is changed #4471

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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