Closed millesm closed 1 year ago
Thanks. Yup, it's not really an error, but me just passing through the value unchecked. Sometimes the api will return a "--", "" or a string, so it gets interesting.
I've already looked at fixing this for the next release.
This is now fixed in v3.0.3
I am seeing this same error on multiple entries in the log on start-up.
First occurred: 11:20:54 AM (898 occurrences)
One example below
Exception in message_received when handling msg on 'homeassistant/sensor/GoSungrow/GoSungrow-getPsDetail-904132-p83075/state': '{"value":""}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1710, in forgiving_float_filter return float(value) ValueError: could not convert string to float: '' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 44, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 302, in message_received _update_state(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 262, in _update_state payload = self._template(msg.payload, PayloadSentinel.DEFAULT) File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 246, in async_render_with_possible_json_value rendered_payload = self._value_template.async_render_with_possible_json_value( File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 589, in async_render_with_possible_json_value return _render_with_context(self.template, compiled, variables).strip() File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1942, in _render_with_context return template.render(kwargs) File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "", line 1, in top-level template code File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1713, in forgiving_float_filter raise_no_default("float", value) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1411, in raise_no_default raise ValueError( ValueError: Template error: float got invalid input '' when rendering template '{{ value_json.value | float }}' but no default was specified