I am learning ESP Home using a Wemos D1 Mini. I have a button between D1 (GPIO5) and ground. Here is the YAML file:
esphome:
name: wemos_test
platform: ESP8266
board: d1_mini
wifi:
ssid: "Kaywinnet"
password: "806194xxxx"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wemos Test Fallback Hotspot"
password: "Oi136ZHGIzON"
captive_portal:
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
ota:
safe_mode: True
# Switch on D1, GPIO5
switch:
- platform: gpio
name: "Wemos_Switch"
pin:
number: D1
inverted: False
mode: INPUT_PULLUP
The log shows the pin D1 (GPIO5) as an input:
INFO Reading configuration /config/esphome/wemos_test.yaml...
INFO Starting log output from wemos_test.local using esphome API
INFO Connecting to wemos_test.local:6053 (192.168.1.59)
INFO Successfully connected to wemos_test.local
[16:05:11][I][app:105]: ESPHome version 1.16.2 compiled on Mar 11 2021, 15:55:25
[16:05:11][C][wifi:443]: WiFi:
[16:05:11][C][wifi:303]: SSID: [redacted]
[16:05:11][C][wifi:304]: IP Address: 192.168.1.59
[16:05:11][C][wifi:306]: BSSID: [redacted]
[16:05:11][C][wifi:307]: Hostname: 'wemos_test'
[16:05:11][C][wifi:311]: Signal strength: -65 dB ▂▄▆█
[16:05:11][C][wifi:315]: Channel: 6
[16:05:11][C][wifi:316]: Subnet: 255.255.255.0
[16:05:11][C][wifi:317]: Gateway: 192.168.1.1
[16:05:11][C][wifi:318]: DNS1: 192.168.1.1
[16:05:11][C][wifi:319]: DNS2: (IP unset)
[16:05:11][C][switch.gpio:042]: GPIO Switch 'Wemos_Switch'
[16:05:11][C][switch.gpio:043]: Pin: GPIO5 (Mode: INPUT_PULLUP)
[16:05:11][C][switch.gpio:059]: Restore Mode: Restore (Defaults to OFF)
[16:05:11][C][logger:185]: Logger:
[16:05:11][C][logger:186]: Level: DEBUG
[16:05:11][C][logger:187]: Log Baud Rate: 115200
[16:05:11][C][logger:188]: Hardware UART: UART0
[16:05:11][C][captive_portal:169]: Captive Portal:
[16:05:11][C][ota:029]: Over-The-Air Updates:
[16:05:11][C][ota:030]: Address: wemos_test.local:8266
[16:05:11][C][api:095]: API Server:
[16:05:11][C][api:096]: Address: wemos_test.local:6053
When I ground D1, I see no state change. What did I do wrong?