Hi
I am trying to use a “local” binary sensor for controlling whether a device should go to deep sleep or not (together with some other logic)…
The sensor is defined like:
binary_sensor:
- platform: status
id: bleStatus
internal: on
name: BleScanCompleted
And during startup, I do:
esphome:
name: faucet-bathroom
platform: ESP32
board: nodemcu-32s
on_boot:
then:
- lambda: |-
id(bleStatus).publish_state(false);
ESP_LOGI("boot", " - Setting bleStatus to false");
- script.execute: consider_deep_sleep
Now, in the script, I have:
script:
- id: consider_deep_sleep
mode: queued
then:
- delay: 5s
- lambda: |-
if (id(bleStatus).state) {
ESP_LOGI("script", " - bleStatus is TRUE");
} else {
ESP_LOGI("script", " - bleStatus is FALSE");
}
But here the logging tells me, that the bleStatus is set to TRUE - even though I specify it top be set to false during boot?
Is the binary sensor initialized with some sort of value after the on_boot code has been run ?
Regards
/Brian