Replies: 2 comments 5 replies
-
Have a look at this issue. It shows how to do what you're trying to do. |
Beta Was this translation helpful? Give feedback.
-
I too found this confusing and had to go back and read the documentation which says Then your various Device Types are "Entities" (in home assistant) and can be defined similar to like: Topic: homeassistant/sensor/f412faa081c0/ardUptime/config Let me know how I can help. |
Beta Was this translation helpful? Give feedback.
-
I've made a small test device 'stoplicht' (which is Dutch for 'traffic light', so you'll have a good idea now what exactly this device does). I've got the code in place to give each device a unique id using ESP.getChipID(). I've uploaded the exact same code into multiple WEMOS D1 mini's and ran them. If I look in MQTT Explorer I do see each individual device listed using their unique ids. In Home Assistant however only the device I started first does get entities created for it. I had expected each copy to get their own entities created in HA. In the log I do see an error message for each entity of the next copies:
I'm only listing the error for the entity 'red' here, the other entities have the same error.
I've found that a unique config message does get created in MQTT for each entity for each (copied) device. In the config listed in f.e. homeassistant/switch/dbfa2b00/red/config however the message sent has the same value for "uniq_id": "red" for each device. f.e. Here is the config listed for one device's "red" entity:
{ "name": "red", "uniq_id": "red", "ic": "mdi:led-outline", "dev": { "ids": "dbfa2b00", "name": "StopLicht_2BFADB", "sw": "1.0.0", "mf": "Richard Rozema", "mdl": "stoplicht" }, "avty_t": "stoplicht/dbfa2b00/avty_t", "stat_t": "stoplicht/dbfa2b00/red/stat_t", "cmd_t": "stoplicht/dbfa2b00/red/cmd_t" }
And here is the config for another device's red entity:
{ "name": "red", "uniq_id": "red", "ic": "mdi:led-outline", "dev": { "ids": "f8abe000", "name": "StopLicht_E0ABF8", "sw": "1.0.0", "mf": "Richard Rozema", "mdl": "stoplicht" }, "avty_t": "stoplicht/f8abe000/avty_t", "stat_t": "stoplicht/f8abe000/red/stat_t", "cmd_t": "stoplicht/f8abe000/red/cmd_t" }
I expected the uniq_id passed into HA for each entity to include the unique id I specified for the device, so that each entity would have a unique id in HA too. Do I really need to explicitly include the device's unique_id in each entity's unique id or did I do something wrong?
Beta Was this translation helpful? Give feedback.
All reactions