SNMP switch fails

Hi, I’ve read the docs and various posts but everything I try doesn’t work. I can install the SNMP tools from CLI and then SNMP command works fine to the switch (enable/disable a port) but from the switch config in configuration.yaml the switch just reverts to it’s previous state with nothing in the logs ?

I’m relatively new to HA, but used it for a while, just new to heavy custom things in it.

What am I doing wrong, it’s driving me nuts. Below is my YAML

switch:

  • platform: snmp
    name: “Zyxel Sw P4 (Reo)”
    host: 192.168.1.2
    version: 2c
    community: DLpublic
    baseoid: 1.3.6.1.2.1.2.2.1.7.4
    payload_on: 1
    payload_off: 0

I’m kinda rusty on SNMP (and I have only used sensors for my cases) but when I go down the oid tree, the oid you are using seems to be:

          ifAdminStatus OBJECT-TYPE
              SYNTAX  INTEGER {
                          up(1),       -- ready to pass packets
                          down(2),
                          testing(3)   -- in some test mode
                      }
              ACCESS  read-write
              STATUS  mandatory
              DESCRIPTION
                      "The desired state of the interface.  The
                      testing(3) state indicates that no operational
                      packets can be passed."
              ::= { ifEntry 7 }

So about the only thing that looks a tiny bit off is the “down”/“off” value of 2 instead of 0.

If that doesn’t help, then the only other possible thing I see is there is a config parameter for vartype, so maybe set it to INTEGER?

1 Like

@wmaker - you absolute legend. You’re right, stupid mistake, I was sending 0 not 2 ! Thankyou!

Thanks for the kind words! Glad to help :slight_smile: