Friendly_name not working with RestAPI generated sensor

I have some sensors created by RestAPI posts to HA. I am finding that I cannot get friendly_name to work against these sensors.

I am assuming it is because these sensors effectively don’t exist on restart until they post again.

Does anyone have any idea on how to get around this?

I have done the template sensor thing but ideally I would like the original sensor due to the extra information available when viewing this sensor from the fronted, it just looks nicer :wink:

You could use customize.

I have tried.

Can you share what you’re sending? You should definitely be able to set friendly_name. Basically you’re creating what is called an HTTP Sensor. I just tried it, creating a sensor called sensor.test (which didn’t otherwise exist), and it worked fine:

image

Here is what I sent (with sensitive data redacted):

curl -X POST -H "Content-Type: application/json" -d '{"state": "20", "attributes": {"friendly_name": "Test Test Test"}}' https://IP:8123/api/states/sensor.test -H "Authorization: Bearer XXXXXX"
1 Like

I did not even think of sending friendly_name in the http post.

Thank you, all sorted now. :smile:

1 Like