Hey everyone,
I have created a system generated group that rounds up all the power consumption sensors of my house.
This script runs on startup.
Next step, i want to expand the group, add them up and substract them from the total consumption of my house, in order to see what’s unaccounted for.
The code works well so far, but i’m getting tens of thousands of warnings on the log.
Template warning: 'float' got invalid input 'unavailable' when rendering template...
I suspect this is because while expanding the group, the floats that get added up do not have a (default =…) value or a (0) after them.
Here is my code:
sensor:
- platform: template
sensors:
paleo_rest_of_the_house_power:
friendly_name: Rest of the house power consumption
unit_of_measurement: W
icon_template: mdi:flash
value_template: >-
{% if is_state('binary_sensor.power_usage_745989_available', 'on') %} #this checks if my efergy home measurement sensor is online
{{(states('sensor.power_usage_745989')|float(0) - expand('group.all_sensors_home_power') |map(attribute='state')|map('float')|sum)|round(2)}}
{% else %}
Unavailable
{% endif %}
What can i do to get rid of the warnings?
Maybe somehow only sum up the sensors that are positive, or available will solve it? (also how would i do that?)
Thank you in advance