Strange UI Behavior With REST Calls

I’m not sure why this happens, but it’s been happening for quite a while. The issue is that I set up a helper (in this case) for the express purpose of toggling it via the rest API, and when I run the rest call it causes the UI icon and name to change. The name goes blank and the icon changes to something else (in this case a check mark).

For example, I have a system where I dismount some hard drives via a command line script that remote SSH’s into that computer to dismount drives. At the end of that shell script I send a CURL to toggle the helper (I use this to know the script ran and that it is safe to now power off the drive tower so I don’t risk harming the drives in the tower when it gets a sudden power off with drives mounted).

Here is what that looks like before the REST api:

Then I run a simple curl:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer [my api key that works" -d '{"state":"on"}' http://homeassistant.local:8123/api/states/input_boolean.rv_drive_dismount_script_run

And when that REST runs, the entity changes to this:

It doesn’t matter if I run this manually or in my script or any other way, every time the REST runs it does this and not just on this entity, I have a dozen or so entities that this occurs on with REST, I’ve just mostly ignored it but it’s always bugged me. It’s not limited to just helper toggles, it happens on every entity I’ve tried this on, even ones where I set a number value.

If I edit the entity and go into the settings of it, everything looks fine. I can just click update here and it’s all back to normal again (notice the header of the popup also goes to lowercase):


Am I missing something in the JSON payload being sent that I should have or something? I tried to see if that was the case but see nothing in the REST docs that indicate there is anything more I need to do. Or maybe this is just some UI bug (although forcing a refresh and clear cache on the browser doesn’t return them to normal, only going in and clicking Update or restarting HA fixes them).

This is a “works as designed” feature. That REST endpoint overwrites the complete state of the object with whatever is provided in the service call, inclusive of attributes such as icon and friendly name. Consider using the /api/services/input_boolean/turn_on endpoint instead.

Edited to correct service name

1 Like

Thank you, I’ll look into that and see what happens.



Is the correct endpoint, but the solution is this. Thanks again!