Hello,
I still have some problem to understand the ESPHome language:
I have the following code :
# Les switchs et boutons
binary_sensor:
- platform: gpio
pin:
number: D3
mode: INPUT_PULLUP
name: "door_state"
id: door_state
on_state:
- if:
condition: binary_sensor.is_on
then:
- lambda: id(door_state).text_state("Door is closed")
else:
- lambda: |-
id(door_state).text_state("Door is open")
# L'affichage sur le LCD2004
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
id: my_display
update_interval: 1s
lambda: |-
it.print("Page 1");
it.printf(0, 1, id(door_state).text_state.c_str());
it.strftime(0, 2, "%H:%M:%S", id(my_time).now())
Why do I get the following error message:
INFO ESPHome 2023.6.3
INFO Reading configuration /config/esphome/garagetoor.yaml...
INFO Detected timezone 'Europe/Zurich'
Failed config
binary_sensor.gpio: [source /config/esphome/garagetoor.yaml:45]
platform: gpio
pin:
number: D3
mode: INPUT_PULLUP
name: door_state
id: door_state
on_state:
- if:
'id' is a required option for [binary_sensor.is_on].
condition: binary_sensor.is_on
then:
- lambda: id(door_state).text_state("Door is closed")
else:
- lambda: id(door_state).text_state("Door is open")