It’s on github, here: https://github.com/joeltamkin/smartthings-ups
It’s been a couple of years since I touched it, and I’m sure there are some issues. I may be able to help if you have questions. I don’t code for a living!
Where to start:
The python code needs to run on something on your LAN can that access the SNMP device. Comms are one-way, from your LAN to Smartthings. I never completed mechanisms to go the other way, so this is strictly monitoring.
snmp_json.py is the entry point for the agent.
devicedefs.py will need to be extended to define your SNMP device type. There are some tricks in there for dealing with dynamic tables and other SNMP-isms you may encounter. Also includes the ability to define helper/conversion functions because SNMP uses pretty arcane methods for encoding data sometimes.
-The key here is that the names defined will end up matching the names of data defined in your smartthings Groovy device code
you will need to edit the “devices.py” file. This is essentially the configuration of SNMP devices to be monitored, and references device types you defined in devicedefs.py
Unless you make changes to snmp_json.py, you will also need to create a “constants.py” file defining some variables:
STBASEURL = 'https://graph.api.smartthings.com/api/smartapps/installations’
STAPPGUID = '12345678-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
STAPPTOKEN = ‘12341234-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
DEFAULTPOLLDELAY = 30
DEFAULTALARMPOLLDELAY = 5
STBASEURL, STAPPGUID, STAPPTOKEN (you get these after creating the REST end point in smartthings by copying in the smart app code…there is a tutorial on this elsewhere in the forums. I think they changed the base url too…)
DEFAULTPOLLDELAY, DEFAULTALARMPOLLDELAY - these are the amount of time, in seconds, to wait between polls of the SNMP device for new data. When a point defined as an alarm is detected in the alarm state, you can speed up the polling to more aggressively collect data.
You will need to get the pysnmp package as well.
On the Smartthings side, there is a smartapp and a UPS device. The smartapp should work as-is, but you will need to modify the device code to match the attributes provided by your snmp-capable device.
Good luck, and let me know if you would like to contribute updates and additions.