diff --git a/MqttTopics.h b/MqttTopics.h index a002911..24039d8 100644 --- a/MqttTopics.h +++ b/MqttTopics.h @@ -40,7 +40,7 @@ #define mqtt_topic_info_hardware_version "/info/hardwareVersion" #define mqtt_topic_info_firmware_version "/info/firmwareVersion" - +#define mqtt_topic_info_nuki_hub_version "/info/nukiHubVersion" #define mqtt_topic_keypad "/keypad" #define mqtt_topic_keypad_command_action "/keypad/command/action" diff --git a/Network.cpp b/Network.cpp index 8453f77..afe7033 100644 --- a/Network.cpp +++ b/Network.cpp @@ -11,6 +11,7 @@ Network* Network::_inst = nullptr; unsigned long Network::_ignoreSubscriptionsTs = 0; +bool _versionPublished = false; RTC_NOINIT_ATTR char WiFi_fallbackDetect[14]; @@ -289,6 +290,10 @@ bool Network::update() publishString(_maintenancePathPrefix, mqtt_topic_restart_reason_fw, getRestartReason().c_str()); publishString(_maintenancePathPrefix, mqtt_topic_restart_reason_esp, getEspRestartReason().c_str()); } + if (!_versionPublished) { + publishString(mqtt_topic_info_nuki_hub_version, NUKI_HUB_VERSION); + _versionPublished = true; + } _lastMaintenanceTs = ts; } @@ -717,6 +722,23 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n { { "enabled_by_default", "true" }, {"ic", "mdi:counter"}}); + // NUKI Hub version + publishHassTopic("sensor", + "nuki_hub_version", + uidString, + "_nuki_hub__version", + "NUKI Hub version", + name, + baseTopic, + mqtt_topic_info_nuki_hub_version, + deviceType, + "", + "", + "diagnostic", + "", + { { "enabled_by_default", "true" }, + {"ic", "mdi:counter"}}); + // LED enabled publishHassTopic("switch", "led_enabled",