From c6fe09d36615249380999e5c3703163a17ddc7bf Mon Sep 17 00:00:00 2001 From: NightMean <5726996+NightMean@users.noreply.github.com> Date: Tue, 1 Oct 2024 22:04:28 +0200 Subject: [PATCH] Update MQTT to send model as device name Adds a device name as model for HomeAssistant that shows in Device info. --- front/plugins/_publisher_mqtt/mqtt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/front/plugins/_publisher_mqtt/mqtt.py b/front/plugins/_publisher_mqtt/mqtt.py index cbbeb0c0..439ec95a 100755 --- a/front/plugins/_publisher_mqtt/mqtt.py +++ b/front/plugins/_publisher_mqtt/mqtt.py @@ -92,7 +92,8 @@ class sensor_config: self.sensorType = sensorType self.sensorName = sensorName self.icon = icon - self.mac = mac + self.mac = mac + self.model = deviceName self.state_topic = '' self.json_attr_topic = '' self.topic = '' @@ -142,7 +143,8 @@ class sensor_config: "device": { "identifiers" : [self.deviceId+"_sensor", self.unique_id], - "manufacturer" : "NetAlertX", + "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"]) }