Merge pull request #151 from mkoppanen/feature/nuki-hub-version-mqtt
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_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"
|
||||
|
||||
22
Network.cpp
22
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];
|
||||
|
||||
@@ -291,6 +292,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;
|
||||
}
|
||||
|
||||
@@ -716,6 +721,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",
|
||||
|
||||
Reference in New Issue
Block a user