Unable to set sensor entity state

I have binary sensor entity (motion sensor) which automatically sets the state based on motion detection. Once the state is set it is cleared also by sensor in 2 minutes. In my flow based on motion sensor state I am turning on/off a light.

I also have wall switch by which I am using to turn on/off the light.

I would like to configure the flow that whenever the light is on (turned on by motion sensor) and the switch is clicked, the light goes off (which is not a problem) and binary_sensor state is cleared as well (have not idea how to do that in node red).

In home assistant I am able to change binary_sensor state in developer tools window.
Unfortunately I haven’t found any relevant node which I could use in node red.

Thanks for help,

You are not supposed to do that, that sensor data belongs to a physical device.

i understand what you want to do but i didn’t understand why you need it.

You have a motion sensor and physical switch.
if motion sensor is triggered, light is open.

What would be the benefit of clearing state of motion sensor here?

I’m guessing that you want to use this to test a flow? Changing the state in dev tools will trigger in nodered. Otherwise with a trigger state node you can send a message to simulate a state change.

  "entity_id": "test_entity",
  "old_state": {
    "state": "on"
  "new_state": {
    "state": "off"

The reason I want to do that is to be able to have following flow:

  1. Motion is detected - senseor state is on (will be on for another 3 minutes)
  2. Ligth goes on.
  3. User press a wall switch to turn off the light.
  4. Light goes off, but motion sensor is still on.
  5. If a user gets back to the room, light does not go on, because motion sensor does not trigger any state change (first motion has to go to off state and then back to on state).

Are you sure your motion sensor will trigger another event if you set the state manually? As far as i know, this is a hardware limitation on the sensor rather than you can fix it over software

Well, it was just a assumption and obviously (just made a test) it was wrong.
I guess I will not be able to configure my desired flow, correct?

Yes, you are correct, there are some hacks for aqara zigbee motion sensors to minimize the timeout interval, down to 5 seconds. You can take a look at it but it requires labor to modify circuit a bit.

Thanks for the hint.
If anybody interested it is this post.