SNMP unable to write to device but can read device

I just finished a install of openhabian on a pi3 I have mqtt showing the weather station and a few other things just fine. I have installed the SNMP addon and tried with and wo the port 162 redirection to get read/write to work on some apc pdu’s.

I have been able to get snmp to read the amp values of the devices so it is communication properly and if i use snmpset i can manually turn the device on and off. how ever openhab has no clue what to do with the switches. i have tried manual and thing file creation following the docs and both have the same result. all switches start in the off state and do not affect the device. I have also tried proto 1 and 2c no difference. Is there any suggestions as to how to trouble shoot this or whats going on?

Thing snmp:target:APC244E "APC244E" [ hostname="x.x.x.x", protocol="v1", community="private" ] {
Channels:
    Type string : apc244totalamps "Total Amps" [ oid="1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1", mode="READ" ]
    Type string : apc244bank1amps "Bank 1 Amps" [ oid="1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.2", mode="READ" ]
    Type string : apc244bank2amps "Bank 2 Amps" [ oid="1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.3", mode="READ" ]

    Type switch : apc244plug1 "Outlet 1" [ oid="1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.1", mode="READ_WRITE", datatype="INT32", onValue="1", offValue="2"]
    Type switch : apc244plug2 "Outlet 2" [ oid="1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.2", mode="READ_WRITE", datatype="INT32", onValue="1", offValue="2"]
    .....
    Type switch : apc244plug15 "Outlet 15" [ oid="1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.15", mode="READ_WRITE", datatype="INT32", onValue="1", offValue="2"]
    Type switch : apc244plug16 "Outlet 16" [ oid="1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.16", mode="READ_WRITE", datatype="INT32", onValue="1", offValue="2"]
}

The frontail logs and system logs dont show any thing usefull either.

2020-11-11 14:49:17.470 [vent.ItemStateChangedEvent] - snmp_target_APC242C_apc242totalamps changed from 0 to Null

2020-11-11 14:49:18.223 [vent.ItemStateChangedEvent] - snmp_target_APCPDU249_apc246totalamps changed from 11 to Null

2020-11-11 14:49:57.334 [ome.event.ItemCommandEvent] - Item 'snmp_target_APC243D_apc243plug11' received command ON

2020-11-11 14:49:57.414 [nt.ItemStatePredictedEvent] - snmp_target_APC243D_apc243plug11 predicted to become ON

2020-11-11 14:49:57.454 [vent.ItemStateChangedEvent] - snmp_target_APC243D_apc243plug11 changed from NULL to ON

2020-11-11 14:50:00.309 [ome.event.ItemCommandEvent] - Item 'snmp_target_APC243D_apc243plug12' received command ON

2020-11-11 14:50:00.348 [nt.ItemStatePredictedEvent] - snmp_target_APC243D_apc243plug12 predicted to become ON

2020-11-11 14:50:00.375 [ome.event.ItemCommandEvent] - Item 'snmp_target_APC243D_apc243plug13' received command ON

2020-11-11 14:50:00.422 [vent.ItemStateChangedEvent] - snmp_target_APC243D_apc243plug12 changed from NULL to ON

2020-11-11 14:50:00.425 [nt.ItemStatePredictedEvent] - snmp_target_APC243D_apc243plug13 predicted to become ON

2020-11-11 14:50:00.472 [vent.ItemStateChangedEvent] - snmp_target_APC243D_apc243plug13 changed from NULL to ON

2020-11-11 14:50:11.398 [vent.ItemStateChangedEvent] - snmp_target_APC243D_apc243plug4 changed from NULL to ON

2020-11-11 14:50:11.419 [vent.ItemStateChangedEvent] - snmp_target_APC245F_apc245plug16 changed from NULL to OFF

2020-11-11 14:50:17.304 [vent.ItemStateChangedEvent] - snmp_target_APC240A_apc240totalamps changed from 23 to 24

2020-11-11 14:50:17.430 [vent.ItemStateChangedEvent] - snmp_target_APC241B_apc241totalamps changed from 35 to 34

snmp has separate read & read-write community strings that are configured on the device itself. You likely chose a read community string.

I made sure it is write capable and tested that community using snmpset which allowed it to work. I had found 3 of the devices didn’t originally save the write setting when using snmpset and had to update the snmp settings on the devices again to get it to save correctly.

that was all done before I tried adding it to openhab.

1 Like

The OH2 binding never worked for me the OH3 binding worked out of the box with no issues. not sure what changed that made it just work.

The new OH vm is ubuntu 22.04 lts i believe the previous vm was ubuntu 18.04 or 16.04