Hello everybody,
I’m trying to build a door locked/unlocked sensor with ESPHome. Until about an hour ago I was using a homebrew homie node (GitHub - homieiot/homie-esp8266: 💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT), but since it was the last of its kind in my IoT world I wanted to get rid of it. The hardware is an ESP 8266 with an optocoupler connected to GPIO13. When the door is unlocked, the optocoupler pulses with 50Hz.
My ESPHome configuration for this right now is the following:
sensor:
- platform: pulse_counter
pin: GPIO13
name: "Pulse Counter"
id: optocoupler
update_interval: 1s
binary_sensor:
- platform: template
name: "Door Open"
id: door_open
condition:
sensor.in_range:
id: optocoupler
above: 500.0 # 50Hz are around 3000 pulses/second
This works reliably for the door locked/unlocked detection, but on the other hand it pushes the pulse counter to home assistant every second, which I don’t need/want.
I tried setting the update_interval to never, but unfortunately that also killed the door locked/unlocked detection.
Is there a way to create a binary information from the optocoupler pin (pulses / no pulses) without actually sending pulse counter values to home assistant?