I’m trying to create MQTT switches from my addon (simplescheduler)
Every switch has a unique ID.
For example if the ID is 624aa7cb8eca6 I publish the config under the topic:
homeassistant/switch/simplescheduler/624aa7cb8eca6/config
and this is the JSON:
{
“unique_id”: “simplescheduler_624aa7cb8eca6”,
“name”: “Scheduler: 12 test” ,
“icon”:“mdi:calendar-clock” ,
“cmd_t”: “homeassistant/switch/simplescheduler/624aa7cb8eca6/set”,
“stat_t”: “homeassistant/switch/simplescheduler/624aa7cb8eca6/state”,
“avty_t”: “homeassistant/switch/simplescheduler/availability”,
“pl_avail”:“online”,
“pl_not_avail”:“offline”
}
I’m expected to find a switch with this entity_id: switch.simplescheduler_624aa7cb8eca6
instead I get switch.scheduler_12_test
Basically, it uses the name instead of the unique_id.
Furthermore, I run a loop at the addon start to publish the config topics of all the switches, but only the first switch is added immediately. All the others appear after a couple of minutes. Is this normal?
Thank you for any help!