Unsure if this is the method to reporting this, but I have started testing SNMP 2 and come across an issues setting the thing as a switch value. While the onvalue works great, the offvalue is failing as the full OID is a dynamic one and just disappears, the parent OID of .1.3.6.1.2.1.3.1.1.3.800.1 reports all of the IPs from the ARP table.
With SNMP v1.x I was able to create a map file as the result was Null and I mapped it to OFF; I donāt see a difference or know of a value I can map to the offvalue to have the switch work properly.
Open to thoughts or suggestions if anyone has any.
I do only have 1 thing defined, I listed both as different configurations I have tried so far to account for the OID not existing when the phone leaves the network. I used the OH doco to create what I have so far, when a phone is on the network it works as expected.
With the 1.x version of the SNMP binding requesting the OID .1.3.6.1.2.1.3.1.1.3.800.1.192.168.1.5 will return the IP address from the ARP table of the switch, when the ARP entry expires (as the phone has left) the OID is actually removed and a query will fail. With the way OH handled it was by returning a Null value, the new way is behaving differently and I am looking to find a way to have the āoffvalueā value change to OFF. I only discovered this problem as I was updating a topic I wrote on using SNMP as another method to determine phone presence.
Below is an example of how the parent OID of the ARP table looks like.
That is what I am trying to do with the new binding, as arping is not an option when OH and phones are in two different subnets.
So while the detection of the phone works as the OID exists, it is when the phone leaves that the binding doesnāt know what to do. It spams the log file and doesnāt change the value of the item.
I would call that a bad design but anyway, I could set the channel-value to UNDEF if no response is received. You can map that to whatever you want then.
It was probably set that way to avoid keeping static entries in the MIB tables for ping sweeps/arp scans as by default the ARP table clears entries 4 hours by default.
Providing a UNDEF would probably resolve the issue, if the OID is not found; but I am receiving a response from the switch of ānoSuchInstanceā. So Iām unsure if this is something that is easy to change on the channel?
Also was unsure if a āonValueā is specified, if you have to also define the āoffValueā? Was going to also try applying a map statement on the phone2 item line to see if that could change the outcome of the switch state.
Please try this version bundle:update <number> https://janessa.me/esh/org.openhab.binding.snmp-undef.jar. Exceptions (like the one above) now set the channel to UNDEF.
Youāll find a new configuration option (āadvancedā in PaperUI) ignoreException. If you set true here, your log will not be flooded.
Awesome @J-N-K!!! Iāll comment out config files and set things up through PaperUI and test things out tonight as I donāt have a phone on the WiFi currently.
For doco purposes, if this replicates what I have working with the 1.x version of the binding; how can I add the ignoreException to config file?
So testing has taken place, the On-Value works; turned off my wireless and waited 3 mins and the log spamming does occur, and the value in /rest/items/phone2 has a state of UNDEF.
I added UNDEF to the Off-Value and had the following log:
2019-08-15 21:36:55.909 [WARN ] [ding.snmp.internal.SnmpTargetHandler] - illegal value configuration for channel snmp:target:switch:phone2_thing
Also tried another round of testing with the config files setup, and the ignoreException=ātrueā does flip to on in PaperUI on the channel. I checked in /rest/things/snmp:target:switch and it has the following value:
"ignoreException":true
Checking /rest/things/snmp:target:switch2 reports the following:
"ignoreException":"true"
Item state doesnāt change from UNDEF when I have a thing file in use; would a debug log be helpful for anything?
Awesome as always @J-N-K!!! Iāll wipe out the PaperUI and config files when I get home tonight and do another round of testing and report back results.