Nemesis24
(Nemesis24)
1
I have got this error on startup:
TemplateError(‘TypeError: argument of type ‘NoneType’ is not iterable’)
with the following template
{{states.light
| selectattr('entity_id', 'in', state_attr('light.cuisine','entity_id'))
| selectattr('state', 'eq', 'on')
| list
| count
}}
What’s the way to not have this error please?
tx for answers
If you only want the entities in the light group, there’s no reason to start with the state objects of all light entities.
{{ state_attr('light.cuisine','entity_id')
| select('is_state', 'on')
| list
| count }}
If this is being used in a template sensor, you should assign an availability to avoid errors when the light group isn’t available at restart/reload.
Nemesis24
(Nemesis24)
3
good lesson
tx very much, all is ok now