Jump to content

Polyglot v2 Hue NodeServer


xKing

Recommended Posts

Hue Poly is now available as an Alpha version, basic functionality has been implemented and tested.

 

I'm open to any improvement suggestion that experienced Hue users might have :)

 

There is the GitHub repo

It should also be available in the Polyglot store as soon as Einstein42 approves it.

 

 

p.s. I would like to thank Einstein42 for his tremendous work on the Polyglot v2 and original v1 Hue authors for starting the Hue integration :)

post-6268-0-38855500-1513400520_thumb.png

post-6268-0-19291100-1513400529_thumb.png

Link to comment
Share on other sites

For whatever reason the auto-discovery (even after pushing the button on the hub) never works for me. I actually have to modify the NodeServer and put the IP address in.

 

```

self.hub = phue.Bridge('10.0.0.228')

```

 

No big deal there, but for other users it might be easier if you create a customParam key of 'ip' or something that they can just enter it on the Frontend after they add the NodeServer. Then if the customParam exists, use it, if not do the search? 

 

Other than that, it is working really well. Nice job! 

Link to comment
Share on other sites

Thanks!

 

Could you please try

 

curl https://www.meethue.com/api/nupnp

 

from any of your systems and see if it returns the bridge internal IP? You have to register your bridge with the meethue.com in order for that to work though...

 

Pushing button does not affect the discovery - it's only needed for "user" creation on the bridge :) Once IP and user are saved under ~/.python_hue - that file is used for for any future communications.

 

I'll certainly add an option to specify Bridge IP in the NodeServer custom parameters! 

Link to comment
Share on other sites

Ok, so on my dev boxes (which are all VM's on ESXi). I get: 

curl https://www.meethue.com/api/nupnp
[]

However. I just tried it on my pi3 dev and pi3b prod environments and I get:

curl https://www.meethue.com/api/nupnp
[{"id":"001788fffe6e5fe3","internalipaddress":"10.0.0.228"}]

Which is actually weird, because I installed it this morning on my prod rpi3b and got this until I added the IP to the Bridge() command.

2017-12-17 19:33:20,515 INFO     Polyglot v2 Interface Starting...
2017-12-17 19:33:20,517 INFO     Received Config from STDIN.
2017-12-17 19:33:20,590 INFO     Connecting to MQTT... localhost:1883
2017-12-17 19:33:20,650 INFO     Started Hue Protocol
2017-12-17 19:33:20,659 INFO     MQTT Connected with result code 0 (Success)
2017-12-17 19:33:20,661 INFO     MQTT Subscribing to topic: udi/polyglot/ns/1 -  MID: 1 Result: 0
2017-12-17 19:33:20,663 INFO     MQTT Subscribing to topic: udi/polyglot/connections/polyglot -  MID: 2 Result: 0
2017-12-17 19:33:20,664 INFO     Sent Connected message to Polyglot
2017-12-17 19:33:20,718 INFO     Adding node Hue Bridge(huebridge)
2017-12-17 19:33:20,720 INFO     Updating Driver huebridge - ST: 1
2017-12-17 19:33:20,722 INFO     Waiting on Primary node to be added.......
2017-12-17 19:33:20,892 DEBUG    Connect method called
2017-12-17 19:33:20,893 INFO     Attempting to connect to the bridge...
2017-12-17 19:33:20,894 INFO     Error opening config file, will attempt bridge registration
2017-12-17 19:33:21,079 INFO     Connecting to meethue.com/api/nupnp
2017-12-17 19:33:21,247 ERROR    Cannot find Hue Bridge
2017-12-17 19:33:21,248 INFO     Updating All Drivers to ISY for Hue Bridge(huebridge)

Then I added it Bridge('10.0.0.228')

2017-12-17 19:49:01,760 INFO     Polyglot v2 Interface Starting...
2017-12-17 19:49:01,763 INFO     Received Config from STDIN.
2017-12-17 19:49:01,779 INFO     Connecting to MQTT... localhost:1883
2017-12-17 19:49:01,847 INFO     Started Hue Protocol
2017-12-17 19:49:01,871 INFO     MQTT Connected with result code 0 (Success)
2017-12-17 19:49:01,872 INFO     MQTT Subscribing to topic: udi/polyglot/ns/1 -  MID: 1 Result: 0
2017-12-17 19:49:01,873 INFO     MQTT Subscribing to topic: udi/polyglot/connections/polyglot -  MID: 2 Result: 0
2017-12-17 19:49:01,874 INFO     Sent Connected message to Polyglot
2017-12-17 19:49:01,976 INFO     Updating Driver huebridge - ST: 1
2017-12-17 19:49:01,979 DEBUG    Connect method called
2017-12-17 19:49:01,980 INFO     Attempting to connect to the bridge...
2017-12-17 19:49:01,980 INFO     Error opening config file, will attempt bridge registration
2017-12-17 19:49:01,983 DEBUG    POST /api {'devicetype': 'python_hue'}
2017-12-17 19:49:01,988 ERROR    IP Address OK. Node Server not registered.

Then I ran downstairs and hit the button and sprinted back upstairs to restart it again:

2017-12-17 19:51:07,112 INFO     Polyglot v2 Interface Starting...
2017-12-17 19:51:07,114 INFO     Received Config from STDIN.
2017-12-17 19:51:07,129 INFO     Connecting to MQTT... localhost:1883
2017-12-17 19:51:07,198 INFO     Started Hue Protocol
2017-12-17 19:51:07,208 INFO     MQTT Connected with result code 0 (Success)
2017-12-17 19:51:07,209 INFO     MQTT Subscribing to topic: udi/polyglot/ns/1 -  MID: 1 Result: 0
2017-12-17 19:51:07,210 INFO     MQTT Subscribing to topic: udi/polyglot/connections/polyglot -  MID: 2 Result: 0
2017-12-17 19:51:07,211 INFO     Sent Connected message to Polyglot
2017-12-17 19:51:07,336 INFO     Updating Driver huebridge - ST: 1
2017-12-17 19:51:07,337 DEBUG    Connect method called
2017-12-17 19:51:07,338 INFO     Attempting to connect to the bridge...
2017-12-17 19:51:07,339 INFO     Error opening config file, will attempt bridge registration
2017-12-17 19:51:07,342 DEBUG    POST /api {'devicetype': 'python_hue'}
2017-12-17 19:51:07,352 INFO     Writing configuration file to /home/pi/.python_hue
2017-12-17 19:51:07,352 INFO     Reconnecting to the bridge
2017-12-17 19:51:07,353 INFO     Attempting to connect to the bridge...
2017-12-17 19:51:07,354 INFO     Using ip: 10.0.0.228
2017-12-17 19:51:07,355 INFO     Using username from config: 

Success!

 

I don't know why it didn't find it automatically. That curl command worked from it just now. 

Link to comment
Share on other sites

Thanks, I'll check on automatic discovery, will get the custom parameter added tomorrow.

 

p.s. just pushed a small update that optimizes bridge polling, now it will pull all bulbs in a single request every 15 seconds instead of asking about each bulb status individually. However manual Query command - will ask about the specific bulb only.

 

Next things would be bridge discovery optimization and I'll look into adding groups support (does not really make sense to turn each individual bulb on if you have like 6 bulbs in the same room :))

Link to comment
Share on other sites

Added custom ip parameter real quick, seems to work... 

 

BTW, how do I delete a custom parameter? :)

 

I'm getting a message "No Settings Changed." on the red background and if I go back to Nodeservers -> Custom parameters - it's still there...

Link to comment
Share on other sites

Thanks :)

 

Another weird thing - somehow I ended up with the node listed twice in the Polyglot DB, see the screenshot. Not sure how that happened... Guess I'll remove the node server and re-add it back to clear it up.

 

ISY shows it only once and it works just fine. Noticed it while I was looking at custom parameters.

 

post-6268-0-69709700-1513565658_thumb.png

Link to comment
Share on other sites

UPDATE:

 Version 0.1.0 is out with Groups support.

 It requires a new profile.zip to be uploaded to ISY, so your best bet is to remove node server and re-add it again after hitting the update button.

 

Please let me know if you see any problems :)

Link to comment
Share on other sites

For us unix dummies....how/what does  "copy that file into ~/.python_hue" mean?

 

I have found the "bridges" file.  I have tried creating a new file named "python_hue" in my "/home/pi" directory, I also created a folder in the same directory and just copied the "bridges" file to that folder.  I then tried  creating a folder in my "/home/pi/Polyglot/config" folder and copying the bridges file there, I still get the same message in my log:

 

2017-12-29 10:12:42,906 INFO Polyglot v2 Interface Starting...

2017-12-29 10:12:42,908 INFO Received Config from STDIN.

2017-12-29 10:12:42,937 INFO Connecting to MQTT... localhost:1883

2017-12-29 10:12:42,994 INFO Started Hue Protocol

2017-12-29 10:12:43,007 INFO MQTT Connected with result code 0 (Success)

2017-12-29 10:12:43,008 INFO MQTT Subscribing to topic: udi/polyglot/ns/2 - MID: 1 Result: 0

2017-12-29 10:12:43,008 INFO MQTT Subscribing to topic: udi/polyglot/connections/polyglot - MID: 2 Result: 0

2017-12-29 10:12:43,010 INFO Sent Connected message to Polyglot

2017-12-29 10:12:43,079 INFO Updating Driver huebridge - ST: 1

2017-12-29 10:12:43,081 INFO Attempting to connect to the bridge...

2017-12-29 10:12:43,082 INFO Error opening config file, will attempt bridge registration

2017-12-29 10:12:43,246 INFO Connecting to meethue.com/api/nupnp

2017-12-29 10:12:43,450 DEBUG POST /api {'devicetype': 'python_hue'}

2017-12-29 10:12:43,453 ERROR IP Address OK. Node Server not registered

 

Since I am trying to do this remotely (60+ miles away) I would like to not have to push the hue button to get this back up and running.

Link to comment
Share on other sites

Thanks, still don't understand all the meanings of things in the unix world.  So, what does having the "." in front of the file name do/mean?  BTW it is now working, just trying to understand the significance of the . 

Link to comment
Share on other sites

Greg, it makes it a 'hidden' file. Not really, but you can think of it that way. If you do a standard 

ls

you wont see the files or folders that start with '.'

 

Typically developers and package maintainers use . folders or files as configuration folders/files as a way to not clutter up your home directory.

 

Polyglot does this too e.g.:

~/.polyglot/
Link to comment
Share on other sites

None of my white bulbs seem to be reporting/working correctly.  In the log they are all listed as Unsupported Dimable Light Bulb:  NAME(NUMBERS)

 

2017-12-30 15:11:11,032 INFO Found Unsupported Dimmable light Bulb: Upper1(880102098a800b)

2017-12-30 15:11:11,033 INFO Found Unsupported Dimmable light Bulb: Bedroom South(88010268bd890b)

2017-12-30 15:11:11,033 INFO Found Unsupported Dimmable light Bulb: Upper 2(8801022a10c10b)

2017-12-30 15:11:11,033 INFO Found Unsupported Dimmable light Bulb: DStairs(8801020987d80b)

2017-12-30 15:11:11,033 INFO Found Unsupported Dimmable light Bulb: Bedroom North(8801023059f40b)

2017-12-30 15:11:11,034 INFO Found Unsupported Dimmable light Bulb: Bedroom East(88010208cf110b)

Link to comment
Share on other sites

I ended up having to completely delete and re-add the node....also and I don't know if this made any difference...I had a set of lights that I was not using so they were unreachable, I deleted all those lights from the hub prior to deleting and re-adding the node.  I don't know if it was somehow hanging on those unreachable lights and then everything below them in the search was just failing.

Link to comment
Share on other sites

Well, the problem was that I was looking for "Dimmable Light" and Hue reported "Dimmable light" (case difference), I've fixed that once I've seen your report. I do not have a pure dimmable bulb to test with, only tested with Extended Color and White Ambiance bulbs.

 

Unreachable bulbs should not affect the Node Server.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      36.5k
    • Total Posts
      367.6k
×
×
  • Create New...