Wishlist: en/disable POE on a switch port, en/disable an AP

Posted on
Sun May 13, 2018 2:57 am
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Wishlist: en/disable POE on a switch port, en/disable an AP

I added a UniFi Mesh to my UniFi setup yesterday. It's located in the garden to enhance the WiFi when we are there.
When we are not in the garden, this access point doesn't need to be running.
Indigo already knows when we are in the garden, so I would like to use this plugin to do the following:

When Indigo detects we are in the garden:
- enable POE on the switch port where the AP is connected
- enable the Acces Point (Access Point > Config > Disable this device)

When Indigo detects we are no longer in the garden:
- disable the Access Point
- disable POE on the switch port

The reason that I'm also asking to en/disable the access point is because it will prevent the dashboard from turning red in the WLAN section.

Could it be possible to add this to the plugin?

"I tawt I taw a puddy tat!" Tweety

Posted on
Sun May 13, 2018 6:53 am
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

There is an action to power cycle a port
I can check if it can do off an on

The other is a bit more involved.
“Suspend” for the UniFi system device would be a larger change.

But will check.




Sent from my iPhone using Tapatalk

Posted on
Sun May 13, 2018 11:02 am
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

here we go-- try this one :https://www.dropbox.com/s/rs2cp1um7h8vq3y/uniFiAP-v-7.15.105.zip?dl=1

it has
- unifi system device suspend / re-activate action and menu.
When suspended the plugin will just not do anything with that device beside setting the status to "poweroffsymbol susp date"
Screen Shot 2018-05-13 at 11.56.53.png
Screen Shot 2018-05-13 at 11.56.53.png (14.62 KiB) Viewed 481 times
Screen Shot 2018-05-13 at 11.58.34.png
Screen Shot 2018-05-13 at 11.58.34.png (13.66 KiB) Viewed 481 times

any suspend setting will be reset to normal / action when the plugin restarts for any reason.

- switch POE: ON/off/cycle menu and action. select the action IN the menu item / action setting
Screen Shot 2018-05-13 at 12.01.54.png
Screen Shot 2018-05-13 at 12.01.54.png (36.67 KiB) Viewed 481 times

if it works for you I will post on git / indigo store

Karl

Posted on
Sun May 13, 2018 1:31 pm
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Wishlist: en/disable POE on a switch port, en/disable an

Cool!
Thanks for the quick fix.

Installed it while the POE was Off and the Access Point was disabled.

Noticed that the Indigo log was being filled with repeated log messages about not being able to connect to the AP.

Tried to set POE on via the Plugin menu.
Selected action ON and the switch where the AP is connected to.
Tried to select the port, but the port didn't show up in the list.

Reloaded the plugin and tried again.
Same result: port not visible in the list.


Next I tried to re-active the access point.
I could select it in the list and pressed execute.
But no result in the controller.


Tried to PowerCycle the switch port, but no luck.
The port was still not visible in the "select which port" list.


Used the UniFi controller to enable the AP and power on the switch port.
Waited for the AP to up-and-running in the dashboard.
At the same time the UniFi plugin stopped the error messages about the AP being down.


After that I tried to turn the POE off.
This time I was able to see and select the port I needed.

Got this error in the log after that:
uniFiAP in Line '2365' has error='Python argument types in
DeviceList.iter(DeviceList, unicode, str)
did not match C++ signature:
iter(TCList_onDemandClient<CDeviceWrapper>, CCString filter='')'

Followed by fatal errors because the access point was down.
So that works!


Suspended the AP but no effect:
uniFiAP suspending Unifi system device AP_00:00:00:00:00:00 1.2.3.4
testConnection

That is: I expected the AP to show up in the controller as being disabled.
The error messages about the AP however stopped in the Indigo log.


Tried to enable the POE back on via the plugin.
No luck. The port is not visible in the menu.
Then I realized there is a second way to select a port, via de UniFi-Client.
That list showed the AP connect to the switch.
That worked and the AP was active again.

In Indigo it was still marked as "susp", so I reactivated the AP.
That worked also.


In it's current form this is usable for me.
Thanks very much for delivering so fast.

"I tawt I taw a puddy tat!" Tweety

Posted on
Sun May 13, 2018 3:24 pm
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

https://www.dropbox.com/s/3vs2td72dqfbzs0/uniFiAP-v-7.15.106.zip?dl=1
with the following changes:

1. in the previous version only the ports that had an active "client" connected showed poe -0/1/p for off/on/ passthrough, now added: peoX = peo available, not used
Hence it will also show up in the selection box to switch on/off like this: (added empty)
Screen Shot 2018-05-13 at 15.56.24.png
Screen Shot 2018-05-13 at 15.56.24.png (16.05 KiB) Viewed 435 times


That should settle this
Tried to set POE on via the Plugin menu.
Selected action ON and the switch where the AP is connected to.
Tried to select the port, but the port didn't show up in the list.


2. when you switch off an AP please FIRST do suspend, then do a power off and when back: power on, wait 30 secs and then reactivate. Otherwise it will complain that it is not connected, but it will just complain and will set the AP device to expired eventually.

3. fixed the bug "uniFiAP in Line '2365' has error='Python argument types in" was a typo: >>>xxx,"+props.abc.." <<< should have been >>>xxx+",props.abc.."<<<

4. fixed an issue with device/state "essid". The JSON send back had some other "vap_ table" entries for potential wireless to wireless up/downlink when the cable is not connected.It now picks the right "vap_table" entry.


and thanks for testing

Karl

Posted on
Mon May 14, 2018 10:56 am
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Wishlist: en/disable POE on a switch port, en/disable an

Tried the new plugin.

I do so the "emtpy" items and I can use that part of the menu to turn the AP back on.
One thing I did notice: when I use the plugin to switch off a POE port, the POE status in the UniFi controller goes to PoE.
I expected it to go to Off. Turning the power back on using the plugin changes the status back to the actual power being used.

I've changed my action groups to the order of events that you described.

What's the real use for suspending/activating? Is it to prevent the Indigo log from showing errors about devices that can't be found?
Because I first hoped it would really disable the device in the UniFi controller. Which it doesn't seem to do.
Not a big deal, as that was the bonus feature. ;-)


Thanks to your changes I've been able to do the following:

When the door to the garden opens, I start a timer.
After 5 minutes, I check if the door is still open.
If it's closed, where not going to stay in the garden. No action required.
If the door is still open, fire up the access point!

When the door to the garden closes, an action group is fired that shuts the access point down with a 15 minute delay.
If the door opens again within these 15 minutes, the delay is canceled.
That is to prevent the access point from being shutdown to often.

"I tawt I taw a puddy tat!" Tweety

Posted on
Mon May 14, 2018 2:55 pm
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

tried the following:

1. switch #2 - port 5 set POE off ==> unifi controller shows off
2. switch # 2- port 5 set POE ON ==> unifi controller shows PoE (takes a minute)
thats how it should be..
when you do on/off, the controller pages takes some time to update, if you do the off/on to quickly you might see the previous state.

As for suspend: the plugin just ignores everything for that devices and sets the icon to powerOff and "susp". I thought thats what you wanted.

I can check if I can run off a unifi device, ie to standby but have not seen that

Karl
ps I published a release version on github/ indigo store. please use those. In case there are issues I need to know error messages and line numbers and they change with versions

Posted on
Mon May 14, 2018 8:35 pm
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

disable / enable unifi AP device is working, need to make it pretty
you should have it tomorrow

options will be: command / settings options:

unifi system devices:
1. switch PoE ports on/off/powercycle (eater through twitch#, port # or selecting the unifi client)
2. suspend a unifi system device: it will make the plugin ignore any message, status changes from the unifi system device, will set status to “susp”
3. disable / enable unifi AP. Will do same as in controller /Config/managedevice/disable-enable, will also set the indigo device to suspended
4. reboot a unifi device
5. set LEDs on AP devices on/off/blink

for clients:
1. block / unblock access for a regular device / client
2. reconnect a wifi client

Karl

Posted on
Mon May 14, 2018 11:25 pm
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Wishlist: en/disable POE on a switch port, en/disable an

kw123 wrote:
As for suspend: the plugin just ignores everything for that devices and sets the icon to powerOff and "susp". I thought thats what you wanted.

No, I wanted the suspend/disable function for the UniFi controller.
But the suspend function you added is really useful because it prevents the Indigo log from showing the fatal errors when your plugin doesn't find a device anymore.

"I tawt I taw a puddy tat!" Tweety

Posted on
Tue May 15, 2018 4:13 am
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Wishlist: en/disable POE on a switch port, en/disable an

Looks like you're latest update introduced a little bug.

I have suspended the access point.
Indigo shows that device as "susp".
But the Indigo log keeps filling up with Fatal errors on connections to the IP address of that access point.

This worked in 7.15.105.

"I tawt I taw a puddy tat!" Tweety

Posted on
Tue May 15, 2018 7:35 am
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

what are this messages? >> ===============================================\n FATAL error connecting to ip#: ....<< ?

is there a >>> "dev.name + u" is back from suspended status"<<< before that?

[added] I have suspended an access point and do not get any messages.. what exactly did you do?

Posted on
Tue May 15, 2018 10:15 am
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Wishlist: en/disable POE on a switch port, en/disable an

Here is an example from the Indigo log from yesterday:

First the suspend action, right at the moment where I expect it.

2018-05-14 21:14:43.705 uniFiAP suspending Unifi system device AP_00:00:00:00:00:00 1.2.3.4

The next action should be to stop the AP 30 seconds after suspending the AP.
Somehow it took 5,5 minutes.

2018-05-14 21:20:04.153 Connection reboot required due to new UNIFI system device found:[u'uap: , new 1.2.3.3 existing: 1.2.3.3', u'uap: 2, 1.2.3.3', u'ugw: , new ipUGAON was : True', u'usw: , new 1.2.2.5 existing: 1.2.2.6', u'usw: , new 1.2.2.2 existing: 1.2.2.2', u'uap: , new 1.2.3.1 existing: 1.2.3.1', u'uap: 0, 1.2.3.1', u'usw: , new 1.2.2.3 existing: 1.2.2.3', u'usw: , new 1.2.2.7 existing: 1.2.2.5', u'uap: , new 1.2.3.2 existing: 1.2.3.2', u'uap: 1, 1.2.3.2', u'usw: , new 1.2.2.4 existing: 1.2.2.7', u'uap: , new 1.2.3.4 existing: 1.2.3.4', u'uap: 3, 1.2.3.4', u'usw: , new 1.2.1.1 existing: 1.2.1.1', u'usw: , new 1.2.2.1 existing: 1.2.2.1', u'usw: , new 1.2.2.6 existing: 1.2.2.4']
2018-05-14 21:20:04.156 uniFiAP stopping plugin due to: ::::: new devices :::::
2018-05-14 21:20:05.468 Application Reloading plugin "uniFiAP 7.15.106"
2018-05-14 21:20:05.469 Application Stopping plugin "uniFiAP 7.15.106" (pid 22182)
2018-05-14 21:20:05.470 uniFiAP Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
2018-05-14 21:20:06.618 Application Stopped plugin "uniFiAP 7.15.106"
2018-05-14 21:20:08.134 Application Starting plugin "uniFiAP 7.15.106" (pid 22733)
2018-05-14 21:20:09.065 uniFiAP setting parameters for indigo version: >>7<<
2018-05-14 21:20:09.099 Application Started plugin "uniFiAP 7.15.106"
2018-05-14 21:20:09.105 uniFiAP initializing ... variables
2018-05-14 21:20:09.106 uniFiAP logfile handling: regular indigo logfile
2018-05-14 21:20:09.108 uniFiAP com.karlwachs.uniFiAP
2018-05-14 21:20:09.108 uniFiAP
...
2018-05-14 21:20:09.565 Connection VDdict login disabled, userid is empty
2018-05-14 21:20:10.233 uniFiAP start runConcurrentThread, initializing variables ..
2018-05-14 21:20:10.234 uniFiAP ..getting missing vendor names for MAC #
2018-05-14 21:20:10.576 uniFiAP ..starting threads for 4 APs 4 sec apart (MSG-log and db-DICT)
2018-05-14 21:20:10.577 START launching APtail 1.2.3.1
2018-05-14 21:20:10.779 START launching APdict 1.2.3.1
2018-05-14 21:20:14.786 START launching APtail 1.2.3.2
2018-05-14 21:20:14.991 START launching APdict 1.2.3.2
...
2018-05-14 21:20:18.997 START launching APtail 1.2.3.3
2018-05-14 21:20:19.204 START launching APdict 1.2.3.3
...
2018-05-14 21:20:23.215 START launching APtail 1.2.3.4
2018-05-14 21:20:23.424 START launching APdict 1.2.3.4
2018-05-14 21:20:27.427 uniFiAP ..starting threads for GW (MSG-log and db-DICT)
2018-05-14 21:20:27.429 START launching GWtail 1.2.1.2
2018-05-14 21:20:27.637 START launching GWdict 1.2.1.2
2018-05-14 21:20:27.638 uniFiAP ..starting threads for 7 SWs 8 sec apart (db-DICT only)
2018-05-14 21:20:27.639 START launching SWdict 1.2.1.1
2018-05-14 21:20:28.452 testConnection
===========1.2.3.4 ==> spawn ssh User@1.2.3.4
exit
ssh: connect to host 1.2.3.4 port 22: Network is unreachable


2018-05-14 21:20:28.453 getMessages

================================================
FATAL error connecting to ip#: 1.2.3.4 wrong ip/ password or system down...?
================================================n
2018-05-14 21:20:28.545 testConnection
===========1.2.3.4 ==> spawn ssh User@1.2.3.4
ssh: connect to host 1.2.3.4 port 22: Network is unreachable

exit

"I tawt I taw a puddy tat!" Tweety

Posted on
Tue May 15, 2018 1:22 pm
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

ok I have it fixed.. want to check some more things and will publish later today

Posted on
Tue May 15, 2018 4:31 pm
kw123 offline
User avatar
Posts: 5599
Joined: May 12, 2013
Location: Dallas, TX

Re: Wishlist: en/disable POE on a switch port, en/disable an

macpro... v ...110 should have these things fixed.

it now also remembers the suspended devices through a reload . The info is stored in ~/indigo/unifi/suspended


Karl

Posted on
Wed May 16, 2018 12:58 pm
macpro offline
User avatar
Posts: 690
Joined: Dec 29, 2005
Location: Third byte on the right

Re: Wishlist: en/disable POE on a switch port, en/disable an

Thanks!

Installed the 110 version and will see later when we close the door.

"I tawt I taw a puddy tat!" Tweety

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest