Hi,
I’m sending some values to HA through REST API like so:
curl -X POST --header "Content-Type: application/json" --header "Authorization: Bearer XXXXXXXXXXX" -d '{"state": "10", "attributes": {"unit_of_measurement": "°C"}}' "http://x.x.x.x:8123/api/states/sensor.test"
After sending the first value, I went to Settings → Customizations and added a friendly_name to the newly created “test” entity. The entity now has the customized name displayed in the UI.
I then update the value with the same curl command. Now the friendly_name is no longer displayed in the UI even though the customization setting still exists.
- Is it expected behavior that the friendly_name attribute is not honored after the entity receives a new value through REST (which does not assign a friendly_name attribute)?
I also noticed that the entities created through REST API disappear from the UI after a core restart. They reappear (along with their history) when the entity receives a new value.
- Why do the entities disappear after core restart (until they receive a new value)? Can I change this behavior?
I also tried to create a unique ID for the entity like so:
curl -X POST --header "Content-Type: application/json" --header "Authorization: Bearer XXXXXXXXXXX" -d '{"state": "10", "attributes": {"unique_id": "test1234"}}' "http://x.x.x.x:8123/api/states/sensor.test"
The UI however still says that the entity does not have a unique id. Unique_id shows up as a normal attribute.
- Is it not possible to assign a unique ID through the REST API?
Thanks.