For example, at: if actions (and throughout the Docs but without explanation), I see this:
I am guessing that the three dots (…) are a place holder for something. Like on_boot: or on_shutdown:?
Where will I find a list of these “somethings”? And when I find this list, what will be the “on_…:” event that will allow me to do this:
output:
platform: gpio
pin: GPIO2 #The only led I've got
id: blue_led
binary_sensor:
- platform: homeassistant
id: prevent_deep_sleep
entity_id: input_boolean.prevent_deep_sleep
on_...: #What goes here????
then:
- if:
condition:
binary_sensor.is_on: prevent_deep_sleep
then:
- output.turn_on: blue_led
- logger.log: "Sleep Flag is: ON"
else:
- if:
condition:
binary_sensor.is_off: prevent_deep_sleep
then:
- output.turn_off: blue_led
- logger.log: "Sleep Flag is: OFF"
So, my next question: Is a “binary_sensor” a "component?
Then, if that is correct, and my binary_sensor component is “pulling” a variable from the Home Assistant server, the only valid condition (in my case) seems to be on_state: which I infer as “a change of state on-to-off or off-to-on”. Okay so far?
But using the following, I am unable to test if the binary_sensor is ON or OFF.
binary_sensor:
- platform: homeassistant
id: prevent_deep_sleep
entity_id: input_boolean.prevent_deep_sleep
on_state:
then:
if:
condition:
binary_sensor.is_on: prevent_deep_sleep
then: ##### Errors here - Mapping values are not allowed here #####
- logger.log: "Sleep Flag is: ON"
condition:
binary_sensor.is_off: prevent_deep_sleep
then:
- logger.log: "Sleep Flag is: OFF"
The way your trying to do it is if the binary sensor was created in the same esphome yaml. Since it’s a HA sensor, you need to use a lambda. Binary Sensor Component — ESPHome