I have a few template sensors (under templates.yaml), which count the amount of lights that are on and climate devices that are on.
They work fine (they give the amount I’m looking for), but I get the following syntax error when reloading my templates. I really can’t figure it out why. Any help is much appreciated. I’m sure it’s something silly I’m overlooking. I tried giving them the device_class ‘enum’, but that didn’t change anything.
The entity definition format under template: differs from the platform configuration format. See https://www.home-assistant.io/integrations/template#configuration-for-trigger-based-template-sensors
The sensors are defined as such:
templates:
- sensors:
hoeveel_lampen_aan:
friendly_name: "Aantal lampen die nu aan staan"
unit_of_measurement: 'on'
value_template: "{{ states.light | selectattr('state', 'eq', 'on') | rejectattr('attributes.is_deconz_group', 'eq', false) | list | count }}"
- sensors:
hoeveel_radiatoren_aan:
friendly_name: "Aantal radiatoren die nu aan staan"
unit_of_measurement: 'on'
value_template: "{{ states.climate | selectattr('attributes.supported_features', 'eq', 1) | rejectattr('attributes.hvac_action', 'eq', 'idle') | list | count }}"