Page 5 of 12

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Wednesday 12 February 2020 17:41
by waaren
salvacalatayud wrote: Tuesday 11 February 2020 19:26 Is there any way to add temperature and thermostat setpoint to your script?
Yes but not very easy and the next update of the temperatures will send the new MQTT message anyway so would there be an added value ?

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Wednesday 12 February 2020 17:45
by salvacalatayud
waaren wrote: Wednesday 12 February 2020 17:41
salvacalatayud wrote: Tuesday 11 February 2020 19:26 Is there any way to add temperature and thermostat setpoint to your script?
Yes but not very easy and the next update of the temperatures will send the new MQTT message anyway so would there be an added value ?
Yes, it works, no problem

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Wednesday 12 February 2020 17:47
by FireWizard
This post will show the flow and a short description.

Screenshot_MiLight_flow1.png
Screenshot_MiLight_flow1.png (19.88 KiB) Viewed 2575 times
The input to the json node comes from the MQTT input node, which has subscribed to domoticz/out.
No changes are required for this node.
The node, called "Filter Dimmer" filters all topics, which are not a Dimmer. You might want to change that, but as long as you use the same hardware it is not required.
In order to convert RGB values to HSV values, I created a function node that arranges the RGB values, so that the RGB>HSV node can convert it.
For both nodes, no changes are required.

The output of the RGB>HSV convert node is joined with the original flow.
No changes for the join node are required.
The next node is a Function node, that prepares the data, so that the nora node can handle it.
No changes are required.

The next node before the nora node is the switch node.
You have to configure, as many outputs, as you have MiLight lamps and give them your IDX numbers, so that they are routed to the correct nora node.

Regarding the nora node, you should configure it to your need with the right topic (IDX number) and tick all the boxes, except "If msg arrives on input, pass through to output:"

If everything is correctly configured, it is possible to control the nora node from Domoticz.
You will see that in the text below the node.

Screenshot_MiLight_nora.png
Screenshot_MiLight_nora.png (8.6 KiB) Viewed 2575 times

Next step is the right side of the nora node. The output to Domoticz.

Screenshot_MiLight_flow2.png
Screenshot_MiLight_flow2.png (23.57 KiB) Viewed 2575 times
From the nora node we have to change the HSV values back to RGB values.
So in order to convert HSV values to RGB values, I created a function node that arranges the HSV values, so that the HSV>RGB node can convert it.
For both nodes, no changes are required. Be aware that the box after "Scale Sat/Bri/Val" is ticked.

The output of the HSV>RGB convert node is joined with the original flow.
No changes for the join node are required.

The next node is a Function node, that prepares the data, so that Domoticz can handle it.
No changes are required.
Finally we go to a the json node and the output connects to the MQTT output node, which has subscribed to domoticz/in.
No changes are required for this node.

Feel free to implement it and to test it with real MiLight.

Best regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Wednesday 12 February 2020 17:52
by FireWizard
Please find attached the flow:

Code: Select all

[{"id":"8b9fe124.3e6fb8","type":"nora-light","z":"f01779c8.cd1ec","devicename":"Slaapkamerlamp","lightcolor":true,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Slaapkamer","name":"Slaapkamerlamp","nora":"6f52ea33.833a2c","topic":"332","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1150,"y":780,"wires":[["73400cd3.d7c65c","9961fafb.4f1698"]]},{"id":"170e5319.3f606d","type":"json","z":"f01779c8.cd1ec","name":"","property":"payload","action":"","pretty":false,"x":150,"y":780,"wires":[["2528055.8fdd3fa"]]},{"id":"bd209b8.55e9b68","type":"function","z":"f01779c8.cd1ec","name":"Function In ","func":"msg.topic = msg.payload[0].idx;\nif (msg.payload[0].nvalue !== 0)\n{\n    msg.payload = {\n        on : true,\n        brightness : msg.payload[0].Level,\n        color : {\n            spectrumHsv : {\n                hue : msg.payload[1].red,\n                saturation : msg.payload[1].green/100,\n                value : msg.payload[1].blue/100\n            }\n        }\n    }\n}\nelse if (msg.payload[0].nvalue === 0)\n{\n    msg.payload = {\n        on : false,\n        brightness : msg.payload[0].Level,\n        color : {\n            spectrumHsv : {\n                hue : msg.payload[1].red,\n                saturation : msg.payload[1].green/100,\n                value : msg.payload[1].blue/100\n            }\n        }\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":780,"wires":[["3fd178cf.d784"]]},{"id":"3fd178cf.d784","type":"switch","z":"f01779c8.cd1ec","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"1170","vt":"str"},{"t":"eq","v":"1171","vt":"str"},{"t":"eq","v":"1172","vt":"str"},{"t":"eq","v":"332","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":910,"y":780,"wires":[[],[],[],["8b9fe124.3e6fb8"]]},{"id":"c678f72c.24a2c8","type":"function","z":"f01779c8.cd1ec","name":"Function Out","func":"var idx = parseInt(msg.topic);\nif ( msg.payload[0].on === true )\n{\n    msg.payload = {\n        \"command\" : \"setcolbrightnessvalue\",\n        \"idx\" : idx,\n        \"color\" : {\"m\":3,\"t\":0,\"r\":msg.payload[1].red,\"g\":msg.payload[1].green,\"b\":msg.payload[1].blue,\"cw\":0,\"ww\":0},\n        \"brightness\": msg.payload[0].brightness\n    };\n}\nelse if ( msg.payload[0].on === false )\n{\n    msg.payload = {\n        \"command\": \"switchlight\",\n        \"idx\": idx,\n        \"switchcmd\": \"Off\"\n        \n    };\n}\nreturn msg","outputs":1,"noerr":0,"x":1560,"y":780,"wires":[["20adf7d9.b1ec7"]]},{"id":"20adf7d9.b1ec7","type":"json","z":"f01779c8.cd1ec","name":"","property":"payload","action":"","pretty":false,"x":1750,"y":780,"wires":[["c14522c5.76fc68"]]},{"id":"c14522c5.76fc68","type":"debug","z":"f01779c8.cd1ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1930,"y":780,"wires":[]},{"id":"a9526656.b39dc8","type":"color-convert","z":"f01779c8.cd1ec","input":"rgb","output":"hsv","outputType":"object","scaleInput":false,"x":570,"y":840,"wires":[["6d505be6.981bac"]]},{"id":"2528055.8fdd3fa","type":"filter","z":"f01779c8.cd1ec","name":"Filter Dimmer","property":"payload.switchType","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"eq","v":"Dimmer","vt":"str","output":1}],"checkall":"true","outputs":1,"x":340,"y":780,"wires":[["963f3ce8.6fbc1","6d505be6.981bac"]]},{"id":"963f3ce8.6fbc1","type":"function","z":"f01779c8.cd1ec","name":"Create RGB Array","func":"msg.payload = {\n    red : msg.payload.Color.r,\n    green : msg.payload.Color.g,\n    blue : msg.payload.Color.b\n};\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":840,"wires":[["a9526656.b39dc8"]]},{"id":"6d505be6.981bac","type":"join","z":"f01779c8.cd1ec","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":780,"wires":[["bd209b8.55e9b68"]]},{"id":"49751c0a.4c20b4","type":"color-convert","z":"f01779c8.cd1ec","input":"hsv","output":"rgb","outputType":"object","scaleInput":true,"x":1370,"y":840,"wires":[["9961fafb.4f1698"]]},{"id":"73400cd3.d7c65c","type":"function","z":"f01779c8.cd1ec","name":"Create HSV Array","func":"msg.payload = {\n    hue : msg.payload.color.spectrumHsv.hue,\n    saturation : msg.payload.color.spectrumHsv.saturation,\n    value : msg.payload.color.spectrumHsv.value,\n};\nreturn msg;","outputs":1,"noerr":0,"x":1150,"y":840,"wires":[["49751c0a.4c20b4"]]},{"id":"9961fafb.4f1698","type":"join","z":"f01779c8.cd1ec","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1370,"y":780,"wires":[["c678f72c.24a2c8"]]},{"id":"6f52ea33.833a2c","type":"nora-config","z":"","name":"Nora Config","group":"","notify":true}]
Regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Wednesday 12 February 2020 18:14
by EvJd
Thanks a lot you all for helping me! I will give it a try this weekend, cause I see a lot of information and it won't be something I can do in 1 night. But wow how great you want to help me and invest so much time in explaining how everyting works!

I have till 15th of march before Kappelt gBridge shuts down, so I am convinced I will find the sollution before than!
Again, thanks a lot!!!

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Friday 14 February 2020 14:30
by salvacalatayud
FireWizard wrote:This post will show the flow and a short description.

Screenshot_MiLight_flow1.png
The input to the json node comes from the MQTT input node, which has subscribed to domoticz/out.
No changes are required for this node.
The node, called "Filter Dimmer" filters all topics, which are not a Dimmer. You might want to change that, but as long as you use the same hardware it is not required.
In order to convert RGB values to HSV values, I created a function node that arranges the RGB values, so that the RGB>HSV node can convert it.
For both nodes, no changes are required.

The output of the RGB>HSV convert node is joined with the original flow.
No changes for the join node are required.
The next node is a Function node, that prepares the data, so that the nora node can handle it.
No changes are required.

The next node before the nora node is the switch node.
You have to configure, as many outputs, as you have MiLight lamps and give them your IDX numbers, so that they are routed to the correct nora node.

Regarding the nora node, you should configure it to your need with the right topic (IDX number) and tick all the boxes, except "If msg arrives on input, pass through to output:"

If everything is correctly configured, it is possible to control the nora node from Domoticz.
You will see that in the text below the node.

Screenshot_MiLight_nora.png

Next step is the right side of the nora node. The output to Domoticz.

Screenshot_MiLight_flow2.png
From the nora node we have to change the HSV values back to RGB values.
So in order to convert HSV values to RGB values, I created a function node that arranges the HSV values, so that the HSV>RGB node can convert it.
For both nodes, no changes are required. Be aware that the box after "Scale Sat/Bri/Val" is ticked.

The output of the HSV>RGB convert node is joined with the original flow.
No changes for the join node are required.

The next node is a Function node, that prepares the data, so that Domoticz can handle it.
No changes are required.
Finally we go to a the json node and the output connects to the MQTT output node, which has subscribed to domoticz/in.
No changes are required for this node.

Feel free to implement it and to test it with real MiLight.

Best regards
Tested and working, thanks

The only problem is that my lights are rgbw, and I loose the white part...

Enviado desde mi Mi A2 mediante Tapatalk


Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Friday 14 February 2020 15:50
by FireWizard
Hello @salvacalatayud

You wrote:
The only problem is that my lights are rgbw, and I loose the white part...
Do you mean cw (cool white) and ww (warm white) So the temperature color (oK)?

As far as I know it is not implemented yet, but if someone knows what to send to the nora node, it is probably a small step.

See: https://github.com/andrei-tatar/node-re ... /issues/12

Regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Friday 14 February 2020 15:57
by FireWizard
IMPORTANT FOR ALL USERS

If you receive multiple messages from NORA elements in Node Red: "socket connection error: not authorized",
you need to update the token in Node-RED with a new one from https://node-red-google-home.herokuapp.com/

Also, you need to unlink NORA (in your Google Home app) and link it again.

This should solve the problem that Google Assistant cannot find NORA.

Regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Saturday 15 February 2020 12:40
by EvJd
Thanks so much! It works like a charm to change color and set my milights on and off! Only brightness controlls misses, but that not a great thing. Thank you thank you thank you!!!!!

FireWizard wrote: Wednesday 12 February 2020 17:52 Please find attached the flow:

Code: Select all

[{"id":"8b9fe124.3e6fb8","type":"nora-light","z":"f01779c8.cd1ec","devicename":"Slaapkamerlamp","lightcolor":true,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Slaapkamer","name":"Slaapkamerlamp","nora":"6f52ea33.833a2c","topic":"332","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1150,"y":780,"wires":[["73400cd3.d7c65c","9961fafb.4f1698"]]},{"id":"170e5319.3f606d","type":"json","z":"f01779c8.cd1ec","name":"","property":"payload","action":"","pretty":false,"x":150,"y":780,"wires":[["2528055.8fdd3fa"]]},{"id":"bd209b8.55e9b68","type":"function","z":"f01779c8.cd1ec","name":"Function In ","func":"msg.topic = msg.payload[0].idx;\nif (msg.payload[0].nvalue !== 0)\n{\n    msg.payload = {\n        on : true,\n        brightness : msg.payload[0].Level,\n        color : {\n            spectrumHsv : {\n                hue : msg.payload[1].red,\n                saturation : msg.payload[1].green/100,\n                value : msg.payload[1].blue/100\n            }\n        }\n    }\n}\nelse if (msg.payload[0].nvalue === 0)\n{\n    msg.payload = {\n        on : false,\n        brightness : msg.payload[0].Level,\n        color : {\n            spectrumHsv : {\n                hue : msg.payload[1].red,\n                saturation : msg.payload[1].green/100,\n                value : msg.payload[1].blue/100\n            }\n        }\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":780,"wires":[["3fd178cf.d784"]]},{"id":"3fd178cf.d784","type":"switch","z":"f01779c8.cd1ec","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"1170","vt":"str"},{"t":"eq","v":"1171","vt":"str"},{"t":"eq","v":"1172","vt":"str"},{"t":"eq","v":"332","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":910,"y":780,"wires":[[],[],[],["8b9fe124.3e6fb8"]]},{"id":"c678f72c.24a2c8","type":"function","z":"f01779c8.cd1ec","name":"Function Out","func":"var idx = parseInt(msg.topic);\nif ( msg.payload[0].on === true )\n{\n    msg.payload = {\n        \"command\" : \"setcolbrightnessvalue\",\n        \"idx\" : idx,\n        \"color\" : {\"m\":3,\"t\":0,\"r\":msg.payload[1].red,\"g\":msg.payload[1].green,\"b\":msg.payload[1].blue,\"cw\":0,\"ww\":0},\n        \"brightness\": msg.payload[0].brightness\n    };\n}\nelse if ( msg.payload[0].on === false )\n{\n    msg.payload = {\n        \"command\": \"switchlight\",\n        \"idx\": idx,\n        \"switchcmd\": \"Off\"\n        \n    };\n}\nreturn msg","outputs":1,"noerr":0,"x":1560,"y":780,"wires":[["20adf7d9.b1ec7"]]},{"id":"20adf7d9.b1ec7","type":"json","z":"f01779c8.cd1ec","name":"","property":"payload","action":"","pretty":false,"x":1750,"y":780,"wires":[["c14522c5.76fc68"]]},{"id":"c14522c5.76fc68","type":"debug","z":"f01779c8.cd1ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1930,"y":780,"wires":[]},{"id":"a9526656.b39dc8","type":"color-convert","z":"f01779c8.cd1ec","input":"rgb","output":"hsv","outputType":"object","scaleInput":false,"x":570,"y":840,"wires":[["6d505be6.981bac"]]},{"id":"2528055.8fdd3fa","type":"filter","z":"f01779c8.cd1ec","name":"Filter Dimmer","property":"payload.switchType","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"eq","v":"Dimmer","vt":"str","output":1}],"checkall":"true","outputs":1,"x":340,"y":780,"wires":[["963f3ce8.6fbc1","6d505be6.981bac"]]},{"id":"963f3ce8.6fbc1","type":"function","z":"f01779c8.cd1ec","name":"Create RGB Array","func":"msg.payload = {\n    red : msg.payload.Color.r,\n    green : msg.payload.Color.g,\n    blue : msg.payload.Color.b\n};\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":840,"wires":[["a9526656.b39dc8"]]},{"id":"6d505be6.981bac","type":"join","z":"f01779c8.cd1ec","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":780,"wires":[["bd209b8.55e9b68"]]},{"id":"49751c0a.4c20b4","type":"color-convert","z":"f01779c8.cd1ec","input":"hsv","output":"rgb","outputType":"object","scaleInput":true,"x":1370,"y":840,"wires":[["9961fafb.4f1698"]]},{"id":"73400cd3.d7c65c","type":"function","z":"f01779c8.cd1ec","name":"Create HSV Array","func":"msg.payload = {\n    hue : msg.payload.color.spectrumHsv.hue,\n    saturation : msg.payload.color.spectrumHsv.saturation,\n    value : msg.payload.color.spectrumHsv.value,\n};\nreturn msg;","outputs":1,"noerr":0,"x":1150,"y":840,"wires":[["49751c0a.4c20b4"]]},{"id":"9961fafb.4f1698","type":"join","z":"f01779c8.cd1ec","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1370,"y":780,"wires":[["c678f72c.24a2c8"]]},{"id":"6f52ea33.833a2c","type":"nora-config","z":"","name":"Nora Config","group":"","notify":true}]
Regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Saturday 15 February 2020 13:58
by FireWizard
@EvJd

You wrote:
It works like a charm to change color and set my milights on and off! Only brightness controls misses
I do not understand this. Do you really mean brightness and not saturation?

As you know I do not have a real MiLight and the dimmer, I did setup was a virtual dimmer.
However, if I play with the buttons, slider and the color circle, I noticed on the texts below the NORA node, that they change accordingly.
The same happens, if I play with the slider and the colors in the Google Home App.

Also a Voice command, like (in Dutch) "OK, Google, Slaaplamer lamp, Helderheid 60%" functions correctly. The only thing, that I don"t see change is the value.
The only thing, I was not able to do, was to set the saturation by a Voice command. Probably this is just a matter of the right wordings.

Everything is fully synchronized between my virtual dimmer in Domoticz, Google Home, app, Voice commands and the text under the NORA node.
Is this the difference between a virtual dimmer and a real MiLight?

Regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Saturday 22 February 2020 22:51
by salvacalatayud
xury wrote:Take a look my nora usage and control switches, lights, Panasonic TV etc.:
As you see nora nodes are between domoticz/out and domoticz/in topics.
On the second screen is to control RGBCCT led strips using milight hub plugin https://www.domoticz.com/forum/viewtopic.php?t=27771
nodered.png
noderedl.png
If someone interested I can share my flows, but before I have to make sure not leave any tokens etc.
I use more than 50 nora nodes.
I've just installed milight hub esp8266 now, and maybe your flows can be useful for me.

Thanks in avance

Enviado desde mi Mi A2 mediante Tapatalk



Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 19 March 2020 13:17
by MikiG
Does anyone know how to integrate blinds into Node-red-contrib-Nora?

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 19 March 2020 14:48
by FireWizard
Hello

@MikiG

This should not be too difficult, as the information pane of the Nora node indicates only:
Experimental! Represents a Google Home Blinds.
Input payload can have one or more be of the following properties openPercent - number (0-100). represents how open the blinds are;
Output payload has the properties that can be changed from Google Home: openPercent - number (0-100). represents how open the blinds are;
You might want to read the following thread as well:
https://discourse.nodered.org/t/node-re ... ation/4829
This thread does not cover blinds only, but if you do a search on "blinds", you will find some valuable information.

Another link you might be interested in: https://www.npmjs.com/package/node-red- ... controller.

Regards

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Wednesday 01 April 2020 12:32
by MikiG
FireWizard wrote: Thursday 19 March 2020 14:48 Hello

@MikiG

This should not be too difficult, as the information pane of the Nora node indicates only:
Experimental! Represents a Google Home Blinds.
Input payload can have one or more be of the following properties openPercent - number (0-100). represents how open the blinds are;
Output payload has the properties that can be changed from Google Home: openPercent - number (0-100). represents how open the blinds are;
You might want to read the following thread as well:
https://discourse.nodered.org/t/node-re ... ation/4829
This thread does not cover blinds only, but if you do a search on "blinds", you will find some valuable information.

Another link you might be interested in: https://www.npmjs.com/package/node-red- ... controller.

Regards
Thanks

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 02 April 2020 11:16
by salvacalatayud
MikiG wrote: Thursday 19 March 2020 13:17 Does anyone know how to integrate blinds into Node-red-contrib-Nora?
I've got them working, what do you need?

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 02 April 2020 13:43
by MikiG
salvacalatayud wrote: Thursday 02 April 2020 11:16
MikiG wrote: Thursday 19 March 2020 13:17 Does anyone know how to integrate blinds into Node-red-contrib-Nora?
I've got them working, what do you need?
Hello, I have the blinds with shelly 2.5 in Domoticz, and I wanted to control them by voice through node red in google home. I would like to control them all from the same flow

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 02 April 2020 17:25
by salvacalatayud
Here is my shutter function from domoticz to nora:

Code: Select all

msg.topic = msg.payload.idx
var percent = 100 - msg.payload.svalue1
if (msg.payload.nvalue === 1)
{
    msg.payload = 100
}
else if (msg.payload.nvalue === 0)
{
    msg.payload = 0
}
else if (msg.payload.nvalue === 2)
{
    msg.payload.openPercent = percent
}
    return msg;
And this one from nora to domoticz:

Code: Select all

var idx = parseInt(msg.topic)
var openPercent = 100 - msg.payload.openPercent

{
msg.payload = { "command": "switchlight", "idx": idx, "switchcmd": "Set Level", "level": openPercent };
return msg
}
Hope this helps

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 02 April 2020 18:43
by MikiG
salvacalatayud wrote: Thursday 02 April 2020 17:25 Here is my shutter function from domoticz to nora:

Code: Select all

msg.topic = msg.payload.idx
var percent = 100 - msg.payload.svalue1
if (msg.payload.nvalue === 1)
{
    msg.payload = 100
}
else if (msg.payload.nvalue === 0)
{
    msg.payload = 0
}
else if (msg.payload.nvalue === 2)
{
    msg.payload.openPercent = percent
}
    return msg;
And this one from nora to domoticz:

Code: Select all

var idx = parseInt(msg.topic)
var openPercent = 100 - msg.payload.openPercent

{
msg.payload = { "command": "switchlight", "idx": idx, "switchcmd": "Set Level", "level": openPercent };
return msg
}
Hope this helps

Thank you very much, it works perfect!!!

P.D. : He visto que eres de España, un saludo y muchas gracias en español

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Thursday 02 April 2020 19:19
by salvacalatayud
MikiG wrote: Thursday 02 April 2020 18:43
salvacalatayud wrote: Thursday 02 April 2020 17:25 Here is my shutter function from domoticz to nora:

Code: Select all

msg.topic = msg.payload.idx
var percent = 100 - msg.payload.svalue1
if (msg.payload.nvalue === 1)
{
    msg.payload = 100
}
else if (msg.payload.nvalue === 0)
{
    msg.payload = 0
}
else if (msg.payload.nvalue === 2)
{
    msg.payload.openPercent = percent
}
    return msg;
And this one from nora to domoticz:

Code: Select all

var idx = parseInt(msg.topic)
var openPercent = 100 - msg.payload.openPercent

{
msg.payload = { "command": "switchlight", "idx": idx, "switchcmd": "Set Level", "level": openPercent };
return msg
}
Hope this helps

Thank you very much, it works perfect!!!

P.D. : He visto que eres de España, un saludo y muchas gracias en español
Great!!!
Me alegra!!!

Re: Domoticz Google Assistant integration with node-red Easy Free Controlicz alternative!

Posted: Friday 03 April 2020 10:43
by twoenter
installed node-red on my synology nas
connection works with google

but I don't get connection with mosquitto. My ESPeasy clients connects without problems to domoticz via mqtt.

when i test some examples of mqtt to/from domoticz i get message:

Code: Select all

3-4-2020 09:45:45node: test
msg : string[28]
"missing broker configuration"
and

Code: Select all

3-4-2020 10:45:07node: localhost:1883
msg : error
"SyntaxError: Invalid regular expression: /(?:^|(?<=\s))(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(?=\s|$)/: Invalid group"
The broker is configured correcty as I can see.

the flow is deployed and i can change the state of the switch from google home and see it changing in node red. Don't see a green bullit near the mqqt node.

Please help!