#Helpers - sum even if one item unavailable?

1 messages · Page 1 of 1 (latest)

queen tree
#

I have a bunch of power plugs that send power usage to Home Assistant. I have a Helper in Home Assistant that sums all of those power plugs usage. Trouble is, of any plug is offline for any reason, then the helper records unknown, and I miss all of that data. Is there any better way to do this? Is it possible to have a helper that sums what it has instead of expecting all items? Should I do this a different way?

Thanks

pliant lintel
#

I thought that there was a way to tell it what to do with entities that don't have a numeric value, but you can do it in a template sensor:
{{['sensor.one', 'sensor.two']|select('has_value')|map('states')|map('float')|sum}}
or
{{['sensor.one', 'sensor.two']|map('states')|map('float', 0)|sum}}

scarlet bough
#

Sensor groups can do sum and ignore unavailable, but min_max can also do sum and does not have this feature.

#

Kinda confusing that there are two helpers that do this 😬

pliant lintel
#

ah, maybe that's what I remember

#

yeah, I also remember it being confusing

scarlet bough
#

Also for some reason it's part of options flow but not config flow

#

So when you set it up you can't see the option

#

and have to go back to it

pliant lintel
#

I also thought about that in the "combine sensors" helper, but couldn't find it in the options flow either

scarlet bough
#

combine sensors is min/max

pliant lintel
#

I tried a bunch of stuff and then fell back to the tried and true templates

#

they can do anything