I’m working on a battery powered sensor project and I am using an ESP32 board with an integrated 18650 battery (ESP-Wroom-ESP32).
I have a simple YAML that connects and then tries to use the homeassistant API to get the status of a boolean helper. The board I’m working with flashes nicely and gets a connection to homeassistant, but it can’t seem to get the status of the sensor.
The strange thing is if I flash the same YAML to a different board (in this case an esp32-c3-devkitm-1) board, it works perfectly. This makes me think that it is not the YAML, but something else.
Everything compiles and both boards connect and can expose ESPHome sensors, but only the C3 board can get the helper status.
Any ideas why this may be happening?
esphome:
name: test-device
friendly_name: Test Device
project:
name: esphome.web
version: dev
on_boot:
priority: -100
then:
- delay: 1s # Wait for stability
- wait_until:
wifi.connected:
- delay: 125s # Give Home Assistant time to send states
- homeassistant.service:
service: homeassistant.update_entity
data:
entity_id: input_boolean.esp_prevent_sleep
- delay: 3s
esp32:
board: wemosbat
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: "xxxx"
mqtt:
id: mqtt_cli
broker: 192.168.1.253
port: 1883
clean_session: true
username: !secret mqtt_usr
password: !secret mqtt_pwd
ota:
- platform: esphome
password: "xxxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
esp32_ble:
enable_on_boot: false
binary_sensor:
- platform: homeassistant
id: stopSleep
internal: true
publish_initial_state: true
entity_id: input_boolean.esp_prevent_sleep
name: "Prevent Sleep"
on_state:
then:
- logger.log:
format: "stopSleep state changed to: %s"
args: [ 'id(stopSleep).state ? "ON" : "OFF"' ]
captive_portal: