iobroker-community-adapters / ioBroker.unifi

ioBroker.unifi is an ioBroker adapter for your UniFi network devices.
MIT License
74 stars 24 forks source link

Implement support UniFi OS based controllers (e.g. UniFi Dream Machine) #28

Closed pietro4711 closed 4 years ago

pietro4711 commented 4 years ago

the new udm(pro) also supports access via api - but the url seems to have been changed. Please see here: https://github.com/Art-of-WiFi/UniFi-API-client

unwichtig commented 4 years ago

+1 für mich, ich habe mitlerweile ebenfalls auf den UDM-Pro umgestellt, und leider macht der Adapter nun nicht mehr mit ;) Es wird nicht mehr mit den Ports gearbeitet um z.B. zwischen Network und Protect zu unterscheiden. Bsp.: aktuell: https://192.168.1.1/network/site/default/dashboard
vorher: https://192.168.1.1:8443/manage/site/default/dashboard

Und für die Cameras: https://192.168.1.1/protect/cameras statt https://192.168.1.1:7443/cameras/...

Ich vermute dass noch: .../talk/.... und .../access/... dazu kommen werden, leider bisher nicht in .de zu bekommen und auch nicht frei zu schalten. Dummerweise könnte ich grade jetzt zumindest "Talk" recht gut gebrauchen.

braindead1 commented 4 years ago

As of now UniFi OS is not in scope of this adapter. I will flag this issue as "enhancement", but I cannot guarantee to work on it in near future due to the fact, that I do not own a UniFi OS device.

jens-maus commented 4 years ago

@braindead1 Please note that I have further enhancements of node-unifi pending which should support the UDM-Pro / UnifiOS too. Will let you know when these changes are integrated so that we can try to get these things ported over to iobroker.unifi

MC-1984 commented 4 years ago

Any news on possible UDM-Pro / UnifiOS support so far?

braindead1 commented 4 years ago

@MC-1984 The adapter is based on node-unifi, which is maintained by @jens-maus. Without node-unifi supporting UnifiOS, I don't see a good chance to get it supported in this adapter, as I don't own a UDM-Pro.

jens-maus commented 4 years ago

Please note that I have actually started working on integrating / implementing UnifiOS/UDM-Pro support in node-unifi (https://github.com/jens-maus/node-unifi) as well as generally updating it to comply with newer API methods in the UniFi controller.

As I don't own a UDM-Pro/UnifiOS system myself I can, unfortunately, not test the changes myself. Thus, I would like to ask anyone owning a UDM-Pro/UniFiOS to help out and test the latest github sources of node-unifi. A corresponding ticket in the node-unifi project can be found here: https://github.com/jens-maus/node-unifi/pull/23

MC-1984 commented 4 years ago

@braindead1 Can you implement the changes from jens-maus in the adapter so that we can test the changes? I don´t know how to test it otherwise.

jens-maus commented 4 years ago

For the first tests it would probably be enough to just test the node-unifi class/project independent from iobroker.unifi.

Or someone sith a UDM-Pro provides me read-only access for testing purposes so that I can run some tests.

braindead1 commented 4 years ago

@pietro4711 and @unwichtig and @MC-1984 Please consider @jens-maus suggestion to grant him read-only access for testing puposes. node-unifi is the basis for this adapter. Once node-unifi supports UniFi OS, I will start implementing the needed changes into this adapter.

jens-maus commented 4 years ago

@braindead1 Thanks for the heads up! But what you or others without a UDM-Pro/UniFi-OS device could already try is the latest sources in the master branch of node-unifi and see if everything still works for non-UniFiOS devices. I don't expect any difficulties, thought, but I am also working on integrating some bunch of test sets using GitHub Actions to hopefully automatically test all integrated API functions to get a better picture if some change breaks some functionality. But until these tests are integrated (which are actually using a containerized unifi-controller in GitHub Actions) it would be great to see the changes in the master branch of node-unifi tested by someone else than myself.

MC-1984 commented 4 years ago

Unfortunately, I cannot allow access to my UDM-Pro. As soon as it is implemented in the adapter, I will test it and give feedback.

jens-maus commented 4 years ago

@MC-1984 Sorry, but this is not how I have planned it. I am almost sure there are some corner cases where my node-unifi adapations won't work correctly. Thus, I would definitly need access to a UDM-Pro before so that I can test these adaptions and provide solutions before I am going to release a new version of node-unifi so that ioBroker.unifi can use it in a new release.

pietro4711 commented 4 years ago

@jens-maus Hi Jens, i have created an account (read only) for you on my UDM-Pro for testing. If possible I need your IP to restrict the access. I will contact you per email.

jens-maus commented 4 years ago

Ok, thanks to @pietro4711 I finally got access to a UDM-Pro system which I could test and fix node-unifi on for the UDM-Pro/UniFiOS based systems. For my basic tests it seems to work now to query all kind of information. That's why I just published a first 1.3.1 version to npm.

Still have to add more bunch of CI-tests to get things more deeply tested, but I think you guys (@braindead1) can finally bump the minimum node-unifi version to 1.3.1 and then let UDM-Pro users like @pietro4711 and @MC-1984 perform tests on it based on the master branch of ioBroker.unifi. Thus, I basic bump to 1.3.1 in your package.json should be enough to get UDM-Pro compatibility working, hopefully.

MC-1984 commented 4 years ago

Thank you very much @jens-maus. I really appreciate your work! Yours too, of course @braindead1

I will test as soon as the adapter is updated

jens-maus commented 4 years ago

I just remembered that I have commit rights to this repo as well. Thus, I bumped node-unifi to 1.3.2 now. So please anyone with a UniFiOS/UDM-Pro device please test the latest GitHub master and report back.

MC-1984 commented 4 years ago

I installed the new adapter version and entered my credentials. I left the port blank and activated wlans and sysinfo for testing purposes.

The instance gets yellow (no connection to unifi).

Log: ` unifi.0 2020-05-19 16:28:33.040 error (27432) TypeError: wlan_id.trim is not a function
unifi.0 2020-05-19 16:28:31.443 info (27432) UniFi adapter is ready
unifi.0 2020-05-19 16:28:31.403 info (27432) starting. Version 0.5.0 in /opt/iobroker/node_modules/iobroker.unifi, node: v12.16.3, js-controller: 3.1.4

`

Did I miss anything in the settings?

jens-maus commented 4 years ago

@MC-1984 Ok, try again please (reinstall adapter from github and run your tests again). should be fixed.

pietro4711 commented 4 years ago

now it works ! :-) Thanks Jens !

jens-maus commented 4 years ago

Perfect! Then please test it hard by enabling all kind of queries

MC-1984 commented 4 years ago

Same here! No errors during preliminary testing! Thank you!

pietro4711 commented 4 years ago

enabled all queries - works like a charm !

kopierschnitte commented 4 years ago

I can also confirm everything's working great with 0.5.1-b3 connecting to an UDMP 1.7. Although I needed to change the port to 443. Might be an idea to write something about the different ports on the settings page...