bkorda / node-red-contrib-zway

GNU General Public License v3.0
5 stars 4 forks source link

Send data do Z-way out #7

Open Tomasz01 opened 3 years ago

Tomasz01 commented 3 years ago
Zrzut ekranu 2020-09-10 o 12 47 43

I have a problem with sending RGB data to node out device Fibaro FGRGBW-442 (class Switch Color). Device command is RGB(rrr,ggg,bbb). Im testing many combnination of data formats:

I have no more ideas.

PS. No problem with sending value to other class the same device, e.g Dimmer 1.

isMnemonic commented 3 years ago

I believe this is caused by the URL not being correct. I have tested the API and it sets the color correctly and there is no logging from this node so hard to tell how the URL actually looks like.

I would also suggest that this node supports the color picker format rgb(xxx,yyy,zzz) natively e.g. one does not need to remove the rgb() from msg.payload. Btw, Thanks for awesome work!

isMnemonic commented 3 years ago

I made this as a workaround for anyone whom is struggle with this.

[{"id":"7c4d9ac2.b47ba4","type":"ui_colour_picker","z":"faa1e54c.15b5d8","name":"","label":"","group":"f8a7d3a9.2542","format":"rgb","outformat":"string","showSwatch":true,"showPicker":false,"showValue":false,"showHue":false,"showAlpha":false,"showLightness":true,"square":"false","dynOutput":"false","order":3,"width":0,"height":0,"passthru":true,"topic":"","x":420,"y":420,"wires":[["54d3b81b.e533c8"]]},{"id":"54d3b81b.e533c8","type":"function","z":"faa1e54c.15b5d8","name":"","func":"var input = msg.payload;\nvar path = \"exact?red=r&green=g&blue=b\"\nvar res = input.replace(\"rgb(\", \"\");\nres = res.replace(\")\", \"\");\nlet result = res.split(\",\", 3);\npath = path.replace(\"red=r\", \"red=\"+result[0]);\npath = path.replace(\"green=g\", \"green=\"+result[1]);\npath = path.replace(\"blue=b\", \"blue=\"+result[2]);\npath = path.replace(\" \", \"\");\npath = path.replace(\" \", \"\");\nvar url = \"http://(ip):(port)/ZAutomation/api/v1/devices/(deviceid)/command/\"\nmsg.payload = url+path;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":420,"wires":[["3f274630.33ba0a"]]},{"id":"3f274630.33ba0a","type":"change","z":"faa1e54c.15b5d8","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":420,"wires":[["6d538fc8.8b4ef"]]},{"id":"6d538fc8.8b4ef","type":"http request","z":"faa1e54c.15b5d8","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"basic","x":1130,"y":420,"wires":[[]]},{"id":"f8a7d3a9.2542","type":"ui_group","name":"Lamp (#50)","tab":"5a2c6a3b.ef7054","order":1,"disp":true,"width":"6","collapse":false},{"id":"5a2c6a3b.ef7054","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

bkorda commented 3 years ago

Hi guys, sorry for delay. Unfortunately I can't fix it now because my hardware is broken. Maybe someone can make a pull request?

isMnemonic commented 3 years ago

Hi guys, sorry for delay. Unfortunately I can't fix it now because my hardware is broken. Maybe someone can make a pull request?

Thanks for the reply bkorda, I would like to try but my programming skills in Node-RED isn´t that great yet =) I have posted the workaround I have for the moment. When i have implemented more of the flows i need, i could try =)

bkorda commented 2 years ago

Will try to fix it, but have no device.