I have shelly 2PM with two “deatached” input switch. I use this two input as garage door limit sensor with reed relays.
Sensor code:
trigger:
- platform: state
entity_id:
- binary_sensor.garage_door_input_s1_open
- binary_sensor.garage_door_input_s2_closed
sensor:
- name: Garage Status
unique_id: garage_status
state: >
{% if (states('binary_sensor.garage_door_input_s1_open') == 'unavailable' or states('binary_sensor.garage_door_input_s2_closed') == 'unavailable') %}
unknow
{% elif (states('binary_sensor.garage_door_input_s1_open') == 'on' and states('binary_sensor.garage_door_input_s2_closed') == 'on') %}
sabotage
{% elif (trigger.to_state.state == 'on' and trigger.entity_id == 'binary_sensor.garage_door_input_s1_open') %}
open
{% elif (trigger.to_state.state == 'on' and trigger.entity_id == 'binary_sensor.garage_door_input_s2_closed') %}
closed
{% elif (trigger.from_state.state == 'on' and trigger.to_state.state == 'off' and trigger.entity_id == 'binary_sensor.garage_door_input_s1_open') %}
closing
{% elif (trigger.from_state.state == 'on' and trigger.to_state.state == 'off' and trigger.entity_id == 'binary_sensor.garage_door_input_s2_closed') %}
opening
{% endif %}
When closing or opening state present my automation start a timer for 30 sec:
alias: Garage Door aut.
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.garage_door_input_s1_open
from: "on"
to: "off"
conditions: []
actions:
- action: timer.start
metadata: {}
data: {}
target:
entity_id: timer.garage_time
In this case when binary_sensor.garage_door_input_s1_open state on>off
timer start but sensor state is empty (but there should be “closing”)
If i disable automations states work fine. Where is a problem???
2 posts - 2 participants