Templates defined in configation.yaml stopped working

I’m not certain how long this has been going on, but I believe for a while. I am noticing that sensors I am defining in configuration.yaml have stopped getting defined (or working)

I have the following in configuration.yaml:

template:

  - binary_sensor:
    - name: dusk-to-dawn
      unique_id: custom_dusk_to_dawn
      state: "{{ iif(is_state('binary_sensor.home_sun_dawn_to_dusk', 'on'), 'off', 'on') }}"
    
    - name: someone-is-home
      unique_id: custom_someone_is_home
      state: "{{ iif(is_state('zone.home', '0'), 'off', 'on') }}"

  - sensor:
    - name: dishwasher-end-time
      unique_id: custom_dishwasher_end_time
      state: "{{ as_timestamp(states('sensor.104100531352000355_bsh_common_option_remainingprogramtime')) | timestamp_custom('%I:%M %p') }}"

    - name: dishwasher-running
      unique_id: dishwasher_running
      state: "{{ iif(is_state('sensor.104100531352000355_bsh_common_status_operationstate', 'BSH.Common.EnumType.OperationState.Run'), 'running', 'stopped') }}"

I am running on the following version of HA:

  • Core2024.11.3
  • Supervisor2024.11.4
  • Operating System13.2
  • Frontend20241106.2

All of these were defined for a while and were working (the first couple for more than a year), then today when defining new sensors, I found they weren’t getting defined, then found my old ones stopped working as well.

I know the syntax of defining templates changed a few releases ago. Possibly these stopped working since then, and I just didn’t notice.

Any suggestions?

Thanks

Hi smarthome01824,

Well they look ok to me, and they are the current format.
Any errors about templates in the logs?
Do you have multiple template: keys in the configuration.yaml? (A common problem)

So sorry.

After looking over and over things, I determined the sensors were defined properly, but I was accessing them improperly.

Thanks for the quick response.