I´m a zero coder so I have no clue how I can achieve my request.
I want to count all power sockets which are ON and have a special entitiy_id containing “switch.steckdose_”.
All my power plugs are named with the same schema steckdose_ so I believe thats the only way to sort it out.
For my lights I found something to count all lights, which are not groups - but I have no idea how the syntax is working or at least how I can get out from developer tools the infos I need:
{{ states.light | selectattr(‘state’,‘eq’,‘on’) | rejectattr(‘attributes.entity_id’, ‘defined’) | list|count }}
Switches are just more of the same. What you put after the type is not relevant to the template as written.
what this does is:
states.light → gives you all the light states
| filter (or pipe) to select the state that is on
| filter to reject define
| filter to list (make a list of the values)
| filter to count them
Thank you very much, this is working… I also know why my was never working
I used the entity_id name same like the entitiy_name but ID is all in small letters