GPIO Binary Sensor lamba value

Hi team.

I have been using a Pi Pico to check a reed switch on my garage door.
All working fine until I upgraded my home internet and broke a bunch of configs. I thought I could just download my existing yaml file, flash the Pico with the new secret wifi info and carry on. However when compiling in esphome I now get errors.

code snippit is:

binary_sensor:
  - platform: gpio
    pin: 
      number: 16
      mode: 
        input: true
        pullup: true
    id: garage_door_sensor

  - platform: template
    name: "Garage Door Open"
    lambda: |-
      if (id(garage_door_sensor).state == True) {
        // Garage Door is open.
        return "Door is open";
      } else {
        // Garage Door is closed.
        return "Door is closed";
      }

The error I now get is:

Compiling .pioenvs/garage-door/src/main.cpp.o
/config/esphome/garage-door.yaml: In lambda function:
/config/esphome/garage-door.yaml:53:40: error: 'True' was not declared in this scope
   53 |       if (id(garage_door_sensor).state == True) {
      |                                        ^~~~
/config/esphome/garage-door.yaml:60:3: error: control reaches end of non-void function [-Werror=return-type]
cc1plus: some warnings being treated as errors
*** [.pioenvs/garage-door/src/main.cpp.o] Error 1
========================= [FAILED] Took 25.36 seconds =========================

Was there an update to a format where my “state == True” is no longer valid for the binary sensor?

What are these states?

Binary sensor template results can only be true (ON) or false (OFF).

You appear to want a template text sensor.

Also I think this may be case sensitive:

if (id(garage_door_sensor).state == true)

See: