ValueError: Template error: float got invalid input 'None' when rendering template '{{ state_attr('climate.trv_bathroom','current_temperature') | float}}' but no default was specified
I understand the general issue with it and it appears to be fixable by changing the template code to something like:
What this does is setting the default value of the current_temperature attribute to 18 instead of ‘None’. But in that case, where the value should be the current_temperature my provided default value would almost always be wrong. Either to hot or to cold.
Is there a better way to handle that kind of situation? I mean, why is the attribute ‘None’ in the first place? Can the root cause be fixed somehow?
But since than, the graphs are at “1” and not at the regular celsios number. I assume the reason is, that “is_numer” → true is convertet to “1”.
I would like to avoind the warnings in the logfile, as I know that the devices are WLAN, and sometimes loose a connect, which I don’t care, as it “happens” with WLAN.
but still it detects only “0/1”. So it seems I have to live with the errors in the log. I do not understand, why I cannot “say” somewhere: This device, is “flaky”, so don’t write a log, if you cannot read the sensors of this device, but please write throw an error, if on this device I do want to change something, and it is “gone”, but before “try” 5 times on your own.
As this device has 5 sensor data I think, this would make configuration easier. Anything to read, why this is done different, and what I did not get?
Hi Petro; I am trying to clear up my log errors, I can’t seem to crack this one. I have implemented a number of power sensors per room which add the current power, total power and yesterdays power, I have implemented the “is_number” as a condition and it seems to look okay using the development module however I still get an error. The error seems to indicate that one of the sensors is unavailable, however, when I past the sensor template into the development module I receive the value expected? Any help would be most appreciated.
as a sample the error is :
TemplateError(‘ValueError: Template error: float got invalid input ‘unavailable’ when rendering template ‘{{ (states(‘sensor.pool_blower_energy_yesterday’)|float + states(‘sensor.pool_light_energy_yesterday’)|float + states(‘sensor.pool_pump_energy_yesterday’)|float)|round(3) }}’ but no default was specified’) while processing template ‘Template<template=({{ (states(‘sensor.pool_blower_energy_yesterday’)|float + states(‘sensor.pool_light_energy_yesterday’)|float + states(‘sensor.pool_pump_energy_yesterday’)|float)|round(3) }}) renders=94>’ for attribute ‘_attr_native_value’ in entity ‘sensor.pool_energy_total_yesterday’
The template is: