D1 Mini + 12V PIR from old alarm system

I don’t know what is Logbook.
I would like to see your logger log.

I have some doubts about your wiring as well, because if you previously had your sensor configured pulldown: true, there is no way you could get trigger from your sensor while Com is connected to esp32 GND.

Is your wiring like this ? (the count of sensors is not important)


IN1 and 2 are your input pins (Gpio25 …)

Yes, that is exactly how it is wired and was for the previous Arduino and Homevision before that.

All PIRs share the same 12V PSU, all share a common ground, only the input of each changes to a seperate pin/terminal.

I am not yet familiar with HA at all, I am learning but it’s a steep curve with a lot going on as I migrate but so long as I get pointed in the right direction, I’ll find stuff. In the core logs I spotted this reported:

Logger: aioesphomeapi.connection
Source: runner.py:189
First occurred: 14:37:25 (1 occurrences)
Last logged: 14:37:25

esphome-web-8733d8 @ 192.168.2.3: Connection error occurred: [Errno 104] Connection reset by peer

I don’t know where else to look for more info.

So you understand that with pulldown: true the pin is always LOW. Triggered or not. So it’s impossible you got triggers from that pin…

I can only report what I see. Even if I don’t completey understand it.

With the code set as above I have a common to ground and the input for the PIR on GPIO 25, I just went and checked that agin, just to be sure and that is exactly how it is wired.

What I don’t get is why it’d see multipe instances then just stop responding.

You need to observe your runtime log. Do you have Esphome dashboard?

No, I don’t seem to only what comes out the box from ESPHome and HA, do you man this:

I don’t know that. My setup is standalone.
I mean something like this:

I think I found it and the log there says this:

INFO ESPHome 2024.11.1
INFO Reading configuration /config/esphome/esphome-web-8733d8.yaml...
Failed config

binary_sensor.gpio: [source /config/esphome/esphome-web-8733d8.yaml:53]
  platform: gpio
  pin: 
    number: 13
  
  [mode] is an invalid option for [binary_sensor.gpio]. Please check the indentation.
  mode: 
    input: True
    pullup: True
    pulldown: False
  name: Bathroom Ceiling PIR
  device_class: motion

what is that??

You should have:

binary_sensor:
  - platform: gpio
    pin:
      number: 25
      mode:
        input: true
        pullup: true

I can’t find that in the yaml at all, the complete thing is below. I’ll change the other parts of it now.

substitutions:
  name: esphome-web-8733d8
  friendly_name: PIR ESP

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

binary_sensor:
  - platform: gpio
    pin: GPIO13
    number: GPIO13
    mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Bathroom Ceiling PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 12
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Media Room PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 14
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Upstairs Hallway PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 27
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Kitchen Ceiling PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 26
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Dining Room PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 25
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Downstairs Hallway PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 33
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Master Bedroom PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 32
      mode: 
        input: true
        pullup: true
        pulldown: false
    name: "Master Bedroom Ensuite PIR"
    device_class: motion

Sorry, but I hope this helps as I tried this:

binary_sensor:
  - platform: gpio
    pin: GPIO13
    number: 13
    mode: 
        input: true
        pullup: true
    name: "Bathroom Ceiling PIR"
    device_class: motion

And I get…

INFO ESPHome 2024.11.1
INFO Reading configuration /config/esphome/esphome-web-8733d8.yaml...
Failed config

binary_sensor.gpio: [source /config/esphome/esphome-web-8733d8.yaml:53]
  platform: gpio
  pin: GPIO13
  
  [number] is an invalid option for [binary_sensor.gpio]. Did you mean [name]?
  number: 13
  
  [mode] is an invalid option for [binary_sensor.gpio]. Please check the indentation.
  mode: 
    input: True
    pullup: True
  name: Bathroom Ceiling PIR
  device_class: motion

it’s not correct yaml…
Copy this:

binary_sensor:
  - platform: gpio
    pin:
      number: 25
      mode:
        input: true
        pullup: true
    name: "Downstairs Hallway PIR"
    device_class: motion

And don’t use Gpio12, it’s strapping pin.

Okay.

So now the yaml reads:

binary_sensor:
  - platform: gpio
    pin:
      number: 13
      mode:
        input: true
        pullup: true
    name: "Bathroom Ceiling PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 05
      mode:
        input: true
        pullup: true
    name: "Media Room PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 14
      mode: 
        input: true
        pullup: true
    name: "Upstairs Hallway PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 27
      mode: 
        input: true
        pullup: true
    name: "Kitchen Ceiling PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 26
      mode: 
        input: true
        pullup: true
    name: "Dining Room PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 25
      mode: 
        input: true
        pullup: true
    name: "Downstairs Hallway PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 33
      mode: 
        input: true
        pullup: true
    name: "Master Bedroom PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 32
      mode: 
        input: true
        pullup: true
    name: "Master Bedroom Ensuite PIR"
    device_class: motion

And when tested I get this which, to me looks good but as I said, I am no expert with no experience with this stuff so can’t say for sure:

INFO ESPHome 2024.11.1
INFO Reading configuration /config/esphome/esphome-web-8733d8.yaml...
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from 192.168.2.3 using esphome API
INFO Successfully connected to esphome-web-8733d8 @ 192.168.2.3 in 0.093s
INFO Successful handshake with esphome-web-8733d8 @ 192.168.2.3 in 0.023s
[20:25:18][I][app:100]: ESPHome version 2024.10.3 compiled on Nov 19 2024, 09:22:50
[20:25:18][I][app:102]: Project esphome.web version dev
[20:25:18][C][wifi:600]: WiFi:
[20:25:18][C][wifi:428]:   Local MAC: 3C:E9:0E:87:33:D8
[20:25:18][C][wifi:433]:   SSID: [redacted]
[20:25:18][C][wifi:436]:   IP Address: 192.168.2.3
[20:25:18][C][wifi:440]:   BSSID: [redacted]
[20:25:18][C][wifi:441]:   Hostname: 'esphome-web-8733d8'
[20:25:18][C][wifi:443]:   Signal strength: -30 dB ▂▄▆█
[20:25:18][C][wifi:447]:   Channel: 7
[20:25:18][C][wifi:448]:   Subnet: 255.255.255.0
[20:25:18][C][wifi:449]:   Gateway: 192.168.2.1
[20:25:18][C][wifi:450]:   DNS1: 192.168.2.1
[20:25:18][C][wifi:451]:   DNS2: 0.0.0.0
[20:25:18][C][logger:185]: Logger:
[20:25:18][C][logger:186]:   Level: DEBUG
[20:25:18][C][logger:188]:   Log Baud Rate: 115200
[20:25:18][C][logger:189]:   Hardware UART: UART0
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Bathroom Ceiling PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO13
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Media Room PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO12
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Upstairs Hallway PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO14
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Kitchen Ceiling PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO27
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Dining Room PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO26
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Downstairs Hallway PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO25
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Master Bedroom PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO33
[20:25:18][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Master Bedroom Ensuite PIR'
[20:25:18][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[20:25:18][C][gpio.binary_sensor:016]:   Pin: GPIO32
[20:25:18][C][esp32_ble:391]: ESP32 BLE:
[20:25:18][C][esp32_ble:393]:   MAC address: 3C:E9:0E:87:33:DA
[20:25:18][C][esp32_ble:394]:   IO Capability: none
[20:25:18][C][esp32_ble_server:200]: ESP32 BLE Server:
[20:25:18][C][esp32_improv.component:269]: ESP32 Improv:
[20:25:18][C][captive_portal:089]: Captive Portal:
[20:25:18][C][web_server:153]: Web Server:
[20:25:18][C][web_server:154]:   Address: esphome-web-8733d8.local:80
[20:25:18][C][mdns:116]: mDNS:
[20:25:18][C][mdns:117]:   Hostname: esphome-web-8733d8
[20:25:18][C][esphome.ota:073]: Over-The-Air updates:
[20:25:18][C][esphome.ota:074]:   Address: esphome-web-8733d8.local:3232
[20:25:18][C][esphome.ota:075]:   Version: 2
[20:25:18][C][safe_mode:018]: Safe Mode:
[20:25:18][C][safe_mode:020]:   Boot considered successful after 60 seconds
[20:25:18][C][safe_mode:021]:   Invoke after 10 boot attempts
[20:25:18][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[20:25:18][C][api:140]: API Server:
[20:25:18][C][api:141]:   Address: esphome-web-8733d8.local:6053
[20:25:18][C][api:145]:   Using noise encryption: NO
[20:25:18][C][improv_serial:032]: Improv Serial:

The only problem is, i doesn’t seem to register movement.

You still don’t have runtime log presenting what’s going on while you trigger motion.
Also, for debugging your problem, I suggest to reduce your setup to minimum, both hardware and code. Just Esp and one sensor, no weird configurations.

Sorry, I don’t know where to find the runtime log.

I have the yaml file now set to this:

substitutions:
  name: esphome-web-8733d8
  friendly_name: PIR ESP

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

binary_sensor:
  - platform: gpio
    pin:
      number: 25
      mode: 
        input: true
        pullup: true
    name: "Downstairs Hallway PIR"
    device_class: motion

On the ESPHome log it gives me this when that’s uploaded:

INFO ESPHome 2024.11.1
INFO Reading configuration /config/esphome/esphome-web-8733d8.yaml...
INFO Starting log output from 192.168.2.3 using esphome API
INFO Successfully connected to esphome-web-8733d8 @ 192.168.2.3 in 0.021s
INFO Successful handshake with esphome-web-8733d8 @ 192.168.2.3 in 0.091s
[21:07:21][I][app:100]: ESPHome version 2024.10.3 compiled on Nov 19 2024, 09:22:50
[21:07:21][I][app:102]: Project esphome.web version dev
[21:07:21][C][wifi:600]: WiFi:
[21:07:21][C][wifi:428]:   Local MAC: 3C:E9:0E:87:33:D8
[21:07:22][C][wifi:433]:   SSID: [redacted]
[21:07:22][C][wifi:436]:   IP Address: 192.168.2.3
[21:07:22][C][wifi:440]:   BSSID: [redacted]
[21:07:22][C][wifi:441]:   Hostname: 'esphome-web-8733d8'
[21:07:22][C][wifi:443]:   Signal strength: -40 dB ▂▄▆█
[21:07:22][C][wifi:447]:   Channel: 7
[21:07:22][C][wifi:448]:   Subnet: 255.255.255.0
[21:07:22][C][wifi:449]:   Gateway: 192.168.2.1
[21:07:22][C][wifi:450]:   DNS1: 192.168.2.1
[21:07:22][C][wifi:451]:   DNS2: 0.0.0.0
[21:07:22][C][logger:185]: Logger:
[21:07:22][C][logger:186]:   Level: DEBUG
[21:07:22][C][logger:188]:   Log Baud Rate: 115200
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Bathroom Ceiling PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Upstairs Hallway PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:016]:   Pin: GPIO14
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Kitchen Ceiling PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:016]:   Pin: GPIO27
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Dining Room PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:016]:   Pin: GPIO26
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Downstairs Hallway PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:016]:   Pin: GPIO25
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Master Bedroom PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:016]:   Pin: GPIO33
[21:07:22][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Master Bedroom Ensuite PIR'
[21:07:22][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[21:07:22][C][gpio.binary_sensor:016]:   Pin: GPIO32
[21:07:22][C][esp32_ble:391]: ESP32 BLE:
[21:07:22][C][esp32_ble:393]:   MAC address: 3C:E9:0E:87:33:DA
[21:07:22][C][esp32_ble:394]:   IO Capability: none
[21:07:22][C][esp32_ble_server:200]: ESP32 BLE Server:
[21:07:22][C][esp32_improv.component:269]: ESP32 Improv:
[21:07:22][C][captive_portal:089]: Captive Portal:
[21:07:22][C][web_server:153]: Web Server:
[21:07:22][C][web_server:154]:   Address: esphome-web-8733d8.local:80
[21:07:22][C][mdns:116]: mDNS:
[21:07:22][C][mdns:117]:   Hostname: esphome-web-8733d8
[21:07:22][C][esphome.ota:073]: Over-The-Air updates:
[21:07:22][C][esphome.ota:074]:   Address: esphome-web-8733d8.local:3232
[21:07:22][C][esphome.ota:075]:   Version: 2
[21:07:22][C][safe_mode:018]: Safe Mode:
[21:07:22][C][safe_mode:020]:   Boot considered successful after 60 seconds
[21:07:22][C][safe_mode:021]:   Invoke after 10 boot attempts
[21:07:22][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[21:07:22][C][api:140]: API Server:
[21:07:22][C][api:141]:   Address: esphome-web-8733d8.local:6053
[21:07:22][C][api:145]:   Using noise encryption: NO
[21:07:22][C][improv_serial:032]: Improv Serial:

Using that one pin, pin 25, I’m getting nothing at all reported that I can see. I went into the logs in settings but I couldn’t see anythign relating to ESPHome bar the compiler stuff.

Well that is not what you said:

Have you actually checked this is the actual wiring, GND (or 5V), and is it common?

Could it perhaps be 12V, which the ESP will not like at all?

That’s not so bad. It was worst when you saw something you shouldn’t see.
Just find your log… You don’t have screen like I posted #31?
Maybe @tom_l knows better your setup and can give instructions to get there…

Nope. I am confused as all heck by conflicting statements. :thinking: