unpoller / unifi

Go Library (w/ structures) to grab data from a Ubitquiti UniFi Controller
https://golift.io/discord
MIT License
114 stars 22 forks source link

Add all Device Manager methods, original: Add ability to power cycle USW port #45

Closed davidnewhall closed 3 years ago

davidnewhall commented 3 years ago

Adds a port power cycle method to USW struct. Closes #43.

Quick use:

u, _ := unifi.NewUnifi(config)
switches, _ := u.GetUSWs("default") // default site.

// Power cycle port 3 on the first switch (or only switch).
// You should do error checking above, and you should 
// probably loop `switches` to check the name or MAC
// and make sure you have the right one.
// `switches` may be nil when err is nil.
err := switches[0].PowerCycle(3)

I went ahead and added all the other devmgr methods too. y knot