What's the deal with ID's changing?

I have used Hassio for a couple of years, with 50 devices and hundreds of automations written.

What I havent gotten my head around, is why the friggen device ID’s keep changing after Wifi goes down or after a system restore? So annoying having to look over all groups and automations to change.

I had a light light.yeelight_color1_34ce0090f12e which ID is now based on its name, light.kitchen_back.

What puzzles me the most, is 2 of my lights switched places, light.yeelight_strip1_7811dc63bc0d became light.yeelight_color2_04cf8c7cba2a in the front-end, with the name and icon and all, and vice versa.

And I’m not even getting into the appended “_2” to ID’s after a restart sometimes… How to set an ID properly so it doesnt frick everything up by changing itself?

So your issue is with yeelight ?
Anything else suffered with this ?
How many devices are we talking about ?

do you have dhcp reservation on your bulbs? Are you using discovery? if you answered no to both of those, you have your answer. Make the IP’s static and switch to a manual configuration.

you are right, i was overthinking this one :wink:

Thanks for the reply, here’s a summary:

  • yes all yeelights, like 15 of them total. my TV also keeps changing its name, but switches and speakers stay the same.
  • for DHCP haven’t changed anything from Yeelight app, neither from my router
  • yes, discovery is enabled

No, what Petro meant was : - "did you assign fixed ip addresses to these items, so HA knows that 192.168.0.69 will ALWAYS be the ‘bedroom light’ ? "

if you don’t have static ip’s set (DHCP Reservation), then every time your router restarts, it will randomly assign IP’s to your bulbs. Effectively switching them around for home assistant. Make them static, then configure them manually. Yes it’s harder than regular discovery, but you won’t ever have to deal with this again. Unless you get a new router.

Doesnt yellights have Mac addresses to identify?

It’s possible. I don’t use yeelights. But upon restart if the IP changes and the entity registry holds on to that information, it will be calling the wrong IP. I haven’t debugged into the functionality enough to know if this is the case, i’m just speculating. Either way, the first thing he should do is remove any of this possibility. If it turns out that this is not the issue, then we probably have a bug on our hands. But I doubt it because others would have this issue as well.

Okay, routing is done by IP address’
But most routing tables (I’ve come across at least) link the IP to the mac.
I’ve never seen a device without a mac address as that is what is normally required to register on a network (i.e. a unique identifier).
It ‘may’ be possible to have a device without a mac address but in that case how does any device register as it needs to ‘appear’ so an IP can be offered. And what happens when you have two such devices on the same network ? :man_shrugging: