EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

onvif_srvd started' when rendering template `{{ ((value|int)/(700/100))|round }}` but no default was specified #1885

Open TheZoker opened 11 months ago

TheZoker commented 11 months ago

Description

Since some version of Home Assistant I get the mentioned issue.

What did you do to debug the issue

Restart camera, restart HA, restart MQTT broker

Evidence

2023-12-28 02:05:41.628 ERROR (MainThread) [homeassistant.util.logging] Exception in position_message_received when handling msg on 'myhome/Dafang/motors/horizontal': 'Stopping onvif_srvd...
onvif_srvd stopped
0
Starting onvif_srvd...
onvif_srvd started'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 43, in wrapper
    msg_callback(msg)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 537, in wrapper
    msg_callback(msg)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/cover.py", line 439, in position_message_received
    payload: ReceivePayloadType = self._get_position_template(msg.payload)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 258, in async_render_with_possible_json_value
    raise exc
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 246, in async_render_with_possible_json_value
    self._value_template.async_render_with_possible_json_value(
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 746, 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 2305, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2003, in forgiving_int_filter
    raise_no_default("int", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1625, in raise_no_default
    raise ValueError(
ValueError: Template error: int got invalid input 'Stopping onvif_srvd...
onvif_srvd stopped
0
Starting onvif_srvd...
onvif_srvd started' when rendering template '{{ ((value|int)/(2600/100))|round }}' but no default was specified
2023-12-28 02:05:41.611 ERROR (MainThread) [homeassistant.components.mqtt.models] ValueError: Template error: int got invalid input 'Stopping onvif_srvd...
onvif_srvd stopped
0
Starting onvif_srvd...
onvif_srvd started' when rendering template '{{ ((value|int)/(2600/100))|round }}' but no default was specified rendering template for entity 'cover.dafang_move_left_right', template: '{{ ((value|int)/(2600/100))|round }}'

Contribute Back

If your issue was resolved, please consider contributing back to the project by creating a pull request to improve the code or documentation in order to avoid that this issue arises again for other people.