Need help: I need a binary_sensor to be set by switch status

I spent hours on this and can’t figure it out.
I use a blueprint which requires a binary_sensor (door open/close)
My available binary status for this function is unfortunately not a sensor but the the on/off status of a switch status (on status = door closed, off status = door open)
So I created a binary_sensor helper. So far so good.
Now I try to create an automation using the magnet status as trigger to set the binary_sensor helper on or off.
But I can’t find any action (using the GUI) to change the binary_sensor state.

I also tried to do it within the helper configuration but the status of the helper is not changing when the switch status changes.

I tried this line i the helper state template line (xxxx being the device name):

1: states: not "switch.xxxx"

How to manipulate the status of the helper (binary_sensor) in an automation?

Is this possible using the automation GUI or is my approach wrong?

Anyone who can explain to me the correct approach to solve this problem.

Because the state of a binary_sensor is always controlled by its underlying integration, not by an action.

You created a Template Binary Sensor helper (so it uses the Template integration). The only way to change its state is via its template, which you designed to follow the state of a switch.

The only way the binary_sensor’s state can be changed is by changing the switch’s state (because, according to your explanation, that’s the way you designed it to behave).

Why not simply use an action to set the switch’s state?

switch.turn_on

Your Template Binary Sensor’s state will follow the switch’s state.

1 Like

Thanks for your prompt reply!
I understand that the binar_sensor cannot be controlled by an action. That’s why I can’t use it in an automation. Ok

1 Like