I’m trying to accomplish something with ESPHome and have run into a significant hurdle that I can’t seem to overcome. So, with apologies, I’m reaching out to this community for some basic help.
I want an ESPHome device that monitors a handful of HA sensors and appropriately represents their values using simple LEDs–like if the outside garage door is open, show a red LED, closed show a green LED. I can then use that device for a quick home safety check before bed.
While prototyping this device, I set up a Toggle Helper in HA and I’m trying to generate debug output on its value. However, the ESPHome device (mini-ESP32) doesn’t seem to track the value (or my code is whacked).
No matter the value of the toggle, the ESP debug output always reads:
[15:35:11][D][custom:064]: 3 sec heartbeat
[15:35:11][D][custom:068]: 0
Here’s the minimal YAML code I’m using, with the test_toggle helper in HA. Any hints would be greatly appreciated! (FWIW, using the latest HA and ESPHome)
substitutions:
name: esphome-web-13ab64
friendly_name: status-tracker-bedroom
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:
level: DEBUG
logs:
esp32_ble_tracker: DEBUG
# 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: {}
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: homeassistant
name: "Test Toggle"
entity_id: input_boolean.test_toggle
id: test_toggle
interval:
- interval: 3000ms
then:
# - switch.toggle: builtinLED
- lambda: |-
ESP_LOGD("custom", "3 sec heartbeat");
if (id(test_toggle).state) {
ESP_LOGD("custom", "1");
} else {
ESP_LOGD("custom", "0");
}