Tried to loo this up, I’m pretty sure, this question has been posted here, but no luck…
I’m using Xiaomi window/door sensor, and it is connected to window shutter.
When the sensor is ‘off’, it means the window shutter is ‘open’. Pls don’t ask why!
Wanted to convert values, so I can see in HomeKit, if the shutter is open:
off → Open
on → Closed
the following code works:
- platform: template
sensors:
office_shutter_status:
friendly_name: Office shutter
entity_id:
- binary_sensor.door_window_sensor_158d00044d980b
value_template: >-
{%- if is_state(“binary_sensor.door_window_sensor_158d00044d980b”, “off”) -%}
open
{%- else -%}
closed
{%- endif -%}
The only problem is, HomeKit doesn’t want to process it.
Thx for the helps!