mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
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:
@@ -93,6 +93,7 @@ class sensor_config:
|
|||||||
self.sensorName = sensorName
|
self.sensorName = sensorName
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
self.mac = mac
|
self.mac = mac
|
||||||
|
self.model = deviceName
|
||||||
self.state_topic = ''
|
self.state_topic = ''
|
||||||
self.json_attr_topic = ''
|
self.json_attr_topic = ''
|
||||||
self.topic = ''
|
self.topic = ''
|
||||||
@@ -143,6 +144,7 @@ class sensor_config:
|
|||||||
{
|
{
|
||||||
"identifiers" : [self.deviceId+"_sensor", self.unique_id],
|
"identifiers" : [self.deviceId+"_sensor", self.unique_id],
|
||||||
"manufacturer" : "NetAlertX",
|
"manufacturer" : "NetAlertX",
|
||||||
|
"model": self.model if self.model else "Unknown",
|
||||||
"name" : self.deviceName
|
"name" : self.deviceName
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -430,6 +432,7 @@ def mqtt_start(db):
|
|||||||
"is_new": str(device["dev_NewDevice"]),
|
"is_new": str(device["dev_NewDevice"]),
|
||||||
"vendor": sanitize_string(device["dev_Vendor"]),
|
"vendor": sanitize_string(device["dev_Vendor"]),
|
||||||
"mac_address": str(device["dev_MAC"]),
|
"mac_address": str(device["dev_MAC"]),
|
||||||
|
"model": devDisplayName,
|
||||||
"last_connection": str(device["dev_LastConnection"]),
|
"last_connection": str(device["dev_LastConnection"]),
|
||||||
"first_connection": str(device["dev_FirstConnection"])
|
"first_connection": str(device["dev_FirstConnection"])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user