Hi all,
Since version 0.94 I’m getting warnings and errors in the log files, the sensors do work by the way.
I suspect that the warnings and error are because of the state not being populated (None/unknown), but I’ve tried numerous options. The warning in the frontend is:
Could not render template Temperatuur Woonkamer, the state is unknown.
The warning in homeassistant.log is the same, but the errors in the docker/portainer log are different:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 375, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/components/template/sensor.py", line 191, in async_update
self._state = self._template.async_render()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 191, in async_render
return self._compiled.render(kwargs).strip()
File "/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
TypeError: unsupported operand type(s) for +: 'float' and 'str'
I’ve tried these config variations:
{{
not is_state('sensor.eurotronic_eur_spiritz_wall_radiator_thermostat_temperature', 'unknown') and
( states('sensor.eurotronic_eur_spiritz_wall_radiator_thermostat_temperature') | float
+ states('sensor.temperature_22') | float
) / 2 | round(2)
}}
{% if states('sensor.temperature_22') %}
{{ ( states('sensor.eurotronic_eur_spiritz_wall_radiator_thermostat_temperature') | float
+ states('sensor.temperature_22') | float
) / 2 | round(2)
}}
{% endif %}
{{
( (float(states.sensor.eurotronic_eur_spiritz_wall_radiator_thermostat_temperature.state)
+ float(states.sensor.temperature_22.state)
) / 2) | round(2)
}}
What am I missing here?