I am currently trying to create/update entities using the REST API (POST), which works in principle. But these entities don’t have a unique ID, I tried to set the unique ID in the payload JSON but apparently this value is ignored.
Furthermore it is not possible to delete/alter these entities via the interface because they don’t have a unique ID, but since there is no entry in YAML for this either, I don’t know how I can delete these entities?
I stumbled upon exactly the same thing. I was playing around with the REST API, deciding whether to use MQTT or native REST API for a certain DIY project, and was failing to achieve an entity creation with unique_id.
Did you succeed? I found this thread through searching this problem, and maybe a canonical response may benefit future users --even an “it’s not possible”, as I don’t know if I’m not looking properly at the documentation or if that happens by design.
This can only be described as clunky for addons that want to add sensors to HA, as I developer of a number of addons relying on the end user to finish the install is sub optimal…
I bumped into this same issue when I set up my sensor arrangement POST their data to HA. The script performing the POST to /api/states/ processes the sensor data and generates all the necessary attributes as well, including unique_id but indeed that one is not respected by HA, so I cannot edit those sensors in UI.
As the sensors are algoritmically created by the POST script “on the fly” I cannot be bothered to manually create a template sensor for each of them.
Seconded, same issue here. HA does not respect unique_id set in post request payload. This sucks a lot because I have like 60 sensors and creating empty template sensors in ui is… problematic at least.