Foddy / 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
Apache License 2.0
201 stars 67 forks source link

Self-Signed Certificate of the Huebridge (rectangle) Error message #436

Open rsch90 opened 1 year ago

rsch90 commented 1 year ago

Describe the bug A clear and concise description of what the bug is. I am using the rectangle Bridge and since a couple of days I see the following entries in the Node-Red Log:

25 Jun 14:20:36 - [info] [hue-bridge:Huebridge] Initializing the bridge (192.168.50.53)… 25 Jun 14:20:37 - [info] [hue-bridge:Huebridge] Error: self signed certificate

This leads to the Node does not work as desired. It only shows "connecting..." nothing more. I had this running earlier. But something broke this.

Flow to Reproduce

[
    {
        "id": "de63398919a2eaab",
        "type": "hue-bridge-node",
        "z": "abd3699b43c72ae4",
        "name": "",
        "bridge": "bc8d4785237d1937",
        "autoupdates": true,
        "skipglobalevents": false,
        "initevents": false,
        "x": 1130,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "bc8d4785237d1937",
        "type": "hue-bridge",
        "name": "Huebridge",
        "bridge": "xxx.xxx.xxx.xxx",
        "key": "removed due to security",
        "worker": "10",
        "autoupdates": true,
        "disableupdates": false
    }
]

Expected behavior At least a switcht to aknowledge Self-Signed and ignore the Certificate error. Or at least switcht to http instead of https. As this is all local this should be fine.

Screenshots https://imgur.com/a/LdetQRa

Please complete the following information:

rsch90 commented 1 year ago

I did some research on my own based on what I found in the Code. Based on Information from here there are certain Bridges that currently run with a self-signed certificate an others with a valid certificate issued by signify.

You can find my modifications within the attached api.js file. I added row 5+6 and did changes on row 33 and 67 From my understanding you can provide to the https.Agent a specific CA File to be used for the request. This is what I am doing. With this modification I was able to use the Node again :)

As I am not an experienced JS developer I leave this to you how to implement it in a proper way to the Node. api.zip