How can i count total value with array entity?

Hello everyone,

I have about 5-10 device energy per room like this, I want create template to count power per room
image

Like: kitchen: 1,100w
Bedroom: 500w

Thank you

Hi anhnv,

Did you try this?

1 Like

thank for your reply. i don’t want save this to database. i just want see on template. but that integrate is correct

here’s a way you could do it in a template. if you labeled a set of entities 'your_label" then this would sum it.

{{ label_entities('your_label')| expand | map(attribute='state') | map('float')|
list | sum}}
1 Like

thank you so much. perfect. work like a charm

1 Like

glad it’s working for you.
btw… since you’re doing rooms, if you have them defined in areas, you could use area_entities instead of label_entities.

1 Like