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
200 stars 67 forks source link

it is possible to turn on lights - but it is not possible to turn lights off #334

Open dewenni opened 2 years ago

dewenni commented 2 years ago

Hi,

after updating Hue magic, it is not possible to turn lights off. Turning lights on is nor problem, but turning off did not work in my installation any more.

I have already deinstalled and installed Hue Magic node again. Then I have used the examples that are available from the "Import" function.

With this sample flow I can turn on any lamp, but I can't turn it off. The only thing that works for turning off is when I use Groups.

Any Ideas what could be the reason for that?

Node-Red: 2.2.2 Hue Magic: 4.1.0

andesse commented 2 years ago

@dewenni

Same, it actually started two days ago without doing an update for HueMagic. I just figured out just yet, that you need to set new user data for the Bridge.

Edit the user data in the Bridge node, get a new user ID with pressing the button on the Bridge and it works again.

dewenni commented 2 years ago

The new user is also no solution in my case.

I got also this message device (light) has communication issues, command (.on.on) may not have effect

But the light is working fine if I use the Hue app for example and also homebridge is working fine.

dewenni commented 2 years ago

I have now switched back to version 3.0.0 of hue-magic and everything is fine 🤷‍♂️

andesse commented 2 years ago

@dewenni i wrote it already in 2 issue posts. HIGHLY recommend the node-red-contrib-philipshue-events. This one talks directly with the API V2. It's unreal how many data you'll get from this one. You just need to figure out once the ids from you devices, by just trigger then and then switch out the commands you need. There is a datapoint for buttons "initial_press" that is around 1 second faster in your flow than the short_released. I completely removed all buttons and just use the data from these contrib. It also works for reply's of you lamps, grouped_lights flawless. It's so much faster. You just can't trigger things, that's what I still use HueMagic for. The combination of these two contribs is just great.

andesse commented 2 years ago

I have now switched back to version 3.0.0 of hue-magic and everything is fine 🤷‍♂️

That will be a problem in the future as hue will remove the V1 api at a time. Then this one might not work anymore. Better stick to the new concept. I am in the beta and developer community and it seems that the v1 will be not to long, when I got the announcements and comments in the forums right

TurboKanne commented 2 years ago

Hi, I had the same problem, that Groups/Rooms can't be turned off anymore and activating scenes got stuck. In that case getting a new user in the Function Node for the Bridge did not help. I used the Version 4.1.0 so far and today I upgraded to the latest Version 4.2.1 and it seems that everything is back to normal. Groups/Rooms can be turned on and turned off again and Scenes activate as expected.

dewenni commented 2 years ago

Its strange, but also 4.2.2 is not working for me. I have installed a test container of node-red with only hue-magic 4.2.2 and it is still the same. I can switch on the light, but I can't switch it off. But If I use groups - I can turn off the light. 🤷‍♂️

hue-magic

There is also a connectionStatus: "connectivity_issue" in the debug output. But hue magic 3.0.0 it is working and also homebridge works fine.

andesse commented 2 years ago

@dewenni just use directly http request to control your lights. I used this and it works flawless

https://github.com/Foddy/node-red-contrib-huemagic/issues/350#issuecomment-1079490002

MrTeal commented 2 years ago

@dewenni just use directly http request to control your lights. I used this and it works flawless

#350 (comment)

How do you do that in NodeRed?

edit: Never mind, found the comment you referred to, I'm missing the https-node thingy though. but would prefer to just have a fix for this from hue magic

andesse commented 2 years ago

@dewenni just use directly http request to control your lights. I used this and it works flawless

#350 (comment)

How do you do that in NodeRed?

edit: Never mind, found the comment you referred to, I'm missing the https-node thingy though. but would prefer to just have a fix for this from hue magic

You can use the normal one, described in the like too

ptweety commented 2 years ago

Hi @dewenni, do you have some experience with debugging node apps? If yes, you can try to attach a debugger and inspect the code of hue-light.js around

https://github.com/Foddy/node-red-contrib-huemagic/blob/1af6c29676c0cabd02f2cd1b105b95acff24d77f/huemagic/hue-light.js#L820-L832

Ref:

dewenni commented 2 years ago

I have figured out something interesting. Most of my Lamps are Osram Lightify and the issue is related to this lamps. The one lamp from Philips (Hue Play) and another from Paulmann (Maxled 500.46) is working also with the new version of Hue-magic.

So it seems that it is related to Osram devices!

Another interesting thing is, that the Osram devices are also marked as "Gerät nicht erreichbar / device not reachable" in the Philips Hue App at => Setting => Softwareupdate

But as said, they are working in general. Maybe the respond of the Osram devices are not fully compatible to the actual Philips Hue Bridge Version?

tmjnsn commented 2 years ago

I was having the same issue. Both with Hue lamps and with Ikea lamps. Both still worked with the Hue app and Google Home. The problem with Hue magic seems to somehow have resolved itself today.

ptweety commented 2 years ago

Hm, I also have only Hue and Ikea bulbs.

andesse commented 2 years ago

These are my flows, using only hue-events and https-requests. Works flawless. I just send the hue api v2 Events trough Switches, Filter out the things I need and send V2 https requests.

image

MrTeal commented 2 years ago

Hm, I also have only Hue and Ikea bulbs.

I only have Hue bulbs/ledstrips and the same issues.. Would be nice if this could get resolved within hue magic. If not I might have to dive into a setup that Andesse has.

andesse commented 2 years ago

Hm, I also have only Hue and Ikea bulbs.

I only have Hue bulbs/ledstrips and the same issues.. Would be nice if this could get resolved within hue magic. If not I might have to dive into a setup that Andesse has.

It’s also faster ;) … but took me a day to setup. Everything ist connected with link in / out nodes from and to my rooms

MrTeal commented 2 years ago

Hm, I also have only Hue and Ikea bulbs.

I only have Hue bulbs/ledstrips and the same issues.. Would be nice if this could get resolved within hue magic. If not I might have to dive into a setup that Andesse has.

It’s also faster ;) … but took me a day to setup. Everything ist connected with link in / out nodes from and to my rooms

Would you mind sharing an example how I can easily recreate this? I’m better at editing something existing then inventing the wheel myself 😊

andesse commented 2 years ago

Hm, I also have only Hue and Ikea bulbs.

I only have Hue bulbs/ledstrips and the same issues.. Would be nice if this could get resolved within hue magic. If not I might have to dive into a setup that Andesse has.

It’s also faster ;) … but took me a day to setup. Everything ist connected with link in / out nodes from and to my rooms

Would you mind sharing an example how I can easily recreate this? I’m better at editing something existing then inventing the wheel myself 😊

If you scroll up, I posted a comment (350) there is everything you need. You need to discover all unique ids to use it. Some ids out of HueMagic that show up in nodes might work, some need to discovered. You can do it by turning on / off lights, scenes, rooms, walk into a sensor, and check the payload of the philipshue-events node.

Here is a very easy flow with some examples, you need to change the ip etc and the ids of course :

[{"id":"882157f5.8ae2f8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"ac4c596.672c128","type":"change","z":"882157f5.8ae2f8","name":"Schlafen Gruppe aus","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"grouped_light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"3848a020-4497-4c01-90e3-f7edaa551cbe","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":false}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":335.8349609375,"y":252.0416717529297,"wires":[["15f9459.5f2973a"]]},{"id":"35fe3c41.0c26ac","type":"comment","z":"882157f5.8ae2f8","name":"Szene","info":"","x":290,"y":360,"wires":[]},{"id":"d4db24c6.3af2a","type":"comment","z":"882157f5.8ae2f8","name":"Raum","info":"","x":290,"y":220,"wires":[]},{"id":"15f9459.5f2973a","type":"function","z":"882157f5.8ae2f8","name":"HUE API V2 - Wohnung","func":"\n// you can copy the user from the hue config node\nvar user = \"---HIER KOMMT DER USER KEY REIN---\";\n\n\nif(msg.endpoint === undefined)\n msg.url = \"https://192.168.0.31/clip/v2/resource\";\nelse if(msg.topic === undefined)\n msg.url = \"https://192.168.0.31/clip/v2/resource/\" + msg.endpoint;\nelse\n msg.url = \"https://192.168.0.31/clip/v2/resource/\" + msg.endpoint + \"/\" + msg.topic;\n\n\nmsg.headers = {};\n\nmsg.headers['hue-application-key'] = user;\nmsg.headers['Content-Type'] = 'application/json';\nmsg.headers['Accept'] = 'application/json';\n\nif(msg.payload != undefined)\n msg.headers['ContentLength'] = JSON.stringify(msg.payload).length;\n\nif(msg.verb === undefined)\n msg.method = \"get\";\nelse\n msg.method = msg.verb;\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":480,"wires":[["fbee4bfb.4c10e8"]]},{"id":"dae3f7f5.5bb228","type":"change","z":"882157f5.8ae2f8","name":"SCHLAFEN TAG","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"scene","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"f83120d9-a7c4-4ec6-975d-a6112404e558","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"recall\": {\"action\": \"active\"}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":400,"wires":[["15f9459.5f2973a"]],"icon":"font-awesome/fa-star"},{"id":"a2484dfc.9631b8","type":"change","z":"882157f5.8ae2f8","name":"Leselampe An","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"light","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"c8a23b2f-b205-4f19-98ed-e694193c9458","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"on\":{\"on\":true}}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":520,"wires":[["15f9459.5f2973a"]]},{"id":"7b421962.0f3ec","type":"comment","z":"882157f5.8ae2f8","name":"Lampe","info":"","x":300,"y":480,"wires":[]},{"id":"d91b7623.97d83","type":"change","z":"882157f5.8ae2f8","name":"BM Arbeiten ein","rules":[{"t":"set","p":"endpoint","pt":"msg","to":"motion","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"83ffa5fb-876e-4885-8d12-9e04e46fc48c","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"{\"enabled\":true}","tot":"json"},{"t":"set","p":"verb","pt":"msg","to":"put","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":640,"wires":[["15f9459.5f2973a"]]},{"id":"61a82fbb.20e9c","type":"comment","z":"882157f5.8ae2f8","name":"Melder","info":"","x":310,"y":600,"wires":[]},{"id":"98cd2e41.ec022","type":"switch","z":"882157f5.8ae2f8","name":"Wohnen","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"58b37623-32c1-4b7e-89b9-2bb0679de9a3","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":600,"y":900,"wires":[["f9531d16.da54b8"]]},{"id":"800a66d6.51583","type":"comment","z":"882157f5.8ae2f8","name":"Switch for Buttons","info":"","x":630,"y":860,"wires":[]},{"id":"d5edce62.1b48c","type":"comment","z":"882157f5.8ae2f8","name":"Need to switched then for short_release etc","info":"","x":710,"y":940,"wires":[]},{"id":"3f58b5da.09e6e2","type":"switch","z":"882157f5.8ae2f8","name":"BM Schlafen","property":"payload.data.0.id","propertyType":"msg","rules":[{"t":"cont","v":"3b668baa-aa25-4e41-9d2d-ba7f0a335716","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":610,"y":800,"wires":[["16505dc1.f91532"]]},{"id":"10da423b.ad0b7e","type":"comment","z":"882157f5.8ae2f8","name":"Message Motion Sensor","info":"","x":650,"y":760,"wires":[]},{"id":"4249ec22.dd3b2c","type":"philipshue-events","z":"882157f5.8ae2f8","bridge":null,"x":320,"y":840,"wires":[["3f58b5da.09e6e2","98cd2e41.ec022"]]},{"id":"16505dc1.f91532","type":"debug","z":"882157f5.8ae2f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":800,"wires":[]},{"id":"f9531d16.da54b8","type":"debug","z":"882157f5.8ae2f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":900,"wires":[]},{"id":"d4d547fa.94ada8","type":"inject","z":"882157f5.8ae2f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":260,"wires":[["ac4c596.672c128"]]},{"id":"7ed53667.c9c5f8","type":"inject","z":"882157f5.8ae2f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":400,"wires":[["dae3f7f5.5bb228"]]},{"id":"ad609fd7.6a9f8","type":"inject","z":"882157f5.8ae2f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":520,"wires":[["a2484dfc.9631b8"]]},{"id":"5c042035.d0cc18","type":"inject","z":"882157f5.8ae2f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":640,"wires":[["d91b7623.97d83"]]},{"id":"fbee4bfb.4c10e8","type":"http request","z":"882157f5.8ae2f8","name":"https request HUE API V2","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"4bc31af9bd03bbdc","persist":false,"proxy":"","authType":"","x":690,"y":440,"wires":[[]]},{"id":"84d83615.f8caa8","type":"comment","z":"882157f5.8ae2f8","name":"No data needed in http node","info":"","x":700,"y":400,"wires":[]},{"id":"4bc31af9bd03bbdc","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]

MrTeal commented 2 years ago

Hmm, seem to get some json syntax errors, let me see if I can get them resolved.. Thanks for sharing anyway!

ptweety commented 2 years ago

Well, to explore all the resources of your Hue Bridge just use this flow:

[{"id":"060c172c7f7865d4","type":"inject","z":"88d7eed7ca3d10ac","name":"Resource","props":[{"p":"event","v":"__internal__","vt":"str"},{"p":"method","v":"GET","vt":"str"},{"p":"command","v":"resource","vt":"str"},{"p":"apiVersion","v":"2","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":"0.5","topic":"","x":305,"y":1180,"wires":[["77ef28c6346fbb26"]],"icon":"font-awesome/fa-question-circle","l":false},{"id":"77ef28c6346fbb26","type":"function","z":"88d7eed7ca3d10ac","name":"headers","func":"msg.ip = env.get('hue-bridge-ip');\n\nmsg.headers = {\n    'hue-application-key': env.get('hue-application-key')\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":1180,"wires":[["aa9ce271971213a0"]]},{"id":"aa9ce271971213a0","type":"http request","z":"88d7eed7ca3d10ac","name":"Hue API v2","method":"use","ret":"obj","paytoqs":"ignore","url":"https://{{{ip}}}/clip/v2/{{{command}}}","tls":"56879bcc1f459306","persist":false,"proxy":"","authType":"","senderr":false,"x":590,"y":1180,"wires":[["eecbd864bfa0ea3c"]]},{"id":"c23bf9a4d9b1e65c","type":"debug","z":"88d7eed7ca3d10ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":775,"y":1180,"wires":[],"l":false},{"id":"eecbd864bfa0ea3c","type":"change","z":"88d7eed7ca3d10ac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data{`type`: [$]}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":715,"y":1180,"wires":[["c23bf9a4d9b1e65c"]],"l":false},{"id":"56879bcc1f459306","type":"tls-config","name":"Hue Bridge","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false,"alpnprotocol":""}]

and set some environment vars to your flow:

Bildschirmfoto 2022-04-06 um 13 50 56
MrTeal commented 2 years ago

So ptweety's flow I can import and idd list all resources from Hue. But I cannot seem to get your example flow working correctly. I managed to create an importable JSON from it, but still no luck. So I thought I might be able to merge the 2. using ptweety's flow I took the bedroom light and added it to the insert node. (see flow below).

But then I get Invalid JSON when clicking the request. Perhaps this is a bit too much programming/coding for me.

[
    {
        "id": "060c172c7f7865d4",
        "type": "inject",
        "z": "9ce4e1fc959d8023",
        "name": "Resource",
        "props": [
            {
                "p": "event",
                "v": "__internal__",
                "vt": "str"
            },
            {
                "p": "method",
                "v": "GET",
                "vt": "str"
            },
            {
                "p": "command",
                "v": "resource",
                "vt": "str"
            },
            {
                "p": "apiVersion",
                "v": "2",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "0.5",
        "topic": "",
        "x": 155,
        "y": 80,
        "wires": [
            [
                "77ef28c6346fbb26"
            ]
        ],
        "icon": "font-awesome/fa-question-circle",
        "l": false
    },
    {
        "id": "77ef28c6346fbb26",
        "type": "function",
        "z": "9ce4e1fc959d8023",
        "name": "headers",
        "func": "msg.ip = env.get('hue-bridge-ip');\n\nmsg.headers = {\n    'hue-application-key': env.get('hue-application-key')\n};\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 270,
        "y": 80,
        "wires": [
            [
                "aa9ce271971213a0"
            ]
        ]
    },
    {
        "id": "aa9ce271971213a0",
        "type": "http request",
        "z": "9ce4e1fc959d8023",
        "name": "Hue API v2",
        "method": "use",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://{{{ip}}}/clip/v2/{{{command}}}",
        "tls": "56879bcc1f459306",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 440,
        "y": 80,
        "wires": [
            [
                "eecbd864bfa0ea3c"
            ]
        ]
    },
    {
        "id": "c23bf9a4d9b1e65c",
        "type": "debug",
        "z": "9ce4e1fc959d8023",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 625,
        "y": 80,
        "wires": [],
        "l": false
    },
    {
        "id": "eecbd864bfa0ea3c",
        "type": "change",
        "z": "9ce4e1fc959d8023",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.data{`type`: [$]}",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 565,
        "y": 80,
        "wires": [
            [
                "c23bf9a4d9b1e65c"
            ]
        ],
        "l": false
    },
    {
        "id": "40c2f89746675c92",
        "type": "inject",
        "z": "9ce4e1fc959d8023",
        "name": "Schlafzimmer ON",
        "props": [
            {
                "p": "endpoint",
                "v": "grouped_light",
                "vt": "str"
            },
            {
                "p": "topic",
                "vt": "str"
            },
            {
                "p": "payload"
            },
            {
                "p": "verb",
                "v": "put",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "661b2302-2be1-4143-a74e-9a15edf0d23e",
        "payload": "{\"on\":{\"on\":true}}",
        "payloadType": "json",
        "x": 120,
        "y": 180,
        "wires": [
            [
                "77ef28c6346fbb26"
            ]
        ]
    },
    {
        "id": "56879bcc1f459306",
        "type": "tls-config",
        "name": "Hue Bridge",
        "cert": "",
        "key": "",
        "ca": "",
        "certname": "",
        "keyname": "",
        "caname": "",
        "servername": "",
        "verifyservercert": false,
        "alpnprotocol": ""
    }
]
ptweety commented 2 years ago

@MrTeal:

your inject node should be like this:

[{"id":"dae91c25821b9ad4","type":"inject","z":"88d7eed7ca3d10ac","name":"Schlafzimmer ON","props":[{"p":"resource","v":"grouped_light","vt":"str"},{"p":"id","v":"661b2302-2be1-4143-a74e-9a15edf0d23e","vt":"str"},{"p":"payload"},{"p":"method","v":"put","vt":"str"},{"p":"command","v":"'resource/' & resource & '/' & id","vt":"jsonata"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"on\":{\"on\":true}}","payloadType":"json","x":390,"y":1520,"wires":[["64520a8d94126124"]]}]

BTW: please use code tags for your example json

EDIT: Ups, I should better test. Have fixed the json ...

MrTeal commented 2 years ago

Thanks @ptweety , this works indeed. I guess I'll use this to turn off grouped lights for now.. For turning them on I would need to see how I can send brightness, color etc in the turn on command using the hue-magic-nodes.

[{"id":"86c1b859c0063d0d","type":"function","z":"94d30fab94a3d234","name":"BrightRandomColor","func":"let array = ['aquamarine', 'gold', 'lime', 'yellow', 'tan', 'azure', 'snow', 'aqua'];\n\nmsg.payload = array[Math.floor(Math.random() * array.length)];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1680,"y":260,"wires":[["52fd378416dcc7f7"]]},{"id":"b4441b4f9aa8af65","type":"function","z":"94d30fab94a3d234","name":"RandomColor","func":"let array = ['aquamarine', 'gold', 'lime', 'yellow', 'tan', 'cyan', 'violet', 'green', 'azure', 'snow', 'aqua'];\n\nmsg.payload = array[Math.floor(Math.random() * array.length)];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1680,"y":300,"wires":[["1dba1bc88a366e61"]]},{"id":"52fd378416dcc7f7","type":"change","z":"94d30fab94a3d234","name":"Send On Signal RandomColor 80","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t   \"on\":true,\t   \"brightness\":80,\t   \"color\": $.payload\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1960,"y":260,"wires":[["ae747b95d25baad2"]]},{"id":"1dba1bc88a366e61","type":"change","z":"94d30fab94a3d234","name":"Send On Signal RandomColor 60","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t   \"on\":true,\t   \"brightness\":60,\t   \"color\": $.payload\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1960,"y":300,"wires":[["ae747b95d25baad2"]]}]

EDIT: ah wait, I think I can just add them to the change node!

msmthng commented 2 years ago

any updates on that issue? I have also the issue that the nodes turning to "executing command" after a while only assigning a new user solves the issue. I don't really want to change the whole setup.

andesse commented 2 years ago

@msmthng depending on how many lights yam devices you have, it takes like 1-3 hours. With the new discovering flow you get all data you need in formated text with one click.

msmthng commented 2 years ago

@andesse how do you suggest to turn on/off lights from node-red i don't like the approach to send http request like suggested in this thread. but the solution needs to be stable. at the moment after some days some (node red controlled) switches are not able to control lights anymore.

thanks

andesse commented 2 years ago

@msmthng http request comes from the official api. Every app on the market sends http requests to the bridge. You could create a developer account at hue and have a look into the api documentation. If the bridge get the http request it sends the data over zigbee to the devices. http request is the most stable solution, cause you directly talk to the bridge like hue designed it. Huemagic is parsing all the data in the background also to a http request.

edit: and the parsing has errors. That’s everyone’s problem here

msmthng commented 2 years ago

@andesse Maybe you are right on using the event node how you are filtering the events for a specific device? the example you have posted above isn't a valid json do you have valid json from that? thx

andesse commented 2 years ago

@msmthng thats probably a copy past error. You can find my repository here: https://github.com/andesse/hue-clip-api.node-red-flows

Please read instructions first. In the Flow are Labels with further instructions.

msmthng commented 2 years ago

@andesse maybe you are right that this is the more stable approach and excluding a complex parsing layer in between.

andesse commented 2 years ago

@msmthng let me know how the setup was going. Interested in feedback. I am pretty sure it was not too complicated to setup. Probably you’ll recognize that controlling the lights is faster. Let me know what you think. After it is setup I’m pretty sure that you’ll be proud of yourself. Got some feedback like that

andesse commented 2 years ago

@msmthng did you delete a comment? 404 is not available. Device is wrong or ip wrong in the other node.

msmthng commented 2 years ago

@andesse i deleted the comment because i found the issue when i saw my post, i was using device instead of lights. as you said the reaction of lamps is much faster (since it is one layer less). of course it is not that comfortable to select lights because you have to search for the ids in the result. I have to check out now the handling of events.

andesse commented 2 years ago

@andesse i deleted the comment because i found the issue when i saw my post, i was using device instead of lights. as you said the reaction of lamps is much faster (since it is one layer less). of course it is not that comfortable to select lights because you have to search for the ids in the result. I have to check out now the handling of events.

@msmthng with the so called helper flow you can search for app names off your lights. I found it easy and fast. the event handling uses the sub-flows that you can directly get true / false. You just need to add the ID in the node before. You can do it in a different way, but this just works.