I have a value template that seems to be causing me some problems when one of the sensors is ‘unknown’.
value_template: '{{ ((states("sensor.torana_available_charging_current")|float + states("sensor.torana_tesla_watts")|float)/(states("sensor.grid_voltage")|float) - 2|float)|round(0) }}'
I know that sensor.torana_tesla_watts is going to be unknown when it isn’t powered on so how do effectively treat this? I expect somehow I need to tell the value_template that when unknown make it zero or another way. What is the best way to do this?
I notice this within home_assistant.log
2021-11-20 09:40:17 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'float' got invalid input 'unknown' when rendering template '{{ ((states("sensor.torana_available_charging_current")|float + states("sensor.torana_tesla_watts")|float)/(states("sensor.grid_voltage")|float) - 2|float)|round(0) }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1