A simple Python wrapper for the TP-Link Omada Software Controller API.
Currently this is just the bare-minimum required to log in, get site settings, push site settings, and log out.
``` from omada import Omada
omada = Omada('omada.cfg')
omada.login()
settings = omada.getSiteSettings()
settings['led']['enable'] = False
omada.setSiteSettings(settings)
omada.logout() ```
I use this in a cron schedule to turn my site LED setting off at night and back on in the morning.
Turn the LED on:
$ python led.py on
led: on
Turn the LED off:
$ python led.py off
led: off
These are simple apps to display similar output to the "Clients" and "Devices" page on the web interface.
$ python clients.py
USERNAME IP ADDRESS STATUS
00-11-22-33-44-55 192.168.1.123 CONNECTED
...
Make sure you have your Settings file configured correctly for these to work.
You can store your controller settings in a configuration file to avoid hard-coding them in your scripts.
Currently supported settings:
baseurl
- the base url to the controllersite
- the name of the site in the controller (usually Default
)verify
- set this to False
to ignore self-signed certificate errorswarnings
- set this to False
to hide urllib3 warnings when verify=False
verbose
- set this to True
to force low-level reqeusts to output debugging infousername
- the username to log in aspassword
- the password for the user[omada]
baseurl = https://omadacontroller.local:8043
site = Default
verify = False
username = apiuser
password = secretpassword
For my wife, who asked that I turn off the device LEDs at night. :heart:
I was looking for a way to automate uploading new SSL certificates to my controller and found your API. I've been successfully using this code to update my SSL certificates on my controller, so I figured I'd contribute back what I added.
In addition to #8 it would be nice to have tags as well. This would enable distributions who want to run your tests to fetch the package from GitHub instead of PyPI.
Thanks
Hi. Any change you'd be willing to publish this to as a PyPI package?