REST API not working

I want to update state for entity without communication with them.
So I use this method /api/states/<entity_id> to change state for an entity.

It’s successful after triggered, but the state of the entity will revert back with in 30-40 secs.

Anyone can help how to troubleshoot this kind of issue?

1 Like

Assuming this entity is managed by some other integration, you are not supposed to overwrite its state like this, rather use service calls to change the state. Integration managed sensors are updated regularly by their respective integrations

Thanks for reply,

The reason I want to set state is I want to sync states for device using RF.

Eg. I have Switch entity controled by RF. But it will not sync when I manually On/Off using remote control.
So I build an RF receiver and make an automation, When I received specific RF code then set state to On/Off for specific Switch.

So I believe these entities are not connected to the network and managed by other intergration.

So, instead of setting direct state using rest API, you can call services like switch.turn_on/off to let the integration manage the state. (api/services/switch/turn_on)

1 Like

It would be nice if there were a little more straightforward introductory documentation in on the main REST API page. I ran into this same problem.