WTH are there unique_id and entity_id?

So unique ID and entity ID are different things.

  • Unique ID: This is a stable, none-changeable identifier. For example, consisting of a MAC address of a device, a serial number, that kind of thing. It is used to be able to uniquely, and stably identify a device and its entities. Regardless, of any other change.

  • Entity ID: This is a user identifier. You define the entity ID, you can change it or it could be based on the name. Additionally, entity IDs will iterate when a collision occurs (e.g., adding _2 to it).

So, the unique ID is what internally is always used to be able to point to the same entities in a stable way. Entity ID is yours to do whatever you like and want.

Considering the above, it means that a unique ID should be provided by the integration, not the user.

That said, adding unique IDs to integration, in general, is a fairly easy task for a developer to do, so if you run in such cases: Maybe just ask if it is possible to add for that specific integration.

4 Likes