Isaksson / node-red-contrib-unifi

MIT License
50 stars 19 forks source link

not works with Dream Machine Pro #19

Closed patrick-dmxc closed 4 years ago

patrick-dmxc commented 4 years ago

Its not working with the new Dream Machine Pro. it seems the authentification has changed

michaltaberski commented 4 years ago

Ok, thanks for info. At least I know it doesn't make sense to play more with it.

Isaksson commented 4 years ago

I do not have a Dream Machine I run the controller on a server. When using Dream Machine does the controller need to communicate to the cloud with ubnt?

Do you need to login with something else than just local username and password?

patrick-dmxc commented 4 years ago

no, the protocol has changed

Isaksson commented 4 years ago

Ahh okey, that's really bad from ubnt, then they use a different controller software on that device.

Isaksson commented 4 years ago

I have now pushed a new version to NPM (0.1.0) please try this version against the Dream Machine Pro, you just have to check the checkbox Unifi OS on this node. unifios

patrick-dmxc commented 4 years ago

I tested it, but nothing hapend. There is nothin come out of the Unifi Node. maybe i use the wrong IP. which on is the Controler IP? I have 3 VLANs where i can reach the Controler with the Browser. Management 192.168.178.20 Private 192.168.1.1 SmartDevices 192.168.10.1 (Node Red is in this VLAN)

all three VLANs ar able to reach each other

michaltaberski commented 4 years ago

If you are in a LAN you should use IP of the gateway. Most likely 192.168.1.1.

Nevertheless I am doing so, but I am getting no response from the node - nor error neither.

Also I am pushing following message to the node:

return {
    payload: { command: "ClientDevices"}
};

without result.

Isaksson commented 4 years ago

Thanks for the test, and you get non error message in Node-REDs output? I do not have any device to test against so that makes this a little harder. But I was pretty sure that this should have worked.

Do you get any output at all from the Node? If you enter incorrect login details does that generate error message?

Isaksson commented 4 years ago

And please try this command "SiteStats" from the drop down menu, and when you do, do not inject any command.

Isaksson commented 4 years ago

New version 0.1.1 is now pushed to NPM, maybe I have solved the login issue with this fix.

patrick-dmxc commented 4 years ago

You only changed the VersionNumber ;)

Isaksson commented 4 years ago

I did two pushes, first the change in .js and then I did the version number change for NPM to work :)

patrick-dmxc commented 4 years ago

Ok, i‘ve tested this, but Nothing, no Log, no exception. Maybe ist because ist runs on iobroker?

Isaksson commented 4 years ago

So you run your Node-RED in the cloud? do you have access to your dream machine pro from internet?

patrick-dmxc commented 4 years ago

Node Red runs on ioBroker IoBroker runns on RaspberryPi and is in my local Network and has access to the UDM Pro.

Isaksson commented 4 years ago

Then that should not be any issue, as long as you enters the correct IP address for your controller and that its reachable from the Raspberry network

pettaflex commented 4 years ago

Hi.

Tried on both a raspberry pi installation and on a pc running latest ubuntu. And neither of 1.0 and 1.1 is working for me! Was working on a older version. Not using dreammachine but unifi controller on another raspberry!

Isaksson commented 4 years ago

Hi.

Tried on both a raspberry pi installation and on a pc running latest ubuntu. And neither of 1.0 and 1.1 is working for me! Was working on a older version. Not using dreammachine but unifi controller on another raspberry!

I have created a new issue about this.

michaltaberski commented 4 years ago

I have Raspberry PI setup with Node-Red running on docker + UDM Pro as a main router.

Node-RED : 192 168 1 10 2020-03-25 22-32-48

Nothing happens, no errors, no logs. If I can help you debug the issue let me know.

Isaksson commented 4 years ago

New version published to NPM.

michaltaberski commented 4 years ago

Now it looks like this:

Screenshot 2020-03-26 at 08 25 09

But still I don't know how to log error in order to give some more valuable info.

Isaksson commented 4 years ago

I have made some big changes to this Node witch now gives me the possibility to make mush better error handling, as you could see I have not yet implemented this :) If I just should make a guess then I would say that this error message is a connection timeout against the IP address added as controller IP.

I dont know how you "start" Node-RED but Iam running it in a CMD in windows environment so I see the console output like this noderedlog

michaltaberski commented 4 years ago

Interesting ERROR: Error: connect ECONNREFUSED 192.168.1.1:8443

Isaksson commented 4 years ago

Does the UDM Pro uses different port then 8443? The error message tells us that it does not accept connection on that port. This is how it will look like in next version, added error to Node In this example I have changed to a port on my server that does not accept connection.

noderederror

michaltaberski commented 4 years ago

Does the UDM Pro uses different port then 8443?

Good question, not sure if there is public API documentation regarding this matter.

Looking forward to see updated error messaging 👍

Isaksson commented 4 years ago

I have not seen any indication that they should have changed that port so I think 8443 is the correct one. Are you sure that you are connecting against the correct IP? maybe the UDM Pro has multiple IP address and only one that accept remote connection?

Isaksson commented 4 years ago

I found one post that is 1 month old and they did run against port 443 on their UDM Pro, so please try that.

patrick-dmxc commented 4 years ago

Port 443 works.

Isaksson commented 4 years ago

Port 443 works.

Great, have you confirmed that it works to login and also to execute some commands against the UDM Pro?

patrick-dmxc commented 4 years ago

Yes, it works, except "AllUsers". the message payload is empty

patrick-dmxc commented 4 years ago

DisableWlan not works

Isaksson commented 4 years ago

Thanks. I have created a new Issue with a list of commands that is not working with Unifi OS, I have added AllUsers and DisableWlan to that list, I will check this tomorrow. Iam closing this issue now.

michaltaberski commented 4 years ago

Works, thanks!

Isaksson commented 4 years ago

@patrick-dmxc I have made an adjustment for the command DisableWlan for UnifiOS could you please test this new version, its on NPM 0.1.4, please respond in the issue #23