Hi all,
I had a working solution for my garage roller door (previous topic), which worked for 4 years, but one of the recent HA updates or something else broke it, well, broke the states, I can still control and see the status of the sensors.
I have Sonoff SV which is controlling the motor and 2 Aqara sensors with one magnet. Depending on the magnet position I know the state of the garage door - if it’s touching one sensor the door is closed, if touching another the door is opened, if not touching any of sensors - opened, but the last status I don’t care about, I only need to know if it’s closed or fully opened.
My config is:
- Sonoff SV configured as MQTT Cover
- name: "Sonoff SV Garage"
state_topic: "xiaomi-sensor/garage-door/STATE"
command_topic: "cmnd/garage/POWER"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "ON"
state_closed: "OFF"
optimistic: false
- One automation that only publishes the status of one sensor to the state topic for the cover:
alias: MQTT Garage Door STATE
description: ""
triggers:
- entity_id: binary_sensor.door_roller_garage
trigger: state
conditions: []
actions:
- data:
topic: xiaomi-sensor/garage-door/STATE
payload_template: "{{ trigger.to_state.state | upper }}"
retain: true
action: mqtt.publish
mode: single
Currently, no matter wether the garage door is opened or closed my controls are not changing:
Cannot figure out what’s wrong, looks like my automation is no longer working as I cannot trigger the action, it’s giving me “Error rendering data template: UndefinedError: ‘trigger’ is undefined”. Maybe syntacsis is wrong or deprecated.
Can you guys help please, all I need is the controls to be reverted when one of the Aqara sensors status changes from Closed to Open. Or if you have better ideas about this.
Thanks.