From f225645b78e5b09e23990c6efd76b5303ced50a4 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 30 Apr 2022 09:37:13 +0200 Subject: make device ID part of device name --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 3f9f27b..143669a 100644 --- a/init.lua +++ b/init.lua @@ -86,7 +86,7 @@ function hass_config(client, topic, message) end function hass_register() - local hass_device = string.format('{"connections":[["mac","%s"]],"identifiers":["%s"],"model":"ESP8266","name":"ESP8266 SDS011","manufacturer":"DIY"}', wifi.sta.getmac(), device_id) + local hass_device = string.format('{"connections":[["mac","%s"]],"identifiers":["%s"],"model":"ESP8266 + SDS011","name":"SDS011 %s","manufacturer":"derf"}', wifi.sta.getmac(), device_id, chip_id) local hass_entity_base = string.format('"device":%s,"state_topic":"%s/data","expire_after":1800', hass_device, mqtt_prefix) local hass_pm2_5 = string.format('{%s,"name":"PM2.5","object_id":"%s_pm2_5","unique_id":"%s_pm2_5","device_class":"pm25","unit_of_measurement":"µg/m³","value_template":"{{value_json.pm2_5_ugm3}}"}', hass_entity_base, device_id, device_id) local hass_pm10 = string.format('{%s,"name":"PM10","object_id":"%s_pm10","unique_id":"%s_pm10","device_class":"pm10","unit_of_measurement":"µg/m³","value_template":"{{value_json.pm10_ugm3}}"}', hass_entity_base, device_id, device_id) -- cgit v1.2.3