Open is Closed

I’m sure this must be easy but cant seem to find a way of doing it - I appreciate that it can be done by templating but thats not something I am familiar with the use of. Basically I have a gate that the sensor position is such that open is actually closed - So I just want it to reverse. Any help appreciated.

Which integration are you using?

Some of them can invert the state.

Some sensors have configuration options to invert status too.

Its Tuya Door/Window Sensor - There’s no invert option unfortunately.

So a magnetic reed switch?

There’s a simple hardware hack for that.

Affix a similar sized magnet near the sensor. This will activate the magnetic reed switch. When the movable magnet comes nearby the magnetic fields cancel out and the reed switch deactivates.

1 Like

You could create another sensor based on this one and with a small template…show the inverse value.

Do you mean so that it is effectively permanently set closed? Thanks

I assumed that you wanted to reverse the value…i.e. when the gate is closed to show ‘closed’ and not open…and vv. Hereby an example how I am creating a new temp. sensor, correcting the value of a HUE sensor…you could do the same with a simple if/then.

  • platform: template
    sensors: hue_motion_sensor_flat_temperature_offset:
    friendly_name: “Hue Motion Sensor Temperature Flat Offset”
    unit_of_measurement: “°C”
    value_template: “{{ float(states(‘sensor.sensor_gang_temperature’)) + 1.4 }}”

Thanks will give that a try. Appreciate all helps…

It reverses the operation of the sensor.