Trying to detect garage door state. It has 2 LEDs that can be either on, off, or blinking. I can detect open/closed states no problem, but would like to be able to also detect opening and closing states, which are indicated by one or the other of the LEDs blinking. In my cover template I would like to have further checks and return opening, or closing states.
binary_sensor:
- platform: gpio
pin:
number: GPIO14 # D5
mode: INPUT_PULLUP
inverted: False
id: garage_closed
name: "${friendly_name} - Closed Sensor"
filters:
- delayed_on_off: 0.3s
cover:
- platform: template
device_class: garage
name: "${friendly_name} - Door"
lambda: |-
if (id(garage_closed).state) {
return COVER_CLOSED;
} else {
return COVER_OPEN;
}
I was thinking I somehow need to change the binary sensors to something else such as a pulse sensor, which gives more than just true/false, or somehow check for blinking in the lambda statement?
I tinkered around with a pulse_width for the LED, but then my cover template didn’t like the sensor not being binary.
any suggestions?