How to translate snmp value with value_template

I have a result that comes in from SNMP

iso.3.6.1.2.1.25.3.5.1.2.1 = Hex-STRING: 00

with platform: snmp

When I try:

value_template: “{%if value == ‘0’ %}OK{% else %}Failed{% endif %}”

or

value_template: “{%if value == ‘00’ %}OK{% else %}Failed{% endif %}”

It returns Failed any idea what I’m doing wrong?

Your syntax is a bit off. Here is one I use:

- platform: snmp

  name: 'Battery Status'

  host: 192.168.30.151

  baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.4.0

  community: 'public'

  version: '2c'

  scan_interval: 60

  value_template: >-

    {%- if 1 -%}

      OK

    {%- elif 2 -%}

      Replace

    {%- else -%}

      N/A

    {%- endif -%}

I was having a problem with the value_template as the return value of 00 was hex and wasn’t showing up in results. I did this that seems to work but not sure if it’s the right way.

value_template: "{%if value|int(base=16) == 0 %}OK{% else %}Failed{% endif %}"

Also what does the “>-” do with the value_template? Always see that but never know what it’s doing.

Thanks.

Also posted this new, but looks like SNMP or a number of sensors based on, may have blown up my system.