Publish version once on startup
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#define mqtt_topic_info_hardware_version "/info/hardwareVersion"
|
#define mqtt_topic_info_hardware_version "/info/hardwareVersion"
|
||||||
#define mqtt_topic_info_firmware_version "/info/firmwareVersion"
|
#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 "/keypad"
|
||||||
#define mqtt_topic_keypad_command_action "/keypad/command/action"
|
#define mqtt_topic_keypad_command_action "/keypad/command/action"
|
||||||
|
|||||||
22
Network.cpp
22
Network.cpp
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
Network* Network::_inst = nullptr;
|
Network* Network::_inst = nullptr;
|
||||||
unsigned long Network::_ignoreSubscriptionsTs = 0;
|
unsigned long Network::_ignoreSubscriptionsTs = 0;
|
||||||
|
bool _versionPublished = false;
|
||||||
|
|
||||||
RTC_NOINIT_ATTR char WiFi_fallbackDetect[14];
|
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_fw, getRestartReason().c_str());
|
||||||
publishString(_maintenancePathPrefix, mqtt_topic_restart_reason_esp, getEspRestartReason().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;
|
_lastMaintenanceTs = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,6 +722,23 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
|
|||||||
{ { "enabled_by_default", "true" },
|
{ { "enabled_by_default", "true" },
|
||||||
{"ic", "mdi:counter"}});
|
{"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
|
// LED enabled
|
||||||
publishHassTopic("switch",
|
publishHassTopic("switch",
|
||||||
"led_enabled",
|
"led_enabled",
|
||||||
|
|||||||
Reference in New Issue
Block a user