summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-04-30 09:37:13 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-04-30 09:37:13 +0200
commitf225645b78e5b09e23990c6efd76b5303ced50a4 (patch)
treec31e802d8a5bcd2e2d75f4da933d2f6e3b5c0554
parent9e73dfb971c20fa8c71a85e99209c1ec2aa41421 (diff)
make device ID part of device name
-rw-r--r--init.lua2
1 files changed, 1 insertions, 1 deletions
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)