This was working fine until I updated to the latest HA. Had been holding off for a while due to incompatibilities with my code and deprecated functionality. I have some SNMP calls and it’s erroring out. So if I run an snmpget of the command I get:
iso.3.6.1.2.1.25.3.5.1.2.1 = Hex-STRING: 00
This is my sensor around this:
- platform: snmp
name: Canon MF8580CDW Status
host: <IP>
baseoid: 1.3.6.1.2.1.25.3.5.1.2.1
accept_errors: true
scan_interval: 1000
value_template: >-
{% if value|int(base=16) is equalto 0 %}
OK
{% else %}
Failed
{% endif %}
Below is the error I’m getting in the logs now:
2024-11-10 16:38:40.377 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.canon_mf8580cdw_status for domain sensor with platform snmp
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 599, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 918, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1367, in add_to_platform_finish
await self.async_added_to_hass()
File "/usr/src/homeassistant/homeassistant/components/snmp/sensor.py", line 203, in async_added_to_hass
await self.async_update()
File "/usr/src/homeassistant/homeassistant/components/snmp/sensor.py", line 214, in async_update
value = self._value_template.async_render_with_possible_json_value(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 806, in async_render_with_possible_json_value
render_result = _render_with_context(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2735, in _render_with_context
return template.render(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, 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 2373, in forgiving_int_filter
raise_no_default("int", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1911, in raise_no_default
raise ValueError(
ValueError: Template error: int got invalid input '^@' when rendering template '{% if value|int(base=16) is equalto 0 %}
OK
{% else %}
Failed
{% endif %}' but no default was specified
So if I’m reading right it’s saying the resulting value it gets is ‘^@’ which isn’t what I get when querying it myself on the HA box.
Thoughts?