Missing binary_sensor Entries

I’m very new to tinkering with ESPHome and so far have just taken other configs from tutorials. I ran wiring to a few doors in my house to do reed sensors. So now I’m starting to mess with the ESPHome setup and my first attempt isn’t working out at all. I have the following config file on an ESP-WROOM-32 (DOIT ESP32 DevKit V1 Wi-Fi Development Board - Pinout Diagram & Arduino Reference - CIRCUITSTATE Electronics):

esphome:
  name: doorsensor
  friendly_name: Door Sensor

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "..."

ota:
  - platform: esphome
    password: "..."

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Door-Sensor Fallback Hotspot"
    password: "1gL8rM4Rf2oB"

captive_portal:
    
binary_sensor:
  - platform: gpio
    pin:
      number: 13
      mode:
        input: true
        pullup: true
        output: false
        open_drain: false
        pulldown: false
      inverted: false
    name: Office Door
    device_class: door

I’ve given it a static IP on my network and added it to the ESPHome integration, but all I see are diagnostics that it picked up from my Unifi integration:

I tried a few different setups of the pin block, but even if that’s wrong, I would expect to see a binary_sensor in HA named Office Door associated with this device. Am I missing something in my setup? Thanks!

I think this had to do with my IOT network setup. I turned on auto-discovery for my IOT VLAN and changed the wifi to this:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.99.141

where 141 is the IP I assigned on my router. Now I see the binary_sensor in HA and I can close the circuit and see the door open/close!

Glad it is working for you.

Networking is hard in general, when you start adding multiple networks (and VLANs, which are networks specifically for isolation) things are much less likely to just work.

If you have to use use_address it sounds like to me that you do NOT have MDNS configured correctly. Also, I generally do not use static ip addresses. When I do use them, I still use DHCP, but have reservation for the particular devices I want to ALWAYS have the same IP address. I have generally had routers that have DHCP allocators that do some “magic” to keep consistent IP addresses (as far back as over 20 years ago, pfSense was the exception. It is horrible for that.)

As long as you are happy with your setup, that is what really matters.

1 Like

I did both of those things at the same time I guess, so not a great test. I just removed that from the config. I’m still able to ping doorsensor.local from the Terminal add-on, so I think the mDNS change on my router was likely the correct fix.

Yes, if you have a VLAN you have to make sure MDNS can traverse it. How you do that varies with what router you have.