diff --git a/software/src/modules/system/module.ini b/software/src/modules/system/module.ini index b67726af6..0d3dd06c0 100644 --- a/software/src/modules/system/module.ini +++ b/software/src/modules/system/module.ini @@ -7,3 +7,4 @@ Requires = Task Scheduler Optional = Evse Common Users Charge Tracker + Mqtt Auto Discovery diff --git a/software/src/modules/system/system.cpp b/software/src/modules/system/system.cpp index 1da8c82dc..92c6ef0ae 100644 --- a/software/src/modules/system/system.cpp +++ b/software/src/modules/system/system.cpp @@ -78,7 +78,17 @@ void System::pre_setup() i18n_config = ConfigRoot{Config::Object({ {"language", Config::Enum(Language::German, Language::German, Language::English)}, {"detect_browser_language", Config::Bool(true)} - })}; + }) +#if MODULE_MQTT_AUTO_DISCOVERY_AVAILABLE() + , [this](Config &update, ConfigSource source) -> String { + if (update.get("language")->asEnum() != i18n_config.get("language")->asEnum()) { + mqtt_auto_discovery.reschedule_announce_next_topic(); + } + + return ""; + } +#endif + }; } void System::setup()