mauricedominic / node-red-contrib-huemagic

Philips Hue node to control bridges, lights, groups, motion sensors, temperature sensors and Lux sensors using Node-RED.
https://flows.nodered.org/node/node-red-contrib-huemagic-fork
Apache License 2.0
19 stars 3 forks source link

Hue Bridge doesn't connect anymore #3

Closed Stianker1 closed 1 year ago

Stianker1 commented 1 year ago

Describe the bug After a succesfull setup of the brigde. Hue Magic fork doesn't connect. It hangs on connecting.

It started after I updated to 4.2.6

I tryed to get an new api key. It is send back by the bridge correctly.

Also sometimes I get an timeout error if I open the bridge setup screen

If I open te Light list an error is displayed: "Something went wrong. Please retry."

If I try an configured light. The following texts is display in the debug screen: "The light in not yet available. Please wait until HueMagic has established a connection with the bridge or check whether the resource ID in the configuration is valid."

Node-RED version: 3.0.2 NodeJS version: [v18.14.0] Device running Node-RED: Raspberry pi 400

cortado commented 1 year ago

same here! tried to swith to huemaghic-fork, same result.

mauricedominic commented 1 year ago

To be able to debug this can you provide me with any further info, such as:

Thanks!

Stianker1 commented 1 year ago

Im running on Linux 11 (bullseye)

Log info says : [hue-bridge: Phillips hue] initializing the bridge (192.168.86.194) [hue-bridge: Phillips hue] Error: unable to verify the first certificate.

I have never experiaced it before.

Part of the flow below

[{"id":"7adffbfb803c9755","type":"group","z":"a5601c83d0a4d401","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["7cd0b6d60585383b","26c59ee8973ff64f","9e22aece82971590","6cc42728d8a2009e","1cc573443e8c4560","7f1291eafac57cb3","caadbc79526f7d65","c6f616a17e4b8683","b4de35d208b74c9b","572336df018cc972","6160e039aaf52476","76694b425824310f","379fa590fecd0c17","986e79762e0688cd","a157d71d87d5efad","afd8cd49b7ed09e5","8d828ce8a7225eae","cb6a5bbd34f01b8e","525bfd1e5ec36e26","0bd636ce45bf2716","1cc573443e8c4560"],"x":34,"y":19,"w":812,"h":282},{"id":"7cd0b6d60585383b","type":"hue-light","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Skjenk Lampe","bridge":"fc7b0ef49c126501","lightid":"86a8e79c-283e-4252-b1a2-2cea021ed6f3","colornamer":true,"skipevents":false,"initevents":false,"x":740,"y":60,"wires":[[]]},{"id":"26c59ee8973ff64f","type":"hue-light","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Gulv Lampe","bridge":"fc7b0ef49c126501","lightid":"93856723-bdb3-4455-a875-97978e0f3b65","colornamer":true,"skipevents":false,"initevents":false,"x":750,"y":140,"wires":[[]]},{"id":"9e22aece82971590","type":"hue-light","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Bordlampe","bridge":"fc7b0ef49c126501","lightid":"e291dce8-ee48-4693-93bb-de07905a4149","colornamer":true,"skipevents":false,"initevents":false,"x":750,"y":180,"wires":[[]]},{"id":"6cc42728d8a2009e","type":"comment","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"God Natt","info":"","x":120,"y":60,"wires":[]},{"id":"1cc573443e8c4560","type":"hb-control","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Spisebord","Homebridge":"homebridge","Manufacturer":"Namron AS","Service":"Lightbulb","device":"homebridge0E:6B:02:37:29:01Namron ASSpisebord00000043","conf":"edd8cac8b3fc0ce7","outputs":0,"x":720,"y":100,"wires":[]},{"id":"7f1291eafac57cb3","type":"function","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Extract","func":"p = msg.payload.Brightness;\nmsg.payload = p;\nreturn msg;","outputs":1,"noerr":0,"initialize":"\n","finalize":"","libs":[],"x":180,"y":120,"wires":[["caadbc79526f7d65","c6f616a17e4b8683","b4de35d208b74c9b","afd8cd49b7ed09e5","8d828ce8a7225eae"]]},{"id":"caadbc79526f7d65","type":"function","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"OFF","func":"p = msg.payload;\n\nif (p == 40)\n{\n msg.payload = { \"on\": false};\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":80,"wires":[["572336df018cc972","379fa590fecd0c17"]]},{"id":"c6f616a17e4b8683","type":"function","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"OFF","func":"p = msg.payload;\n\nif (p == 40)\n{\n msg.payload = { \"On\": 0 };\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":120,"wires":[["76694b425824310f","986e79762e0688cd"]]},{"id":"b4de35d208b74c9b","type":"function","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"OFF","func":"p = msg.payload;\n\nif (p == 40)\n{\n msg.payload = { \"Brightness\": 0, \"On\": false };\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":160,"wires":[["a157d71d87d5efad"]]},{"id":"572336df018cc972","type":"delay","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"","pauseType":"delay","timeout":"300","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":530,"y":80,"wires":[["9e22aece82971590","6160e039aaf52476"]]},{"id":"6160e039aaf52476","type":"delay","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"","pauseType":"delay","timeout":"300","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":530,"y":120,"wires":[["26c59ee8973ff64f"]]},{"id":"76694b425824310f","type":"delay","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"","pauseType":"delay","timeout":"1050","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":540,"y":160,"wires":[["1cc573443e8c4560"]]},{"id":"379fa590fecd0c17","type":"delay","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"","pauseType":"delay","timeout":"1150","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":540,"y":200,"wires":[["7cd0b6d60585383b"]]},{"id":"986e79762e0688cd","type":"hb-control","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Stue Sofalampe ","Homebridge":"homebridge","Manufacturer":"IKEA","Service":"Lightbulb","device":"homebridge0E:D4:68:EF:5C:59IKEAStue Sofalampe 00000043","conf":"edd8cac8b3fc0ce7","outputs":0,"x":740,"y":220,"wires":[]},{"id":"a157d71d87d5efad","type":"delay","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":520,"y":240,"wires":[["4feba04b1934998e"]]},{"id":"afd8cd49b7ed09e5","type":"link out","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Natta ","mode":"link","links":["499e24f631e24490"],"x":225,"y":60,"wires":[]},{"id":"8d828ce8a7225eae","type":"function","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Med","func":"p = msg.payload;\n\nif (p == 40)\n{\n msg.payload = { \"RotationSpeed\": 65 };\nreturn msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":240,"wires":[["0bd636ce45bf2716"]]},{"id":"cb6a5bbd34f01b8e","type":"hb-control","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Stue AC","Homebridge":"homebridge","Manufacturer":"Sensibo Inc.","Service":"Heater Cooler","device":"homebridge0E:15:90:A3:6A:3CSensibo Inc.Stue AC000000BC","conf":"edd8cac8b3fc0ce7","outputs":0,"x":720,"y":260,"wires":[]},{"id":"525bfd1e5ec36e26","type":"cronplus","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","name":"Vifte Hastighet","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"Medium All Week","topic":"50%","payloadType":"json","payload":"{ \"RotationSpeed\": 50 }","expressionType":"cron","expression":"0 01 00 ? ","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise,sunset"},{"name":"Medium_High Weekdays","topic":"65%","payloadType":"json","payload":"{ \"RotationSpeed\": 65}","expressionType":"cron","expression":"0 01 08 ? 01-05 ","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"High All Week","topic":"83%","payloadType":"json","payload":"{ \"RotationSpeed\": 83}","expressionType":"cron","expression":"0 01 06 ? ","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"High Weekdays","topic":"83%","payloadType":"json","payload":"{ \"RotationSpeed\": 83}","expressionType":"cron","expression":"0 31 14 ? 01-05 ","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":180,"y":260,"wires":[["cb6a5bbd34f01b8e"]]},{"id":"0bd636ce45bf2716","type":"junction","z":"a5601c83d0a4d401","g":"7adffbfb803c9755","x":440,"y":260,"wires":[["cb6a5bbd34f01b8e"]]},{"id":"fc7b0ef49c126501","type":"hue-bridge","name":"Philips hue","bridge":"192.168.86.194","key":"hTMCz34Lki7a-Ufx0XCYJxPcnfVfWlMfA-FoNNnN","worker":"10","autoupdates":true,"disableupdates":false},{"id":"edd8cac8b3fc0ce7","type":"hb-conf","username":"269-11-246","macAddress":"e4:5f:01:48:cc:47"}]

Stianker1 commented 1 year ago

Node red is installed on raspberry pi that is running homebridge. I also have a virtuel machine running home assistant. Installed node red there also, but still no connection to fork. The bridge is connected to both homebridge and home assistant and working as it should. So i dont think it is a problem with the hue hub.

I see that the hub updated it self 6 feb. Do you think the problem is with the new update?

The hue magic fork has been working flawless for the last year, since i first installed it.

Best regards, Stian

cortado commented 1 year ago

To be able to debug this can you provide me with any further info, such as:

  • Operating system you are running Node-Red on?
  • Any log file you can provide with the errors that are generated?
  • If you experienced similar behavior in a prior version of node-red-contrib-huemagic-fork?
  • Does this only occur on a particular flow / node being used?
  • If possible can you share your flow where the bug occurs?

Thanks!

Latest HASSIO on RPI3B+. This is a general error: it cannot get data from bridge, to any node. It is possible to set up connection and get new key/user, but after it returns np data from bridge – altså the name of the bridge is set to [object Object], when you make one. You can change it, but upon trying to ǵet data from bridge it is reset. Seems like these errors where flooding my NR, so I uninstalled Huemagic. Would very much like to have it back, because it delivers something HA does not!

mauricedominic commented 1 year ago

Error: unable to verify the first certificate.

I have never experiaced it before.

Can you verify what version of axios you have installed?

mauricedominic commented 1 year ago

To be able to debug this can you provide me with any further info, such as:

  • Operating system you are running Node-Red on?
  • Any log file you can provide with the errors that are generated?
  • If you experienced similar behavior in a prior version of node-red-contrib-huemagic-fork?
  • Does this only occur on a particular flow / node being used?
  • If possible can you share your flow where the bug occurs?

Thanks!

Latest HASSIO on RPI3B+. This is a general error: it cannot get data from bridge, to any node. It is possible to set up connection and get new key/user, but after it returns np data from bridge – altså the name of the bridge is set to [object Object], when you make one. You can change it, but upon trying to ǵet data from bridge it is reset. Seems like these errors where flooding my NR, so I uninstalled Huemagic. Would very much like to have it back, because it delivers something HA does not!

Can you provide me the log with errors?

Stianker1 commented 1 year ago

Error: unable to verify the first certificate. I have never experiaced it before.

Can you verify what version of axios you have installed?

I dont know what axios is. how can i see what version i have, if i have it?

mauricedominic commented 1 year ago

huemagic has a dependency on it. You can find the version out by running the command: npm list axios

Stianker1 commented 1 year ago

Axios version 0.21.4

osvedman commented 1 year ago

My Hue Bridge node just hangs at "Connecting..." forever.

In the Node-RED log file, it says: [info] [hue-bridge:[object Object]] Error: unable to verify the first certificate

It used to work fine until Feb 8, 2022. Restarting Node-RED or Raspberry Pi doesn't help. Restarting the physical Hue bridge didn't help. Deleting Hue node configuration and re-creating it does not help either. Hue works fine using the Hue switches and the Hue Android app, so there's nothing wrong with the physical Hue bridge.

Hue Bridge firmware version: 1.56.1956046040 Axios: 1.2.1 Node-RED version: 3.0.2 NodeJS version: 16.19.0 Device running Node-RED: Raspberry Pi 4

osvedman commented 1 year ago

OK, so I think this issue has something to do with certificates being broken on the Raspberry Pi for some reason.

As a workaround, I can get this node to work again by adding the following code in settings.js file. Before the module.exports line:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

cortado commented 1 year ago

Yes, there was a pile of error message in Node Red logs related to connecting to HUE Bridge (which I unfortunately deleted): "Error on first certificate", or something like that

Stianker1 commented 1 year ago

Osvedman, how do i access settings.js? Cant figure it out.

osvedman commented 1 year ago

@Stianker1 https://nodered.org/docs/user-guide/runtime/settings-file

cortado commented 1 year ago

OK, so I think this issue has something to do with certificates being broken on the Raspberry Pi for some reason.

As a workaround, I can get this node to work again by adding the following code in settings.js file. Before the module.exports line:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

THIS WORKS!

(until Node Red addon update I guess...)