jdomeij / node-red-contrib-node-hue

Node RED nodes for controlling Philips Hue lights
Apache License 2.0
17 stars 8 forks source link

No connection to bridge without internet access #1

Closed tedstriker closed 7 years ago

tedstriker commented 7 years ago

if your node is not able to connect to meethue.com it seems not to work. Even if a valid IP has been provided in the config node, the getter node doesn't receive a thing and its state remains "unknown".

It'd be good, if a valid IP is present, it would try to connect to that bridge.

getter_node
jdomeij commented 7 years ago

Hmmm during devel I test it without Node-RED having access to internet, and it works.

Two things I'm wondering about:

  1. If you go to the Hub configuration and press the button after "API key" field, does it say that the API key is valid? I see that the configuration doesn't require the key field to be supplied, I will add better error handling in the future.

  2. If the above works and you got the output node and press the search icon behind the "Light ID" field does it list all the lights? And does it resolve a light to your current id, or does it say Unknown "1"?

tedstriker commented 7 years ago

Upfront it's working now - even without an internet connection. Maybe it started working due to a node red restart. I could just guess. To answer your questions:

  1. It still says the bridge isn't reachable, but it's working. The API key is valid. That's what I see when I push both buttons. I tried to use a made up API key and it responded properly that it's not valid, so the bridge has to be reachable at this point already. messages
  2. The "1" in the lights node was the leftover after allowing internet access for the bridge temporarily. The bridge was reachable at that time and the names resolved properly. Not knowing what values to expect, "1" was the value being stored inside the node. After reselecting the light id when the bridge was reachable (even if stated otherwise by the discovery function), it stored the value "light1" and everything's working fine. Before it said indeed "Unknown 1".

So if you're about to investigate on the discovery function we can leave this open as reminder. I'd consider the initial stated "No connection ..." issue rather a glitch than a real issue as it's obviously doing it's job now.

Thank you for your quick response and investigation

jdomeij commented 7 years ago

The problem was probably that you tried to use "1" as the ID, I'm going to beef up the validation so the node will generate an error earlier (force the id to begin with "light" or "group"). I also probably could generate warning when there is an configured light that doesn't exist in the hub

The status text "unknown" isn't really clear, was thinking of changing it to maybe "undetected" or "unidentified".

jdomeij commented 7 years ago

Work has been done fix most of the short commings described in this issue