Hi,
I need a bit of help to change the count_lights_on: sensor that I have in the sensor yaml, to make it compatible with the new changes.
- platform: template
sensors:
count_lights_on:
friendly_name: "All Lights"
unit_of_measurement: ''
value_template: >-
{{
states.light
| selectattr('state', 'eq', 'on')
| rejectattr('attributes.is_group', 'eq', true)
| rejectattr('entity_id', 'is_hidden_entity')
| rejectattr('attributes.entity_id', 'defined')
| rejectattr('object_id', 'search', 'air_quality')
| rejectattr('entity_id', 'in', ['light.led_occupancy_gpio_hallway', 'light.tagreader_led'])
| list
| count
}}
This still working, but I got a warning that I have to change it, otherwise will stop working.
I tried to replace it with
- platform: template
sensors:
count_lights_on:
friendly_name: "All Lights"
unit_of_measurement: ''
state: "{{ \n states.light\n | selectattr('state', 'eq', 'on')\n | rejectattr('attributes.is_group',
'eq', true)\n | rejectattr('entity_id', 'is_hidden_entity')\n | rejectattr('attributes.entity_id',
'defined')\n | rejectattr('object_id', 'search', 'air_quality')\n | rejectattr('entity_id',
'in', ['light.led_occupancy_gpio_hallway', 'light.tagreader_led']) \n | list\n
\ | count \n}}"
But I get a configuration error
Configuration warnings
Invalid config for ‘template’ from integration ‘sensor’ at sensor.yaml, line 71: required key ‘value_template’ not provided Invalid config for ‘template’ from integration ‘sensor’ at sensor.yaml, line 74: ‘state’ is an invalid option for ‘sensor.template’, check: sensors->count_lights_on->state