openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[UniFi] Queue port commands in one call #14758

Open wosch87 opened 1 year ago

wosch87 commented 1 year ago

Hi guys, this was my original question in openhab community forum:

I am using the PoE mode (auto, off) at my US-24-250 to completely switch off my Unifi PoE cameras. Changing the PoE mode at one port leads to the switch is getting ready in Unifi controller for ~10-15sec and then shows adopted again. I guess the switch is somehow restarting or something like that in order to physically power of PoE for that port. During this time no further command can be send to the switch. That means I setup several 20sec-timers changing port by port to cover the “getting ready time”. The same is required for enabling / disabling PoE (switch item). I am wondering if it is possible to somehow cumulate the port-commands which means the switch will change all ports togehter and “restart” only once instead change port by port with 5 timers every 20 seconds in between?

The answer of @Hilbrand seems absolutely feasible for me (shortened):

Technically it would be possible because the update of the ports sends all data on all ports. An option could be to enhance the binding. An option could be to add a configuration option to the port thing to not send the commands directly but queue them first (property would be something like queueCommands=true. The PoE thing handler will than also get a command channel (something like sendCommands) that sends all commands on the queue in one call. If you also want to also send individual command directly you can create 2 things, one which triggers on queue, and one thing that works directly. (it probably also needs to have to time-to-life for the queue, to not clog the queue).

This is my first feature request, hopefully I did everything right and I provided all what is needed to enhance the binding? If not, please let me know :)

BR, Sascha

openhab-bot commented 1 year ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/ubiquiti-unifi-binding-feature-discussion/14520/1274