Hi just a quick question, wanted to created a seperate topic for this.
Is it possible to count the values of a certain sensor attribute?
so for instance I’ve got a rest sensor which gives me an output like
rows:
- keys:
- key1
clicks: 0
impressions: 4
ctr: 0
position: 85
- keys:
- key2
clicks: 0
impressions: 5
ctr: 0
position: 59
- keys:
- key3
clicks: 0
impressions: 1
ctr: 0
position: 59
I want to count the impressions, so in this example I expect the result 10.
But when I try to execute the following template in the template tester:
{{ state_attr('sensor.google_api', 'rows')
| selectattr('impressions') | list | count }}
it counts not the impressions but the amount of “keys” values. so in this example 3 ?!
I cant find such solution on the forum yet.