Update MQTT to send model as device name

Adds a device name as model for HomeAssistant that shows in Device info.
This commit is contained in:
NightMean
2024-10-01 22:04:28 +02:00
committed by GitHub
parent 040f2792e4
commit c6fe09d366

View File

@@ -93,6 +93,7 @@ class sensor_config:
self.sensorName = sensorName
self.icon = icon
self.mac = mac
self.model = deviceName
self.state_topic = ''
self.json_attr_topic = ''
self.topic = ''
@@ -143,6 +144,7 @@ class sensor_config:
{
"identifiers" : [self.deviceId+"_sensor", self.unique_id],
"manufacturer" : "NetAlertX",
"model": self.model if self.model else "Unknown",
"name" : self.deviceName
},
}
@@ -430,6 +432,7 @@ def mqtt_start(db):
"is_new": str(device["dev_NewDevice"]),
"vendor": sanitize_string(device["dev_Vendor"]),
"mac_address": str(device["dev_MAC"]),
"model": devDisplayName,
"last_connection": str(device["dev_LastConnection"]),
"first_connection": str(device["dev_FirstConnection"])
}