Invert a binary sensor value with a helper

Hi folks,
I have an apparently easy task that I’m failing to solve.

I created an unusual setup where my zigbee door sensors (binary_sensor customized in the settings to show as “door” type) react to the position of my door lock, and the only problem is that when the door is open the sensor reads “closed” and vice versa.

Is there any simple way to “invert” the reading? Maybe create a helper that will output the correct, inverted value? I think a helper would be most useful as I’m planning to incorporate two door sensors (one for each lock) and create an output of “Locked/Partially locked/Open” etc.

Any tips would be greatly appreciated!

1 Like
{{ not states('binary_sensor.device_connected') }}
1 Like