ioBroker.unifi
ioBroker.unifi copied to clipboard
Enable and disable PoE Ports via ioBroker
Hello Jens, I currently use your plugin for reading different values of my Unifi Controller. I would like to remotely activate or deactivate PoE on separate ports. One AP is located outside and just need to be activated when people are outside. So I would like to turn on PoE via your plugin. Is this somehow possible? Regards, Harald
FYI: Please note, I recently added an example in the node-unifi package how to perform such a poe port switching using the node-unifi API. See https://github.com/jens-maus/node-unifi/blob/master/examples/poe-switch-onoff.js
Hallo Jens,
da auch ich meine WLAN APs über den iobroker schalten möchte, habe ich mal angefangen mir das anzusehen. Ich bin bzgl. iobroker noch newbie, aber das Auslesen des poe-mode funktioniert auch schon wunderbar. Patch ist anbei. iobroker.unifi.patch.txt
Allerdings habe ich noch nicht verstanden wie das Setzten des poe-mode dann implementiert werden kann. Muss man dazu separat abgelegte "overrides" modifizieren?
Evtl. kannst Du mir ja eine Doku nennen oder wenigstes die relevanten Files im unifi-adapter.
Danke und viele Grüße Maximilian
Gibt es zu diesem Thema schon einen neuen Stand. Möchte einen RaspberryPi mit Octoprint über PoE zusammen mit dem Drucker schalten
Guten Abend Ich wollte mal nachfragen ob es möglich ist ports vom unifi switch zu deaktivieren / aktiviern per blockly. Meine Idee war es sobald ich erkenne das eine Poe Kamera abgeklemmt wurde den port automatisch zu deaktivieren. Und dann manuell wieder zu Aktivieren. vielen dank schon mal.
Da es hier leider sehr wenige Ansetzpunkte gibt habe ich viel gesucht und bin zum Ergebnis gekommen, dass man zum Ändern von Einstellungen über die port_overrides gehen muss. Ich habe die entsprechenden Datenstrukturen bei mir schon vorbereitet komme aber momentan leider nicht dazu weiterzumachen. Aber mein Bedarf ist auch noch da :) Sobald ich wenigstens mal etwas Zeit habe, kann ich einen Pull-Request mit den Datenstrukturen machen.
Workaround: https://forum.iobroker.net/topic/37196/unifi-switch-poe-ports-per-vis-blockly-ein-ausschalten/4?_=1647548287325
Pull-Request mit aktuellen Datenstrukturen inkl. poe-mode und port-overrides ist erstellt.
Guten Morgen Schon mal vielen dank für die Arbeit aber wie schlalte ich denn jetzt den port aus?
Guten Morgen, da ich leider ein ziemlicher Laie in der Materie bin, würde auch ich mich für die Option einer Abschaltung von POE-Ports interessieren. Ich bedanke mich schon mal für die tolle Arbeit die ihr immer leistet!
Gibt es hierzu schon Neuigkeiten? Ich möchte gerne einige Geräte zeitweise ausschalten, um Strom zu sparen.
PR #597 added
Sorry Leute, ich komme mit github an der ein oder anderen Stelle nicht so ganz klar... Was genau bedeutet der Post von Scrounger?
@Nogger82 ganz einfach. das bedeutet, dass @Scrounger fleißig war (DANKE) und die gewünschte Funktion programmiert hat.
- Nun muss der Code hier noch "genehmigt" werden
- Anschließend die Freigabe einer neuen Version des Adapters
- Anschließend 🍾
Hey cool, dann sag ich auch mal danke und bin gespannt, wann wir es mal testen können 😊
@Nogger82 Kannst es schon teste, musst halt meinen fork installieren: https://github.com/Scrounger/ioBroker.unifi
ah. danke für den Hinweis. Hallte auf den Merge hier gewartet, aber ja. geht ja auch so... danke dir
Hi @Scrounger
funktioniert es bei Dir? bei mir irgendwie nicht. beim Install fehlt ihm eine dependency tough-cookie
- nciht sicher ob wichtig bzw ich ich die installiert bekomme
Port_overwrites scheint die Ecke zu sein, wenn ich settings ändern will. die port_table ist komplett read-only. ist das richtig so? Sehe aber auch nur zwei Ports dort und nicht alle aus der table. die conf-ids der beiden angezeigten stimmen.
Wenn ich dann den port 3 auf false
setze, passiert außer dem log Eintrag nix
switchPoeOfPort: switching poe power of port 3 for device d0:21:f9:70:b1:07 to false
übersehe ich was?
Hi @Scrounger funktioniert es bei Dir? bei mir irgendwie nicht.
äh ja natürlich funktioniert es bei mir. Datenpunkt mit dem man das steuern kann ist port_overwrites.port_x.poe_enabled
.
beim Install fehlt ihm eine dependency
tough-cookie
- nciht sicher ob wichtig bzw ich ich die installiert bekomme
Installier mal mit folgendem befehlt ioboker url https://github.com/Scrounger/ioBroker.unifi
.
Port_overwrites scheint die Ecke zu sein, wenn ich settings ändern will. die port_table ist komplett read-only. ist das richtig so? Sehe aber auch nur zwei Ports dort und nicht alle aus der table. die conf-ids der beiden angezeigten stimmen.
Wenn ich dann den port 3 auf
false
setze, passiert außer dem log Eintrag nix![]()
switchPoeOfPort: switching poe power of port 3 for device d0:21:f9:70:b1:07 to false
Also eigentlich müssten hier alle Ports angezeigt werden. Werden unter .port_table .*
alle ports angezeigt? Hast du irgendwelche filter im Adapter konfiguriert?
I am debugging all the information. here are my findings
port_overwrites this is only showing ports where non-standard settings were done. when you have PoE enabled/auto (and nothing else changed), the port is not within this list anymore
here the output of dataDevice
not sure how to solve this, but this is an open to-do
code error
the checking of the index is wrong:
const indexOfPort = port_overrides.findIndex(x => x.port_idx === parseInt(port));
if (indexOfPort > 0) {
https://github.com/iobroker-community-adapters/ioBroker.unifi/blob/e6eee39e83bc040167c15d81dcd6ce0d83c1c657/main.js#L1045
0
is a valid index (like in my case, i am switching the first port). you need to check for != -1
@Scrounger can you change this in your PR? I am not sure if I can do this
@Rello
Thanks for your review. You are absolutly right. I didn't discover this because all my ports have custom settings.
So i think it's better to move the button poe_enabled
to the port_table tree, because there we have all ports.
I will update the PR.
@Rello Please try my fork https://github.com/Scrounger/ioBroker.unifi
I moved the poe_enabled
datapoint to the port_table and renamed it to port_poe_enabled
.
Before testing delete all devices datapoints. Should now work also with ports that have default settings.
Hi, looks good from first test! but I still see the port_overwrites section - even so the port_table is working as expected
@Rello
sounds great. port_overwrites section is necessary for poe switching, if ports do not have the default settings. Otherwise the settings of this port would be reset to default. As soon as you select port_poe_enabled datapoint in the adapter config, all necessary datapoints will be enabled as well.
Please give a final feedback if everything works for you now.
yes. I can confirm its working. I changed my scripts to the new datapoints already and all ports were switched correctly tonight. Thank you for your support here!
implemented in #597 issue can be closed
@Rello
is it still working on your System? I wanted to create a script, but the POE-Switch desn´t change. A few Days ago, it was working.
Hi, yes, working perfectly. switching Accesspoints and my Hue bridge on a daily base.
take care that you use the port table - not the overwrites like in the first version
....a:c4:53:bc.port_table.port_3.port_poe_enabled
yes, i´m using exactly that one on Port 9 to control my Camera, but nothing happens.
Edit: It works again. I have no idea what the problem was.
Hello thanks a lot to all you guys for implementing this feature in iobroker. I am interested as well in using the PoE Switch functionality. However, I am still a bit new in this and possibly a bit (too) old too. So may I ask the following questions: When I look on Github, the iobroker.unifi Adapter has the version v0.6.3. My IOBroker installation is up to date, all adapters are on the maximum available version. But there the latest available version has the number 0.5.10. I am now a bit confused. Why is there not the latest version available? Do I need to use the fork from scrounger to use this functionality? Thanks a lot in advance for your help.