I use ESPHome for many small sensor around the house, by in large it work great. However, I have struggled to get ESPHome to turn on/off a single cathode LED. I’ve tried nearly every pin on the D1 Wemos Mini and every conceivable configuration on ESPHome. I welcome any feedback or guidance.
esphome:
name: bedroom_sensor
platform: ESP8266
board: d1_mini
packages:
wifi: !include wifi.yaml
i2c:
sda: GPIO4
scl: GPIO5
scan: True
sensor:
- platform: adc
pin: A0
name: "Bedroom Ambient Light"
update_interval: 120s
- platform: htu21d
temperature:
name: "Bedroom Temperature"
id: htu21d_temp
filters:
- lambda: return x * (9.0/5.0) + 32.0;
- offset: -2.0
unit_of_measurement: "°F"
humidity:
name: "Bedroom Humidity"
id: htu21d_humidity
update_interval: 120s
- platform: sgp30
eco2:
name: "Bedroom eCO2"
accuracy_decimals: 1
tvoc:
name: "Bedroom TVOC"
accuracy_decimals: 1
update_interval: 120s
compensation:
temperature_source: htu21d_temp
humidity_source: htu21d_humidity
- platform: wifi_signal
name: "Bedroom Sensor WiFi Signal"
update_interval: 120s
binary_sensor:
- platform: gpio
pin: GPIO12
name: "PIR Sensor"
device_class: motion
on_press:
then:
- light.turn_on: single_led
on_release:
then:
- light.turn_off: single_led
- platform: status
name: "Bedroom Sensor Status"
text_sensor:
- platform: wifi_info
ip_address:
name: Bedroom Sensor IP Address
ssid:
name: Bedroom Sensor SSID
mac_address:
name: Bedroom Sensor Mac Wifi Address
light:
- platform: binary
name: "LED"
output: gpio_led
id: single_led
output:
- platform: gpio
pin: GPIO16
id: gpio_led
status_led:
pin:
number: D4
inverted: True
switch:
- platform: restart
name: "Bedroom Sensor Restart"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret esp_ota
The ESPHome logs show the PIR sensor is toggling and changing the LED, but no light.
[08:56:30][D][binary_sensor:036]: 'PIR Sensor': Sending state ON
[08:56:30][D][light:265]: 'LED' Setting:
[08:56:30][D][light:274]: State: ON
[08:56:33][D][binary_sensor:036]: 'PIR Sensor': Sending state OFF
[08:56:33][D][light:265]: 'LED' Setting:
[08:56:33][D][light:274]: State: OFF