add firmware and hardware version to mqtt
This commit is contained in:
2
Config.h
2
Config.h
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define NUKI_HUB_VERSION "8.9-json-6"
|
||||
#define NUKI_HUB_VERSION "8.10"
|
||||
|
||||
#define MQTT_QOS_LEVEL 1
|
||||
#define MQTT_CLEAN_SESSIONS false
|
||||
@@ -35,6 +35,10 @@
|
||||
#define mqtt_topic_config_single_lock "/configuration/singleLock"
|
||||
#define mqtt_topic_config_sound_level "/configuration/soundLevel"
|
||||
|
||||
#define mqtt_topic_info_hardware_version "/info/hardwareVersion"
|
||||
#define mqtt_topic_info_firmware_version "/info/firmwareVersion"
|
||||
|
||||
|
||||
#define mqtt_topic_keypad "/keypad"
|
||||
#define mqtt_topic_keypad_command_action "/keypad/command/action"
|
||||
#define mqtt_topic_keypad_command_id "/keypad/command/id"
|
||||
|
||||
34
Network.cpp
34
Network.cpp
@@ -652,6 +652,40 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
|
||||
"",
|
||||
{ { "enabled_by_default", "true" } });
|
||||
|
||||
// Firmware version
|
||||
publishHassTopic("sensor",
|
||||
"firmware_version",
|
||||
uidString,
|
||||
"_firmware_version",
|
||||
"Firmware version",
|
||||
name,
|
||||
baseTopic,
|
||||
mqtt_topic_info_firmware_version,
|
||||
deviceType,
|
||||
"",
|
||||
"",
|
||||
"diagnostic",
|
||||
"",
|
||||
{ { "enabled_by_default", "true" },
|
||||
{"ic", "mdi:counter"}});
|
||||
|
||||
// Firmware version
|
||||
publishHassTopic("sensor",
|
||||
"hardware_version",
|
||||
uidString,
|
||||
"_hardware_version",
|
||||
"Hardware version",
|
||||
name,
|
||||
baseTopic,
|
||||
mqtt_topic_info_hardware_version,
|
||||
deviceType,
|
||||
"",
|
||||
"",
|
||||
"diagnostic",
|
||||
"",
|
||||
{ { "enabled_by_default", "true" },
|
||||
{"ic", "mdi:counter"}});
|
||||
|
||||
// LED enabled
|
||||
publishHassTopic("switch",
|
||||
"led_enabled",
|
||||
|
||||
@@ -405,6 +405,8 @@ void NetworkLock::publishConfig(const NukiLock::Config &config)
|
||||
publishBool(mqtt_topic_config_led_enabled, config.ledEnabled == 1);
|
||||
publishInt(mqtt_topic_config_led_brightness, config.ledBrightness);
|
||||
publishBool(mqtt_topic_config_single_lock, config.singleLock == 1);
|
||||
publishString(mqtt_topic_info_firmware_version, std::to_string(config.firmwareVersion[0]) + "." + std::to_string(config.firmwareVersion[1]) + "." + std::to_string(config.firmwareVersion[2]));
|
||||
publishString(mqtt_topic_info_hardware_version, std::to_string(config.hardwareRevision[0]) + "." + std::to_string(config.hardwareRevision[1]));
|
||||
}
|
||||
|
||||
void NetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &config)
|
||||
|
||||
@@ -451,6 +451,8 @@ void NetworkOpener::publishConfig(const NukiOpener::Config &config)
|
||||
{
|
||||
publishBool(mqtt_topic_config_button_enabled, config.buttonEnabled == 1);
|
||||
publishBool(mqtt_topic_config_led_enabled, config.ledFlashEnabled == 1);
|
||||
publishString(mqtt_topic_info_firmware_version, std::to_string(config.firmwareVersion[0]) + "." + std::to_string(config.firmwareVersion[1]) + "." + std::to_string(config.firmwareVersion[2]));
|
||||
publishString(mqtt_topic_info_hardware_version, std::to_string(config.hardwareRevision[0]) + "." + std::to_string(config.hardwareRevision[1]));
|
||||
}
|
||||
|
||||
void NetworkOpener::publishAdvancedConfig(const NukiOpener::AdvancedConfig &config)
|
||||
|
||||
Reference in New Issue
Block a user