Page 8 of 12

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

Posted: Saturday 10 October 2020 15:24
by FireWizard
Hi,

@salvacalatayud
@EvJd

The posted issues look similar.

I suspect that messages do not come through, as the the created array might not be correct.
I do not see it in my system, but the cause might be that my system is a single threaded device.
I expected that the main path is faster and so arrives earlier than the path through the Function Node and the HSV > RGB node
That means that the main path is in array[0] and the RGB info in array[1]. If coincidentally it is the other way around the Function node will fail to execute the code.

Therefore I took the code, published by @xury, February 12, 2020, at page 4 in this thread. Similar code I also found in another Javascript forum

I modified both Function nodes and inserted the code in the Function node:

To test:

Remove
- Remove Function node: Create RGB array
- Remove Conversion node: RGB > HSV
- Remove join node

Replace Fucntion In, by new Function node with the following code.

Code: Select all

msg.topic = msg.payload.idx;

function rgb2hsv (r, g, b) {
    let rabs, gabs, babs, rr, gg, bb, h, s, v, diff, diffc, percentRoundFn;
    rabs = r / 255;
    gabs = g / 255;
    babs = b / 255;
    v = Math.max(rabs, gabs, babs);
    diff = v - Math.min(rabs, gabs, babs);
    diffc = c => (v - c) / 6 / diff + 1 / 2;
    percentRoundFn = num => Math.round(num * 100) / 100;
    if (diff === 0) {
        h = s = 0;
    } else {
        s = diff / v;
        rr = diffc(rabs);
        gg = diffc(gabs);
        bb = diffc(babs);

        if (rabs === v) {
            h = bb - gg;
        } else if (gabs === v) {
            h = (1 / 3) + rr - bb;
        } else if (babs === v) {
            h = (2 / 3) + gg - rr;
        }
        if (h < 0) {
            h += 1;
        }else if (h > 1) {
            h -= 1;
        }
    }
    return {
        hue: Math.round(h * 360),
        saturation: percentRoundFn(s),
        value: percentRoundFn(v)
    };
}

if (typeof msg.payload.Color === 'undefined') {
    msg.payload.color = {};
}

if (msg.payload.nvalue !== 0) {
    msg.payload = {
        on : true,
        brightness : msg.payload.Level,
        color : { spectrumHsv : rgb2hsv(msg.payload.Color.r,msg.payload.Color.g,msg.payload.Color.b)}
    }
}

else if (msg.payload.nvalue === 0) {
    msg.payload = {
        on : false,
        brightness : msg.payload.Level,
        color : { spectrumHsv : rgb2hsv(msg.payload.Color.r,msg.payload.Color.g,msg.payload.Color.b)}
    }
}

return msg;

Do the same with:

Remove
- Remove Function node: Create HSV array
- Remove Conversion node: HSV > RGB
- Remove join node

Replace Function Out, by new Function node with the following code.

Code: Select all

var idx = parseInt(msg.topic);
var cc = {};

function mix(a, b, v)
{
    return (1-v)*a + v*b;
}

function HSVtoRGB(H, S, V)
{
    var V2 = V * (1 - S);
    var r  = ((H>=0 && H<=60) || (H>=300 && H<=360)) ? V : ((H>=120 && H<=240) ? V2 : ((H>=60 && H<=120) ? mix(V,V2,(H-60)/60) : ((H>=240 && H<=300) ? mix(V2,V,(H-240)/60) : 0)));
    var g  = (H>=60 && H<=180) ? V : ((H>=240 && H<=360) ? V2 : ((H>=0 && H<=60) ? mix(V2,V,H/60) : ((H>=180 && H<=240) ? mix(V,V2,(H-180)/60) : 0)));
    var b  = (H>=0 && H<=120) ? V2 : ((H>=180 && H<=300) ? V : ((H>=120 && H<=180) ? mix(V2,V,(H-120)/60) : ((H>=300 && H<=360) ? mix(V,V2,(H-300)/60) : 0)));

    return {
        r : Math.round(r * 255),
        b : Math.round(b * 255),
        g : Math.round(g * 255)
    };
}

//msg.payload.color = HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value);
//cc = HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value);

if ( msg.payload.on === true )
{
    msg.payload = {
        "command" : "setcolbrightnessvalue",
        "idx" : idx,
        "brightness" : msg.payload.brightness,
        "color" : {...{"m":3,"t":0,"cw":0,"ww":0},...HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value)}

    };
}
else if ( msg.payload.on === false )
{
    msg.payload = {
        "command": "switchlight",
        "idx": idx,
        "switchcmd": "Off"
    };
}
return msg
Line 32 contains an error message, I cannot find yet.
Has something to do with merging two objects into one object, but the desired result is produced. So it works.

Awaiting the test results.

Regards

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

Posted: Tuesday 13 October 2020 9:50
by salvacalatayud
Thanks for the responses.

Done everything but it looks like it is a problem with milight plugin and rgb+cct bulbs.

The outputs from the node are the same, so it is not a problem with node-red and nora

Edit: found the solution, updated the milight plugin and now works fine. Thanks a lot for your help

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

Posted: Tuesday 13 October 2020 21:50
by FireWizard
Hi, @salvacalatayud

That is is good to hear.

Just for information.
The warning exposed in the Function node, if you use the "spread operator" (the three dots, ...) will probably be solved in version 1.2 of Node Red.
You can still use it now, as long as you can accept that warning, which you can safely ignore.
See: https://github.com/node-red/node-red/issues/1988

[Edit] This issue is indeed solved in Node Red, version 1.2. Tested it with version 1.2.2.

Regards

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

Posted: Sunday 25 October 2020 17:33
by salvacalatayud
FireWizard wrote:Hi, @salvacalatayud

That is is good to hear.

Just for information.
The warning exposed in the Function node, if you use the "spread operator" (the three dots, ...) will probably be solved in version 1.2 of Node Red.
You can still use it now, as long as you can accept that warning, which you can safely ignore.
See: https://github.com/node-red/node-red/issues/1988

[Edit] This issue is indeed solved in Node Red, version 1.2. Tested it with version 1.2.2.

Regards
Thanks

Enviado desde mi SM-N975F mediante Tapatalk


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

Posted: Saturday 05 December 2020 13:10
by salvacalatayud
Hello, I have re-installed all my domoticz setup and now it is happening something strange.

I see that Nora is sending perfectly commands to domoticz via mqtt domoticz/in, the light changes status in domoticz, but the light does not turn on or off in my tasmota device.
I see that the problem is that domoticz gets the order but does not send the command to the tasmota device via mqtt.

I only get it to work if I set prevent loop to false in my hardware mqtt.

Is it the right mode or am I doing something wrong?

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

Posted: Saturday 05 December 2020 13:29
by FireWizard
Hi, @salvacalatayud

In this case it is the only (and correct) way of operation, as Domoticz receives the command from Node Red by MQTT and, as your lights are controlled by Tasmota, has to send the command to Tasmota by MQTT. As published earlier in this forum, this is against the principles of MQTT and therefore re-transmitting MQTT by Domoticz is optional (The "Prevent loop" setting).

You have already found the solution.

Regards

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

Posted: Saturday 05 December 2020 13:33
by salvacalatayud
FireWizard wrote:Hi, @salvacalatayud

In this case it is the only (and correct) way of operation, as Domoticz receives the command from Node Red by MQTT and, as your lights are controlled by Tasmota, has to send the command to Tasmota by MQTT. As published earlier in this forum, this is against the principles of MQTT and therefore
re transmitting MQTT by Domoticz is optional (The "Prevent loop" setting).

You have already found the solution.

Regards
Thanks

Enviado desde mi SM-N975F mediante Tapatalk


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

Posted: Friday 01 January 2021 16:34
by sincze
Wow this is a very Nice helpfull thread. tnx!

Just started with Node-RED and with the help this thread I was able to create the integration of google with
- Mi-Light / dimmer / color control,
- Some Domoticz Scenes ( control the blinds at once instead of per item ),
- Switch some lights.

In addition create a TELEGRAM bot that communicates with Domoticz as well via a menu. :lol:
Node-Red.JPG
Node-Red.JPG (210.35 KiB) Viewed 3253 times
pff what's next.

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

Posted: Friday 08 January 2021 9:01
by wervisser
@sincze, care to share your node-red code? Looks very interesting.

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

Posted: Friday 08 January 2021 9:08
by Devious
Do more people frequent reply's that Nora is not reachable?

Most of the time it works immediately or with a short pause.
But sometimes Google reply's that Nora is not reachable.

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

Posted: Friday 08 January 2021 9:11
by wervisser
@Devious, yes I do encounter the same issues. This started since last week. I have already revoken my token and re-implemented. Currently it looks like it is running smoothly again.

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

Posted: Friday 08 January 2021 11:32
by salvacalatayud
Devious wrote:Do more people frequent reply's that Nora is not reachable?

Most of the time it works immediately or with a short pause.
But sometimes Google reply's that Nora is not reachable.
I have the same issues

Enviado desde mi SM-N975F mediante Tapatalk


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

Posted: Tuesday 19 January 2021 12:02
by runy
I have the same problem and I've tried to do login in nora page (https://node-red-google-home.herokuapp.com/login) and doens't work.

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

Posted: Tuesday 19 January 2021 12:45
by wervisser
The problems have been described on the Github page. The original author is working on a new platform based on Firebase.

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

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

Posted: Wednesday 20 January 2021 10:08
by sincze
wervisser wrote: Friday 08 January 2021 9:01 @sincze, care to share your node-red code? Looks very interesting.
Missed this one.
Currently optimizing so the switch function deals with device names.. which is so much easier compared to idx....
Spoiler: show
[{"id":"23ec8421.8df6ec","type":"switch","z":"163db6fa.634fd9","name":"domoticz_idx_check","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"532","vt":"str"},{"t":"eq","v":"535","vt":"str"},{"t":"eq","v":"528","vt":"str"},{"t":"eq","v":"1436","vt":"str"},{"t":"eq","v":"1435","vt":"str"},{"t":"eq","v":"1568","vt":"str"},{"t":"eq","v":"530","vt":"str"},{"t":"eq","v":"533","vt":"str"},{"t":"eq","v":"153","vt":"str"},{"t":"eq","v":"156","vt":"str"}],"checkall":"false","repair":false,"outputs":10,"x":1200,"y":120,"wires":[["ff14f9aa.1816e8"],["988362da.367c7"],["8740a9d8.234ec8"],["9761202e.28ed9"],["7b27482a.041318"],["6bd7c30f.b7e29c"],["f50d196f.bdc4d8"],["7f0a58f7.a18038"],["3c559791.4510e8"],["bbb80f87.9d62b"]]},{"id":"46f87c81.f349d4","type":"function","z":"163db6fa.634fd9","name":"Function out On/Off","func":"var idx = parseInt(msg.topic);\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\nelse if ( msg.payload === false )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1910,"y":220,"wires":[["b29c1baf.5f0708"]],"info":"van msg.topic (dat is idx) \nen msg.payload = true or fale \neen domoticz mqtt bericht maken"},{"id":"b29c1baf.5f0708","type":"json","z":"163db6fa.634fd9","name":"","property":"payload","action":"","pretty":false,"x":2210,"y":560,"wires":[["5fbebfc4.b9dd1"]]},{"id":"49cebc5d.685af4","type":"comment","z":"163db6fa.634fd9","name":"Useful links","info":"viewtopic.php?f=69&t=27588\nhttps://flo ... \ndomoticz mqtt publish is / en out\nhttps://node-red-google-home.herokuapp.com/login\n\n\n{\n \"Battery\" : 255,\n \"RSSI\" : 12,\n \"description\" : \"\",\n \"dtype\" : \"Lighting 2\",\n \"id\" : \"0E672C2\",\n \"idx\" : 1002,\n \"name\" : \"lantaarn\",\n \"nvalue\" : 1,\n \"stype\" : \"AC\",\n \"svalue1\" : \"15\",\n \"switchType\" : \"On/Off\",\n \"unit\" : 3\n}\n\nzie ook flow voor de overige types zoals dimmers en scenes","x":90,"y":40,"wires":[]},{"id":"9bd2ea5a.7616b8","type":"mqtt in","z":"163db6fa.634fd9","name":"MQTT","topic":"domoticz/out","qos":"0","datatype":"auto","broker":"df52700c.0c65c","x":70,"y":220,"wires":[["2ddd8a00.559016"]]},{"id":"2ddd8a00.559016","type":"json","z":"163db6fa.634fd9","name":"json convert","property":"payload","action":"","pretty":false,"x":270,"y":220,"wires":[["537c61cb.93366","6365f2e8.4235cc","4af72982.72d3c8"]]},{"id":"537c61cb.93366","type":"switch","z":"163db6fa.634fd9","name":"switchtype_check","property":"payload.switchType","propertyType":"msg","rules":[{"t":"cont","v":"On/Off","vt":"str"},{"t":"cont","v":"Dimmer","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":490,"y":220,"wires":[["29a2a8ae.dd5d08"],["168cfd03.3e5df3"]]},{"id":"29a2a8ae.dd5d08","type":"function","z":"163db6fa.634fd9","name":"On/OFF message to convert","func":"msg.topic = msg.payload.idx\nif (msg.payload.nvalue == 1)\n{\n msg.payload = true\n}\nelse if (msg.payload.nvalue === 0)\n{\n msg.payload = false\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":200,"wires":[["23ec8421.8df6ec","e1338f17.cfa9c"]]},{"id":"90ff47d4.b26858","type":"debug","z":"163db6fa.634fd9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1890,"y":40,"wires":[]},{"id":"2d4d6b28.f46444","type":"comment","z":"163db6fa.634fd9","name":"What body type for google?","info":"een GA bericht maken\nbevat msg.payload = false or true\ntopic = idx\ningeval een switch","x":760,"y":160,"wires":[]},{"id":"5fbebfc4.b9dd1","type":"mqtt out","z":"163db6fa.634fd9","name":"Bericht van GA naar domoticz (IN) ","topic":"domoticz/in","qos":"1","retain":"","broker":"df52700c.0c65c","x":2480,"y":560,"wires":[]},{"id":"8da6570a.ad6018","type":"comment","z":"163db6fa.634fd9","name":"Domoticz MQTT Out","info":"bericht uit domoticz","x":110,"y":180,"wires":[]},{"id":"e1338f17.cfa9c","type":"debug","z":"163db6fa.634fd9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1210,"y":220,"wires":[]},{"id":"96019fe1.4f12d","type":"function","z":"163db6fa.634fd9","name":"Function Screen Scene On/Off","func":"var idx = parseInt(msg.topic);\n//if ( msg.payload.openPercent === 0 )\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchscene\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\n//else if ( msg.payload.openPercent === 100 )\nif ( msg.payload === false )\n{\nmsg.payload = { \"command\": \"switchscene\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1830,"y":1080,"wires":[["b29c1baf.5f0708","f5293f4d.5645c"]],"info":"van msg.topic (dat is idx) \nen msg.payload = true or fale \neen domoticz mqtt bericht maken"},{"id":"6365f2e8.4235cc","type":"switch","z":"163db6fa.634fd9","name":"scene_check","property":"payload.Type","propertyType":"msg","rules":[{"t":"eq","v":"Group","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":470,"y":360,"wires":[["eebe0b42.12ccc8"]]},{"id":"eebe0b42.12ccc8","type":"function","z":"163db6fa.634fd9","name":"SCENE message to convert","func":"msg.topic = msg.payload.idx\n\nif (msg.payload.Status === \"On\")\n{\n msg.payload = true\n}\nelse if (msg.payload.Status === \"Off\")\n{\n msg.payload = false\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":360,"wires":[["bd32aa62.14f778"]]},{"id":"bd32aa62.14f778","type":"switch","z":"163db6fa.634fd9","name":"domoticz_idx_check","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"13","vt":"str"},{"t":"eq","v":"16","vt":"str"},{"t":"eq","v":"11","vt":"str"},{"t":"eq","v":"8","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":1200,"y":380,"wires":[["3c6c2c5b.1db9a4"],["2cdb1b0e.411ff4"],["807b341e.4bdef8"],["44ab876a.b3fde8"]]},{"id":"f5293f4d.5645c","type":"debug","z":"163db6fa.634fd9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1870,"y":1040,"wires":[]},{"id":"f9717362.dc138","type":"function","z":"163db6fa.634fd9","name":"Function out RGBWW","func":"var idx = parseInt(msg.topic);\nvar cc = {};\n\nfunction mix(a, b, v)\n{\n return (1-v)*a + v*b;\n}\n\nfunction HSVtoRGB(H, S, V)\n{\n var V2 = V * (1 - S);\n var r = ((H>=0 && H<=60) || (H>=300 && H<=360)) ? V : ((H>=120 && H<=240) ? V2 : ((H>=60 && H<=120) ? mix(V,V2,(H-60)/60) : ((H>=240 && H<=300) ? mix(V2,V,(H-240)/60) : 0)));\n var g = (H>=60 && H<=180) ? V : ((H>=240 && H<=360) ? V2 : ((H>=0 && H<=60) ? mix(V2,V,H/60) : ((H>=180 && H<=240) ? mix(V,V2,(H-180)/60) : 0)));\n var b = (H>=0 && H<=120) ? V2 : ((H>=180 && H<=300) ? V : ((H>=120 && H<=180) ? mix(V2,V,(H-120)/60) : ((H>=300 && H<=360) ? mix(V,V2,(H-300)/60) : 0)));\n\n return {\n r : Math.round(r * 255),\n b : Math.round(b * 255),\n g : Math.round(g * 255)\n };\n}\n\n//msg.payload.color = HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value);\n//cc = HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value);\n\nif ( msg.payload.on === true )\n{\n msg.payload = {\n \"command\" : \"setcolbrightnessvalue\",\n \"idx\" : idx,\n \"brightness\" : msg.payload.brightness,\n \"color\" : {...{\"m\":3,\"t\":0,\"cw\":0,\"ww\":0},...HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value)}\n\n };\n}\nelse if ( msg.payload.on === false )\n{\n msg.payload = {\n \"command\": \"switchlight\",\n \"idx\": idx,\n \"switchcmd\": \"Off\"\n };\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1940,"y":780,"wires":[["b29c1baf.5f0708"]]},{"id":"64d4ded1.b454f","type":"function","z":"163db6fa.634fd9","name":"RGBW message to convert","func":"msg.topic = msg.payload.idx;\n\nfunction rgb2hsv (r, g, b) {\n let rabs, gabs, babs, rr, gg, bb, h, s, v, diff, diffc, percentRoundFn;\n rabs = r / 255;\n gabs = g / 255;\n babs = b / 255;\n v = Math.max(rabs, gabs, babs);\n diff = v - Math.min(rabs, gabs, babs);\n diffc = c => (v - c) / 6 / diff + 1 / 2;\n percentRoundFn = num => Math.round(num * 100) / 100;\n if (diff === 0) {\n h = s = 0;\n } else {\n s = diff / v;\n rr = diffc(rabs);\n gg = diffc(gabs);\n bb = diffc(babs);\n\n if (rabs === v) {\n h = bb - gg;\n } else if (gabs === v) {\n h = (1 / 3) + rr - bb;\n } else if (babs === v) {\n h = (2 / 3) + gg - rr;\n }\n if (h < 0) {\n h += 1;\n }else if (h > 1) {\n h -= 1;\n }\n }\n return {\n hue: Math.round(h * 360),\n saturation: percentRoundFn(s),\n value: percentRoundFn(v)\n };\n}\n\nif (typeof msg.payload.Color === 'undefined') {\n msg.payload.color = {};\n}\n\nif (msg.payload.nvalue !== 0) {\n msg.payload = {\n on : true,\n brightness : msg.payload.Level,\n color : { spectrumHsv : rgb2hsv(msg.payload.Color.r,msg.payload.Color.g,msg.payload.Color.b)}\n }\n}\n\nelse if (msg.payload.nvalue === 0) {\n msg.payload = {\n on : false,\n brightness : msg.payload.Level,\n color : { spectrumHsv : rgb2hsv(msg.payload.Color.r,msg.payload.Color.g,msg.payload.Color.b)}\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":300,"wires":[["e8d79de.ebc0c6"]]},{"id":"e8d79de.ebc0c6","type":"switch","z":"163db6fa.634fd9","name":"domoticz_idx_check","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"1064","vt":"str"},{"t":"eq","v":"281","vt":"str"},{"t":"eq","v":"309","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":1200,"y":300,"wires":[["84a4f032.7d81a"],["77b08267.86758c"],["9339ec61.f32a2"]]},{"id":"4af72982.72d3c8","type":"switch","z":"163db6fa.634fd9","name":"idx_check","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"1283","vt":"str"},{"t":"eq","v":"47","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":100,"wires":[["b29d09ee.1c5a28"],["b29d09ee.1c5a28"]]},{"id":"b29d09ee.1c5a28","type":"debug","z":"163db6fa.634fd9","name":"debugging","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":650,"y":100,"wires":[]},{"id":"d44a0dec.d10de","type":"comment","z":"163db6fa.634fd9","name":"Kijk enkel naar specifieke IDX","info":"Kijk enkel naar specifieke IDX","x":520,"y":60,"wires":[]},{"id":"168cfd03.3e5df3","type":"switch","z":"163db6fa.634fd9","name":"dimmer_dtype_check","property":"payload.dtype","propertyType":"msg","rules":[{"t":"cont","v":"Light/Switch","vt":"str"},{"t":"cont","v":"Color Switch","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":560,"y":280,"wires":[["5458adf0.9b0084"],["64d4ded1.b454f"]]},{"id":"5458adf0.9b0084","type":"function","z":"163db6fa.634fd9","name":"Dimmer message to convert","func":"msg.topic = msg.payload.idx;\n\nif (msg.payload.nvalue !== 0) {\n msg.payload = {\n on : true,\n brightness : msg.payload.Level\n }\n}\n\nelse if (msg.payload.nvalue === 0) {\n msg.payload = {\n on : false,\n brightness : msg.payload.Level,\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":860,"y":260,"wires":[["23ec8421.8df6ec","e1338f17.cfa9c"]]},{"id":"f19706a1.942e58","type":"function","z":"163db6fa.634fd9","name":"Function out Dimmer","func":"var idx = parseInt(msg.topic);\n\n//msg.payload.color = HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value);\n//cc = HSVtoRGB(msg.payload.color.spectrumHsv.hue, msg.payload.color.spectrumHsv.saturation, msg.payload.color.spectrumHsv.value);\n\nif ( msg.payload.on === true )\n{\n msg.payload = {\n \"command\" : \"switchlight\",\n \"idx\" : idx,\n \"switchcmd\": \"Set Level\",\n \"level\" : msg.payload.brightness\n };\n}\nelse if ( msg.payload.on === false )\n{\n msg.payload = {\n \"command\": \"switchlight\",\n \"idx\": idx,\n \"switchcmd\": \"Off\"\n };\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1920,"y":560,"wires":[["b29c1baf.5f0708"]]},{"id":"61c9413e.0edb5","type":"function","z":"163db6fa.634fd9","name":"Function Scene On/Off","func":"var idx = parseInt(msg.topic);\n//if ( msg.payload.openPercent === 0 )\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchscene\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\n//else if ( msg.payload.openPercent === 100 )\nif ( msg.payload === false )\n{\nmsg.payload = { \"command\": \"switchscene\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1860,"y":1200,"wires":[["b29c1baf.5f0708","919eeae0.c83f18"]],"info":"van msg.topic (dat is idx) \nen msg.payload = true or fale \neen domoticz mqtt bericht maken"},{"id":"919eeae0.c83f18","type":"debug","z":"163db6fa.634fd9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1870,"y":1160,"wires":[]},{"id":"9b7f6ddd.407d1","type":"debug","z":"163db6fa.634fd9","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1890,"y":320,"wires":[]},{"id":"2088714b.43e06e","type":"comment","z":"163db6fa.634fd9","name":"Determine type of message","info":"Determine type of message\n- On/Off\n- Dimmer\n- Dimmer met RGBWW\n- Scene On/Off","x":520,"y":160,"wires":[]},{"id":"988362da.367c7","type":"nora-switch","z":"163db6fa.634fd9","devicename":"lamp_tv","roomhint":"Woonkamer","name":"Lamp Tv","passthru":false,"nora":"ab8c3882.8b0438","topic":"535","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1640,"y":160,"wires":[["46f87c81.f349d4","90ff47d4.b26858"]]},{"id":"ff14f9aa.1816e8","type":"nora-switch","z":"163db6fa.634fd9","devicename":"lamp_staand","roomhint":"Woonkamer","name":"Lamp Staand","passthru":false,"nora":"ab8c3882.8b0438","topic":"532","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1650,"y":100,"wires":[["46f87c81.f349d4","90ff47d4.b26858"]]},{"id":"8740a9d8.234ec8","type":"nora-switch","z":"163db6fa.634fd9","devicename":"lamp_voordeur","roomhint":"Voordeur","name":"Lamp Voordeur","passthru":false,"nora":"ab8c3882.8b0438","topic":"528","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1660,"y":220,"wires":[["46f87c81.f349d4","90ff47d4.b26858"]]},{"id":"9761202e.28ed9","type":"nora-switch","z":"163db6fa.634fd9","devicename":"tv_woonkamer","roomhint":"Woonkamer","name":"TV Woonkamer","passthru":false,"nora":"ab8c3882.8b0438","topic":"1436","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1660,"y":280,"wires":[["46f87c81.f349d4","9b7f6ddd.407d1"]]},{"id":"7b27482a.041318","type":"nora-switch","z":"163db6fa.634fd9","devicename":"tv_keuken","roomhint":"Keuken","name":"TV Keuken","passthru":false,"nora":"ab8c3882.8b0438","topic":"1435","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1650,"y":340,"wires":[["46f87c81.f349d4","9b7f6ddd.407d1"]]},{"id":"6bd7c30f.b7e29c","type":"nora-switch","z":"163db6fa.634fd9","devicename":"tv_slaapkamer","roomhint":"Slaapkamer","name":"TV Slaapkamer","passthru":false,"nora":"ab8c3882.8b0438","topic":"1568","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1660,"y":400,"wires":[["46f87c81.f349d4","9b7f6ddd.407d1"]]},{"id":"bbb80f87.9d62b","type":"nora-switch","z":"163db6fa.634fd9","devicename":"GEO_Home_2","roomhint":"Buiten","name":"GEO HOME 2","passthru":false,"nora":"ab8c3882.8b0438","topic":"156","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1660,"y":500,"wires":[["46f87c81.f349d4"]]},{"id":"3c559791.4510e8","type":"nora-switch","z":"163db6fa.634fd9","devicename":"GEO_Home_1","roomhint":"Buiten","name":"GEO HOME 1","passthru":false,"nora":"ab8c3882.8b0438","topic":"153","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1660,"y":460,"wires":[["46f87c81.f349d4"]]},{"id":"84a4f032.7d81a","type":"nora-light","z":"163db6fa.634fd9","devicename":"lamp_slaapkamer","lightcolor":true,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Slaapkamer","name":"Lamp Slaapkamer","nora":"ab8c3882.8b0438","topic":"1064","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1670,"y":720,"wires":[["f9717362.dc138"]]},{"id":"77b08267.86758c","type":"nora-light","z":"163db6fa.634fd9","devicename":"lamp_vensterbank","lightcolor":true,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Woonkamer","name":"Lamp Vensterbank","nora":"ab8c3882.8b0438","topic":"281","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1670,"y":780,"wires":[["f9717362.dc138"]]},{"id":"9339ec61.f32a2","type":"nora-light","z":"163db6fa.634fd9","devicename":"lamp_keukenkast","lightcolor":true,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Keuken","name":"Lamp Keukenkast","nora":"ab8c3882.8b0438","topic":"309","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1670,"y":840,"wires":[["f9717362.dc138"]]},{"id":"f50d196f.bdc4d8","type":"nora-light","z":"163db6fa.634fd9","devicename":"lamp_keukentafel","lightcolor":false,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Keuken","name":"Lamp Keukentafel","nora":"ab8c3882.8b0438","topic":"530","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1670,"y":560,"wires":[["f19706a1.942e58"]]},{"id":"7f0a58f7.a18038","type":"nora-light","z":"163db6fa.634fd9","devicename":"lamp_bank","lightcolor":false,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Woonkamer","name":"Lamp Bank","nora":"ab8c3882.8b0438","topic":"533","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1650,"y":620,"wires":[["f19706a1.942e58"]]},{"id":"807b341e.4bdef8","type":"nora-light","z":"163db6fa.634fd9","devicename":"lampen_beneden","lightcolor":false,"brightnesscontrol":true,"turnonwhenbrightnesschanges":true,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"","name":"Lampen Beneden","nora":"ab8c3882.8b0438","topic":"11","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1510,"y":1180,"wires":[["61c9413e.0edb5"]]},{"id":"44ab876a.b3fde8","type":"nora-light","z":"163db6fa.634fd9","devicename":"lampen_woonkamer","lightcolor":false,"brightnesscontrol":true,"turnonwhenbrightnesschanges":false,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Woonkamer","name":"Lampen Woonkamer","nora":"ab8c3882.8b0438","topic":"8","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":1520,"y":1240,"wires":[["61c9413e.0edb5"]]},{"id":"3c6c2c5b.1db9a4","type":"nora-garage","z":"163db6fa.634fd9","devicename":"screens_woonkamer","roomhint":"Woonkamer","name":"Screens Woonkamer","passthru":false,"nora":"ab8c3882.8b0438","topic":"13","openvalue":"true","openvalueType":"bool","closevalue":"false","closevalueType":"bool","x":1520,"y":1060,"wires":[["96019fe1.4f12d"]]},{"id":"2cdb1b0e.411ff4","type":"nora-garage","z":"163db6fa.634fd9","devicename":"screens_woonkamer_achter","roomhint":"Woonkamer","name":"Screens Woonkamer Achter","passthru":false,"nora":"ab8c3882.8b0438","topic":"16","openvalue":"true","openvalueType":"bool","closevalue":"false","closevalueType":"bool","x":1540,"y":1120,"wires":[["96019fe1.4f12d"]]},{"id":"df52700c.0c65c","type":"mqtt-broker","name":"MQTT","broker":"192.168.1.12","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"ab8c3882.8b0438","type":"nora-config","name":"nora","group":"","notify":false}]

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

Posted: Sunday 07 March 2021 15:50
by edwin1234
Does someone know how to add support for a radiatorvalve trough zigbee2mqtt
So i can turn temperature higher or lower?
With a example please
Thanks

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

Posted: Sunday 07 March 2021 18:17
by FireWizard
Hello @edwin1234
Does someone know how to add support for a radiatorvalve trough zigbee2mqtt
I have connected my thermostat to Google Home with help of Nora.
I assume that your radiator valve thermostat, also works with a temperature and a set-point.
Do they have also a mode, such as "ON" or "Off" or "AUTO"?

Can you show what the output of the radiator valve is in either something like MQTT Explorer or a Node Red Debug node?
What does the valve expect to receive?

Regards

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

Posted: Monday 08 March 2021 6:09
by edwin1234
Its a tuya radiator valve, you can set temp higher and lower has indeed automode etc, dont need all settings in google home but jus the basic ones. and this is a copy of mqtt.
Thanks for your help.

Radiator valve with thermostat","exposes":[{"features":[{"access":3,"description":"Enables/disables physical input on the device","name":"state","property":"child_lock","type":"binary","value_off":"UNLOCK","value_on":"LOCK"}],"type":"lock"},{"features":[{"access":3,"description":"Enables/disables window detection on the device","name":"state","property":"window_detection","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":1,"description":"Indicates if the battery of this device is almost empty","name":"battery_low","property":"battery_low","type":"binary","value_off":false,"value_on":true},{"features":[{"access":3,"name":"state","property":"valve_detection","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":1,"description":"Position","name":"position","property":"position","type":"numeric","unit":"%"},{"features":[{"access":3,"description":"Temperature setpoint","name":"current_heating_setpoint","property":"current_heating_setpoint","type":"numeric","unit":"°C","value_max":35,"value_min":5,"value_step":0.5},{"access":1,"description":"Current temperature measured on the device","name":"local_temperature","property":"local_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Mode of this device","name":"system_mode","property":"system_mode","type":"enum","values":["heat","auto","off"]},{"access":1,"description":"The current running state","name":"running_state","property":"running_state","type":"enum","values":["idle","heat"]},{"access":3,"description":"Offset to be used in the local_temperature","name":"local_temperature_calibration","property":"local_temperature_calibration","type":"numeric","unit":"°C"},{"access":3,"description":"Away mode","name":"away_mode","property":"away_mode","type":"binary","value_off":"OFF","value_on":"ON"},{"access":3,"description":"Mode of this device (similar to system_mode)","name":"preset","property":"preset","type":"enum","values":["schedule","manual","boost","complex","comfort","eco"]}],"type":"climate"},{"features":[{"access":3,"description":"Enable/disable auto lock","name":"state","property":"auto_lock","type":"binary","value_off":"MANUAL","value_on":"AUTO"}],"type":"switch"},{"features":[{"access":3,"description":"Enable/disable away mode","name":"state","property":"away_mode","type":"binary","value_off":"OFF","value_on":"ON"}],"type":"switch"},{"access":3,"description":"Away preset days","name":"away_preset_days","property":"away_preset_days","type":"numeric"},{"access":3,"description":"Boost time","name":"boost_time","property":"boost_time","type":"numeric","unit":"s"},{"access":3,"description":"Comfort temperature","name":"comfort_temperature","property":"comfort_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Eco temperature","name":"eco_temperature","property":"eco_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Force the valve position","name":"force","property":"force","type":"enum","values":["normal","open","close"]},{"access":3,"description":"Maximum temperature","name":"max_temperature","property":"max_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Minimum temperature","name":"min_temperature","property":"min_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Week format user for schedule","name":"week","property":"week","type":"enum","values":["5+2","6+1","7"]},{"access":3,"description":"Away preset temperature","name":"away_preset_temperature","property":"away_preset_temperature","type":"numeric","unit":"°C"},{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"TS0601_thermostat","supports_ota":true,"vendor":"TuYa"},"endpoints":{"1":{"bindings":[],"clusters":{"input":["genBasic","genGroups","genScenes","manuSpecificTuya"],"output":

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

Posted: Monday 08 March 2021 16:51
by FireWizard
Hello @edwin1234

Is this really produced by 1 thermostat????

I don't think that the message is correct, as it ends with:
"output":
Is it possible for you to install MQTT Explorer ( http://mqtt-explorer.com/) and publish a screenshot of what you see regarding this thermostat.
And if you copy such code into a post please use </> so that it looks like:

Code: Select all

[{"features":[{"access":3,"description":"Enables/disables physical input on the device","name":"state","property":"child_lock","type":"binary","value_off":"UNLOCK","value_on":"LOCK"}],"type":"lock"},{"features":[{"access":3,"description":"Enables/disables window detection on the device","name":"state","property":"window_detection","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":1,"description":"Indicates if the battery of this device is almost empty","name":"battery_low","property":"battery_low","type":"binary","value_off":false,"value_on":true},{"features":[{"access":3,"name":"state","property":"valve_detection","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":1,"description":"Position","name":"position","property":"position","type":"numeric","unit":"%"},{"features":[{"access":3,"description":"Temperature setpoint","name":"current_heating_setpoint","property":"current_heating_setpoint","type":"numeric","unit":"°C","value_max":35,"value_min":5,"value_step":0.5},{"access":1,"description":"Current temperature measured on the device","name":"local_temperature","property":"local_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Mode of this device","name":"system_mode","property":"system_mode","type":"enum","values":["heat","auto","off"]},{"access":1,"description":"The current running state","name":"running_state","property":"running_state","type":"enum","values":["idle","heat"]},{"access":3,"description":"Offset to be used in the local_temperature","name":"local_temperature_calibration","property":"local_temperature_calibration","type":"numeric","unit":"°C"},{"access":3,"description":"Away mode","name":"away_mode","property":"away_mode","type":"binary","value_off":"OFF","value_on":"ON"},{"access":3,"description":"Mode of this device (similar to system_mode)","name":"preset","property":"preset","type":"enum","values":["schedule","manual","boost","complex","comfort","eco"]}],"type":"climate"},{"features":[{"access":3,"description":"Enable/disable auto lock","name":"state","property":"auto_lock","type":"binary","value_off":"MANUAL","value_on":"AUTO"}],"type":"switch"},{"features":[{"access":3,"description":"Enable/disable away mode","name":"state","property":"away_mode","type":"binary","value_off":"OFF","value_on":"ON"}],"type":"switch"},{"access":3,"description":"Away preset days","name":"away_preset_days","property":"away_preset_days","type":"numeric"},{"access":3,"description":"Boost time","name":"boost_time","property":"boost_time","type":"numeric","unit":"s"},{"access":3,"description":"Comfort temperature","name":"comfort_temperature","property":"comfort_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Eco temperature","name":"eco_temperature","property":"eco_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Force the valve position","name":"force","property":"force","type":"enum","values":["normal","open","close"]},{"access":3,"description":"Maximum temperature","name":"max_temperature","property":"max_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Minimum temperature","name":"min_temperature","property":"min_temperature","type":"numeric","unit":"°C"},{"access":3,"description":"Week format user for schedule","name":"week","property":"week","type":"enum","values":["5+2","6+1","7"]},{"access":3,"description":"Away preset temperature","name":"away_preset_temperature","property":"away_preset_temperature","type":"numeric","unit":"°C"},{"access":1,"description":"Link quality (signal strength)","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"TS0601_thermostat","supports_ota":true,"vendor":"TuYa"},"endpoints":{"1":{"bindings":[],"clusters":{"input":["genBasic","genGroups","genScenes","manuSpecificTuya"],"output":
[Added} Is this your thermostat? https://www.zigbee2mqtt.io/devices/TS06 ... ostat.html

Can you tell me what data you want to access? Temperature, Setpoint and Mode are supported.
Setpoint and Temperature are in degreees Celsius.
For Mode you can have heat, cool, heatcool, auto, fan-only, purifier, eco and dry. What is supported?
What is your "Friendly Name"?

Regards

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

Posted: Monday 08 March 2021 19:06
by EddyG
Just to inform, in case you missed it. From https://node-red-google-home.herokuapp.com/login

Code: Select all

Being a big project hosted in the cloud, it will eventually require a subscription (probably around 2-3 eur/month) but it will always offer a free account type (probably with a limit on the number of devices).
There is free (for ever) code on this forum without third party involved. It is called DZGA. :)