For an intercom based doorbell detector that’s capable of automatic opening the central door of the building, I need to distinguish two types of signals:
- front door of the appartment
- central intercom of the building
I already designed the circuit (using a opto-coupler and reading the signal to the door chime) and i’m able to detect when the front door button / central door of the building is pressed.
For now, I just let esphome detect a low signal on pin d2 (active low) by using the binary sensor.
- platform: gpio
pin:
number: D2
inverted: true
name: "Deurbel"
device_class: sound
filters:
- delayed_off: 1500ms
This is working great and without any delay.
next step: distinguish between two signals
I measured the signals of the central door of the building and front door of my appartment.
Main differences:
- Central door signal duration is +/- 453 ms , while front door signal duration is +/- 905 ms
- Central door signal has 480 rising pulses, while front door signal has 1000 rising pulses
- Central door signal sometimes has a longer pulse, while frond door signal has equal pulse length everywhere.
ESP Home challenge: detect difference
Now on to my main question:
Does somebody knows a good way of letting esphome making a distinction between these two signals?
If making the code myself, I would have used an interrupt and count pulses, but i’m not sure what the best way is to do it in ESPhome.
I am thinking about some different possibilities:
Option 1: if signal on pin D2 is > 460ms , front door bell (appartment) is pressed. If signal on pin d2 <= 460ms, central door is pressed. Perhaps something with a timer and a lambda?
Option 2: using the pulsecounter, count all rising edges . Problem with this: more delay due too the way the pulsecounter works.
Option 3: using raw ir code in esphome to detect the two signals
Someone with good ideas or other good options to do make a distinction in esphome between these two signals?