[Solved] Invert/reverse reported status of a binary sensor?

I have a lock, which is a binary sensor, where the reported status is reversed:
When I lock the door, it is reported it as ‘unlocked’ and visa versa.

How can resolve this? Is there a way to invert the reported value?

1 Like

A little more detail might help. E.g., what creates the binary_sensor? Can you share any configuration code that is related to this sensor?

The sensor is created by the Fibaro Gateway component.

afbeelding

customize.yaml:

binary_sensor.gang_gang_deurslot:
friendly_name: Gang Deurslot
device_class: lock

Translations (Dutch):
Gang = Hallway
Deurslot = Door lock

Well, I took a quick look through the Fibaro config options, and its code, but I didn’t see any obvious way to do it. Of course it’s a bit complex, and I’m not familiar with the Fibaro component, so unfortunately I don’t have any answers. Sorry I couldn’t help.

1 Like

Thanks for trying @pnbruckner, it’s appreciated!

Maybe anyone else do have some clues?

Just tried this it creates a binary sensor that is the inverse of the stated binary sensor, maybe this will work ?

- platform: template
  sensors:
    gang_gang_deurslot_invert:
      value_template: >-
        {{ is_state('binary_sensor.gang_gang_deurslot', 'off') }}
3 Likes

You’ll need to change the device class too

1 Like

or just make it into a binary sensor template instead of sensor template

1 Like

Adding this code to my binary_sensor.yaml works!

  - platform: template
    sensors:
      gang_deurslot_invert:
        value_template: >-
           {{ is_state('binary_sensor.gang_gang_deurslot', 'off') }}
        friendly_name: Gang Deurslot
        device_class: lock  

Thank you guys!!

1 Like

Can’t you just switch the + and - wire? That’s what I did when my curtain said it was open when it was closed and visa versa.

1 Like

No @Slinkos, that’s not possible.

The lock is allright configured in my Fibaro controller gaterway, by Zwave. It was only inverted in Home Assistant.

Thanks for your suggestion! :+1:

1 Like