I have a home alarm system, I built a Wemos D1 mini a while back that detected PIR motion via a comparator to GPIO pins and sent via MQTT back to OpenHAB. I wrote an instructable for it 5.5 years ago https://www.instructables.com/Alarm-PIR-Movement-to-Home-Automation/
I’m currently migrating to HA
I’ve setup ESPHome on the Wemos D1 mini instead and YAML code for binary sensor to report to HA, but am getting some varying results. The board is defined as d1_mini. YAML code for esphome is:
binary_sensor:
- platform: gpio
pin:
number: D1
mode: INPUT_PULLUP
inverted: True
name: "Alarm Zone 1"
id: alarm_zone_1
device_class: motion
filters:
- autorepeat:
- delay: 2000ms
time_off: 5000ms
time_on: 10ms
- platform: gpio
pin:
number: D2
mode: INPUT_PULLUP
inverted: True
name: "Alarm Zone 2"
id: alarm_zone_2
device_class: motion
filters:
- autorepeat:
- delay: 2000ms
time_off: 5000ms
time_on: 10ms
- platform: gpio
pin:
number: D8
mode: INPUT_PULLUP
name: "Alarm Zone 3"
id: alarm_zone_3
device_class: motion
filters:
- autorepeat:
- delay: 2000ms
time_off: 5000ms
time_on: 10ms
- platform: gpio
pin:
number: D7
mode: INPUT_PULLUP
inverted: True
name: "Alarm Zone 4"
id: alarm_zone_4
device_class: motion
filters:
- autorepeat:
- delay: 2000ms
time_off: 5000ms
time_on: 10ms
Basically a separate GPIO for each PIR, low = motion detected, high = idle
Testing walking between Lounge (D1) and First hallway (D2), the HA zone “detected” gives the wrong results.
Walked past First Hallway PIR, HA Lounge triggers. Continue walking into Lounge PIR, it triggers HA Lounge. Walked back to first Hallway, it triggers HA First hallway. Stood still, then moved to trigger first hallway PIR and it set off HA Lounge.
(same symptoms without filters, that was testing) It’s quite intermittent. However checking ESPHome logs I see the correct GPIOs are triggered
Almost seems that HA is triggering the wrong entity, even though the correct zones are sent by ESPHome.
Any ideas?
Home Assistant 2023.4.6
Supervisor 2023.04.1
Operating System 10.0
Frontend 20230411.1 - latest