D1 Mini + 12V PIR from old alarm system

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:

You could be right.

A lot of what I knew about these things are long forgotten, I looked back and using the Arduino dates back over eight years, using a connection to HV Pro to 2011. I was going from memory and it does look as if they are using 12V as an old amp one I had on there was, for sure, 12V.

Which is a right pain.

And my apologies for dodgy info.

Now I dunno what to do as I looked at the Konnected board but it seems expensive and also doesn’t seem to be 100% solid from the reviews.

Sorry, I’m working from memory on this as there’s no info on a lot of it. :frowning:

Can you change the 12V common that goes to the PIR contacts from 12V to 3.3V from the ESP?

If not, you will have to use some resistive dividers to drop the 12V to an acceptable level for each input.

I can’t follow you anymore. So your Com wasn’t Esp GND like you confirmed ?

The common, if what I’m seeing is correct, will be from the 12V supply which I don’t think I can change.

I know that resistors can be used to pull the signal down but my knowledge of electronics is, err, limited. But it’s an option if I can find instructions on what to do and, I’d rather use the wired PIRs as they are rock solid and amazingly robust, there’s nothing to really go wrong with them hardware wise IME. It’s what you connect them to that can be an issue.

I could, I guess convert them all to Z-Wave, I have a bunch of Fibaro universal binary sensors knocking about somewhere I could use but, I’m not so sure that’s a reliable long-term solution.

No problem and thank you for the help and assistance, it is much apprciated.

Is it 12V or ground from that supply though?

If it is ground then that is ok. You just need to connect it to the ESP ground as well.

If it is 12V then resistors are required.

No problem, it explains my question in the first place for impossible trigger.

I’ll need to meter it and, naturally, my meter battery is dead and I don’t have another to hand. And I’m going away tomorrow for a few days, all just typical really. :roll_eyes:

I was hoping that this’d be a quick simple thing, clearly I was wrong. About a few things.

But the more I look, the more I am convinced it’s all 12V all the way through as there’s nothing I can see that’d suggest it was anything but that.

Questoin.

Given I am not experienced with this sort of thing, would using the like of this work to enable using the ESP32:

I decided to start fresh on this.

It is 12V switching on the PIRs so I have sorted that out.

I got the yaml for that all set up as previously but now I get a different result, it says it detects motion with nothing connected at all when testing with only one PIR.

So, I thought, okay, let’s try the others, and ditto, the same on them all. With nothing connected, motion is being reported as detected, even though that’s not possible given there is nothing connected.

The yaml is:

substitutions:
  name: esphome-web-4d889c
  friendly_name: ESPHome Web 4d889c

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
    
  - platform: gpio
    pin:
      number: 13
      mode:
        input: true
        pullup: true
    name: "Bathroom Ceiling PIR"
    device_class: motion

  - platform: gpio
    pin:
      number: 19
      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: 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

The logs from ESPHome for that reads:

INFO ESPHome 2024.11.1
INFO Reading configuration /config/esphome/esphome-web-4d889c.yaml...
INFO Starting log output from 192.168.2.39 using esphome API
INFO Successfully connected to esphome-web-4d889c @ 192.168.2.39 in 0.109s
INFO Successful handshake with esphome-web-4d889c @ 192.168.2.39 in 0.098s
[14:21:23][I][app:100]: ESPHome version 2024.11.1 compiled on Nov 27 2024, 14:12:59
[14:21:23][I][app:102]: Project esphome.web version dev
[14:21:23][C][wifi:600]: WiFi:
[14:21:23][C][wifi:428]:   Local MAC: 2C:BC:BB:4D:88:9C
[14:21:23][C][wifi:433]:   SSID: [redacted]
[14:21:23][C][wifi:436]:   IP Address: 192.168.2.39
[14:21:23][C][wifi:440]:   BSSID: [redacted]
[14:21:23][C][wifi:441]:   Hostname: 'esphome-web-4d889c'
[14:21:23][C][wifi:443]:   Signal strength: -15 dB ▂▄▆█
[14:21:23][C][wifi:447]:   Channel: 7
[14:21:23][C][wifi:448]:   Subnet: 255.255.255.0
[14:21:23][C][wifi:449]:   Gateway: 192.168.2.1
[14:21:23][C][wifi:450]:   DNS1: 192.168.2.1
[14:21:23][C][wifi:451]:   DNS2: 0.0.0.0
[14:21:23][C][logger:185]: Logger:
[14:21:23][C][logger:186]:   Level: DEBUG
[14:21:23][C][logger:188]:   Log Baud Rate: 115200
[14:21:23][C][logger:189]:   Hardware UART: UART0
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Downstairs Hallway PIR'
[14:21:24][C][gpio.binary_sensor:016]:   Pin: GPIO25
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Bathroom Ceiling PIR'
[14:21:24][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[14:21:24][C][gpio.binary_sensor:016]:   Pin: GPIO13
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Media Room PIR'
[14:21:24][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[14:21:24][C][gpio.binary_sensor:016]:   Pin: GPIO19
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Upstairs Hallway PIR'
[14:21:24][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[14:21:24][C][gpio.binary_sensor:016]:   Pin: GPIO14
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Kitchen Ceiling PIR'
[14:21:24][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[14:21:24][C][gpio.binary_sensor:016]:   Pin: GPIO27
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Dining Room PIR'
[14:21:24][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Master Bedroom PIR'
[14:21:24][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[14:21:24][C][web_server:154]:   Address: esphome-web-4d889c.local:80
[14:21:24][C][mdns:116]: mDNS:
[14:21:24][C][mdns:117]:   Hostname: esphome-web-4d889c
[14:21:24][C][esphome.ota:073]: Over-The-Air updates:
[14:21:24][C][esphome.ota:074]:   Address: esphome-web-4d889c.local:3232
[14:21:24][C][esphome.ota:075]:   Version: 2
[14:21:24][C][safe_mode:018]: Safe Mode:
[14:21:24][C][safe_mode:020]:   Boot considered successful after 60 seconds
[14:21:24][C][safe_mode:021]:   Invoke after 10 boot attempts
[14:21:24][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[14:21:24][C][api:140]: API Server:
[14:21:24][C][api:141]:   Address: esphome-web-4d889c.local:6053
[14:21:24][C][api:145]:   Using noise encryption: NO
[14:21:24][C][improv_serial:032]: Improv Serial:

What I would have expected is, that with nothing connected it’d show as clear for all and only show detected when it got a signal from the PIR so I don’t get why I am seeing what I’m seeing now.

To start fresh you should:
-understand what went wrong last time
-learn to use multimeter
-study basics of electronics and microcontrollers
-replace your Esp board abused by 12V on gpios

If you do that, you understand that Esp doesn’t know if something is connected or not, neither if the connected device is a button or motion sensor or something else.
Esp only knows if it’s gpio is high or low. You code how this information is used.
So if you have non-connected pin with pullup: true,
the pin is high or low?
How is it considered on your sensor component?

I think we got to what went wrong. Largely me being in too much of a rush and not taking enough care.

I do know how to use a meter.

Electronics and microcontrollers are not my forte, I freely admit that but I do okay with some guidance. But, I’ve never worked with these ESP boards at all nor HA, I am new to a lot of this stuff.

I am using a new ESP32 board, factory fresh just set up but not connected to anything as yet. My thinking was to see it in a stable state and make sure all is well before I connect anything to it.

The way my present Aurdino is set to work is, no power the pin shows as “open” and “closed” when it gets power, just binary stuff and when I get to that point I am sorted, everything else I should be able to work out for myself. My assumption was that, if this shows as it does there might be a problem with what I’ve done and I didn’t want to connect anything and break it without checking.

So learn to use it :wink:

Esp32 doesn’t work like that.
Pin can be set output or input.
Output can be high or low (0 or 3.3V)
Input can be high impedance state, pullup or pulldown.
Usually you set input pullup and trigger it with GND. When you have internal pullup set, the default state is high. That’s how you had on your code above.
But you can also set input pulldown and trigger it with 3.3V.
In rare cases you leave it floating, in high impedance state.
Makes sense?

Yes thanks, that does make sense I will play with it now I understand that.

Just so you know your efforts that I appreciate were not wasted, it works! :slight_smile: