Skip to content

Commit

Permalink
Fix Home Assistant discovery topics
Browse files Browse the repository at this point in the history
  • Loading branch information
iranl committed Feb 6, 2024
1 parent ba0fa55 commit 9463ee9
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"battery low",
name,
baseTopic,
mqtt_topic_battery_critical,
String("~") + mqtt_topic_battery_critical,
deviceType,
"battery",
"",
Expand All @@ -768,7 +768,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"keypad battery low",
name,
baseTopic,
mqtt_topic_battery_keypad_critical,
String("~") + mqtt_topic_battery_keypad_critical,
deviceType,
"battery",
"",
Expand All @@ -790,7 +790,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"battery voltage",
name,
baseTopic,
mqtt_topic_battery_voltage,
String("~") + mqtt_topic_battery_voltage,
deviceType,
"voltage",
"measurement",
Expand All @@ -806,7 +806,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"trigger",
name,
baseTopic,
mqtt_topic_lock_trigger,
String("~") + mqtt_topic_lock_trigger,
deviceType,
"",
"",
Expand All @@ -822,7 +822,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"MQTT connected",
name,
baseTopic,
mqtt_topic_mqtt_connection_state,
_lockPath + mqtt_topic_mqtt_connection_state,
deviceType,
"",
"",
Expand All @@ -840,12 +840,12 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"Restart NUKI Hub",
name,
baseTopic,
mqtt_topic_reset,
String("~") + mqtt_topic_reset,
deviceType,
"",
"",
"diagnostic",
mqtt_topic_reset,
String("~") + mqtt_topic_reset,
{ { "ic", "mdi:restart" },
{ "pl_on", "1" },
{ "pl_off", "0" },
Expand All @@ -860,7 +860,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"Firmware version",
name,
baseTopic,
mqtt_topic_info_firmware_version,
String("~") + mqtt_topic_info_firmware_version,
deviceType,
"",
"",
Expand All @@ -877,7 +877,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"Hardware version",
name,
baseTopic,
mqtt_topic_info_hardware_version,
String("~") + mqtt_topic_info_hardware_version,
deviceType,
"",
"",
Expand All @@ -894,7 +894,7 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"NUKI Hub version",
name,
baseTopic,
mqtt_topic_info_nuki_hub_version,
_lockPath + mqtt_topic_info_nuki_hub_version,
deviceType,
"",
"",
Expand All @@ -911,12 +911,12 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"LED enabled",
name,
baseTopic,
mqtt_topic_config_led_enabled,
String("~") + mqtt_topic_config_led_enabled,
deviceType,
"",
"",
"config",
mqtt_topic_config_led_enabled,
String("~") + mqtt_topic_config_led_enabled,
{ { "ic", "mdi:led-variant-on" },
{ "pl_on", "1" },
{ "pl_off", "0" },
Expand All @@ -931,12 +931,12 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"Button enabled",
name,
baseTopic,
mqtt_topic_config_button_enabled,
String("~") + mqtt_topic_config_button_enabled,
deviceType,
"",
"",
"config",
mqtt_topic_config_button_enabled,
String("~") + mqtt_topic_config_button_enabled,
{ { "ic", "mdi:radiobox-marked" },
{ "pl_on", "1" },
{ "pl_off", "0" },
Expand All @@ -951,12 +951,12 @@ void Network::publishHASSConfig(char* deviceType, const char* baseTopic, char* n
"Unlatch",
name,
baseTopic,
mqtt_topic_mqtt_connection_state,
_lockPath + mqtt_topic_mqtt_connection_state,
deviceType,
"",
"",
"",
mqtt_topic_lock_action,
String("~") + mqtt_topic_lock_action,
{ { "enabled_by_default", "false" },
{ "pl_prs", "unlatch" }});

Expand All @@ -974,12 +974,12 @@ void Network::publishHASSConfigAdditionalButtons(char *deviceType, const char *b
"Lock 'n' Go",
name,
baseTopic,
mqtt_topic_mqtt_connection_state,
_lockPath + mqtt_topic_mqtt_connection_state,
deviceType,
"",
"",
"",
mqtt_topic_lock_action,
String("~") + mqtt_topic_lock_action,
{ { "enabled_by_default", "false" },
{ "pl_prs", "lockNgo" }});

Expand All @@ -991,12 +991,12 @@ void Network::publishHASSConfigAdditionalButtons(char *deviceType, const char *b
"Lock 'n' Go with unlatch",
name,
baseTopic,
mqtt_topic_mqtt_connection_state,
_lockPath + mqtt_topic_mqtt_connection_state,
deviceType,
"",
"",
"",
mqtt_topic_lock_action,
String("~") + mqtt_topic_lock_action,
{ { "enabled_by_default", "false" },
{ "pl_prs", "lockNgoUnlatch" }});
}
Expand All @@ -1016,7 +1016,7 @@ void Network::publishHASSConfigBatLevel(char *deviceType, const char *baseTopic,
"battery level",
name,
baseTopic,
mqtt_topic_battery_level,
String("~") + mqtt_topic_battery_level,
deviceType,
"battery",
"measurement",
Expand All @@ -1041,7 +1041,7 @@ void Network::publishHASSConfigDoorSensor(char *deviceType, const char *baseTopi
"door sensor",
name,
baseTopic,
mqtt_topic_lock_door_sensor_state,
String("~") + mqtt_topic_lock_door_sensor_state,
deviceType,
"door",
"",
Expand All @@ -1066,7 +1066,7 @@ void Network::publishHASSConfigRingDetect(char *deviceType, const char *baseTopi
"ring detect",
name,
baseTopic,
mqtt_topic_lock_state,
String("~") + mqtt_topic_lock_state,
deviceType,
"sound",
"",
Expand All @@ -1087,12 +1087,12 @@ void Network::publishHASSConfigLedBrightness(char *deviceType, const char *baseT
"LED brightness",
name,
baseTopic,
mqtt_topic_config_led_brightness,
String("~") + mqtt_topic_config_led_brightness,
deviceType,
"",
"",
"config",
mqtt_topic_config_led_brightness,
String("~") + mqtt_topic_config_led_brightness,
{ { "ic", "mdi:brightness-6" },
{ "min", "0" },
{ "max", "5" }});
Expand All @@ -1107,12 +1107,12 @@ void Network::publishHASSConfigSoundLevel(char *deviceType, const char *baseTopi
"Sound level",
name,
baseTopic,
mqtt_topic_config_sound_level,
String("~") + mqtt_topic_config_sound_level,
deviceType,
"",
"",
"diagnostic",
mqtt_topic_config_sound_level,
String("~") + mqtt_topic_config_sound_level,
{ { "ic", "mdi:volume-source" },
{ "min", "0" },
{ "max", "255" }});
Expand All @@ -1128,7 +1128,7 @@ void Network::publishHASSConfigAccessLog(char *deviceType, const char *baseTopic
"Last action authorization",
name,
baseTopic,
mqtt_topic_lock_log,
String("~") + mqtt_topic_lock_log,
deviceType,
"",
"",
Expand All @@ -1147,7 +1147,7 @@ void Network::publishHASSConfigKeypadAttemptInfo(char *deviceType, const char *b
"Keypad status",
name,
baseTopic,
mqtt_topic_lock_log,
String("~") + mqtt_topic_lock_log,
deviceType,
"",
"",
Expand Down Expand Up @@ -1175,7 +1175,7 @@ void Network::publishHASSWifiRssiConfig(char *deviceType, const char *baseTopic,
"wifi signal strength",
name,
baseTopic,
mqtt_topic_wifi_rssi,
_lockPath + mqtt_topic_wifi_rssi,
deviceType,
"signal_strength",
"measurement",
Expand All @@ -1198,7 +1198,7 @@ void Network::publishHASSBleRssiConfig(char *deviceType, const char *baseTopic,
"bluetooth signal strength",
name,
baseTopic,
mqtt_topic_lock_rssi,
String("~") + mqtt_topic_lock_rssi,
deviceType,
"signal_strength",
"measurement",
Expand Down Expand Up @@ -1245,7 +1245,7 @@ void Network::publishHassTopic(const String& mqttDeviceType,
{
json["dev_cla"] = deviceClass;
}
json["stat_t"] = String("~") + stateTopic;
json["stat_t"] = stateTopic;

if(stateClass != "")
{
Expand All @@ -1257,7 +1257,7 @@ void Network::publishHassTopic(const String& mqttDeviceType,
}
if(commandTopic != "")
{
json["cmd_t"] = String("~") + commandTopic;
json["cmd_t"] = commandTopic;
}

for(const auto& entry : additionalEntries)
Expand Down

0 comments on commit 9463ee9

Please sign in to comment.