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

Alexa, Google Home and Siri

Moderator: leecollings

Post Reply
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

Can you post the flow and/or a screenshot of what you have created, so far?

Regards
twoenter
Posts: 76
Joined: Sunday 17 February 2019 15:01
Target OS: NAS (Synology & others)
Domoticz version: 4.10
Contact:

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

Post by twoenter »

FireWizard wrote: Friday 03 April 2020 14:47 Hi,

Can you post the flow and/or a screenshot of what you have created, so far?

Regards
Thanks for helping

This is my flow

Image

Code: Select all

[
    {
        "id": "4a5eccea.110c64",
        "type": "tab",
        "label": "test pvk nodered ga",
        "disabled": false,
        "info": ""
    },
    {
        "id": "3b9bcddd.dc852a",
        "type": "switch",
        "z": "4a5eccea.110c64",
        "name": "domoticz_idx_check",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1002",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "997",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 500,
        "y": 320,
        "wires": [
            [
                "ee8e350d.f25b1",
                "c68d6e.b48daa9"
            ],
            [
                "c68d6e.b48daa9"
            ]
        ]
    },
    {
        "id": "595870d9.04b8e8",
        "type": "function",
        "z": "4a5eccea.110c64",
        "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,
        "x": 1040,
        "y": 320,
        "wires": [
            [
                "817e59a1.f872c"
            ]
        ],
        "info": "van msg.topic (dat is idx) \nen msg.payload = true or fale \neen domoticz mqtt bericht maken"
    },
    {
        "id": "817e59a1.f872c",
        "type": "json",
        "z": "4a5eccea.110c64",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 1250,
        "y": 400,
        "wires": [
            [
                "52085ba0.f74c14",
                "ef9e75ed.a8c3a"
            ]
        ]
    },
    {
        "id": "ee8e350d.f25b1",
        "type": "nora-switch",
        "z": "4a5eccea.110c64",
        "devicename": "testknop",
        "roomhint": "Woonkamer",
        "name": "testknop",
        "passthru": false,
        "nora": "a712ce22.fd8b8",
        "topic": "510",
        "onvalue": "true",
        "onvalueType": "bool",
        "offvalue": "false",
        "offvalueType": "bool",
        "x": 760,
        "y": 240,
        "wires": [
            [
                "595870d9.04b8e8",
                "bb37838b.35bae"
            ]
        ]
    },
    {
        "id": "fbf01029.851e58",
        "type": "comment",
        "z": "4a5eccea.110c64",
        "name": "Useful links",
        "info": "https://www.domoticz.com/forum/viewtopic.php?f=69&t=27588\nhttps://flows.nodered.org/node/node-red-contrib-nora\nhttps://discourse.nodered.org/t/node-red-google-home-integration/4829\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": 110,
        "y": 40,
        "wires": []
    },
    {
        "id": "8685d1e9.f2c4e8",
        "type": "mqtt in",
        "z": "4a5eccea.110c64",
        "name": "Bericht van domoticz (UIT) naar GA",
        "topic": "domoticz/out",
        "qos": "0",
        "datatype": "auto",
        "broker": "6242ef98.a960d",
        "x": 160,
        "y": 760,
        "wires": [
            [
                "5d9862b2.c9b1ac"
            ]
        ]
    },
    {
        "id": "9921ba31.f2255",
        "type": "debug",
        "z": "4a5eccea.110c64",
        "name": "debugging",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 726,
        "y": 556,
        "wires": []
    },
    {
        "id": "5d9862b2.c9b1ac",
        "type": "json",
        "z": "4a5eccea.110c64",
        "name": "json convert",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 250,
        "y": 660,
        "wires": [
            [
                "ab43c9d3.5f8b08",
                "22faa080.73b01"
            ]
        ]
    },
    {
        "id": "ab43c9d3.5f8b08",
        "type": "switch",
        "z": "4a5eccea.110c64",
        "name": "switchtype_check",
        "property": "payload.switchType",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "On/Off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 230,
        "y": 540,
        "wires": [
            [
                "d02788d2.c3b388",
                "9921ba31.f2255"
            ]
        ]
    },
    {
        "id": "95188afc.1e3768",
        "type": "comment",
        "z": "4a5eccea.110c64",
        "name": "er is een pakket met switchtype On/Off",
        "info": "kijkt naar switchtype \"On/Off\"",
        "x": 470,
        "y": 580,
        "wires": []
    },
    {
        "id": "d02788d2.c3b388",
        "type": "function",
        "z": "4a5eccea.110c64",
        "name": "convert message",
        "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,
        "x": 250,
        "y": 400,
        "wires": [
            [
                "3b9bcddd.dc852a",
                "e31ee032.c53658"
            ]
        ]
    },
    {
        "id": "bb37838b.35bae",
        "type": "debug",
        "z": "4a5eccea.110c64",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 850,
        "y": 120,
        "wires": []
    },
    {
        "id": "502ea749.7923c8",
        "type": "comment",
        "z": "4a5eccea.110c64",
        "name": "GA heeft false of true nodig in de body",
        "info": "een GA bericht maken\nbevat msg.payload = false or true\ntopic = idx\ningeval een switch",
        "x": 490,
        "y": 440,
        "wires": []
    },
    {
        "id": "52085ba0.f74c14",
        "type": "mqtt out",
        "z": "4a5eccea.110c64",
        "name": "Bericht van GA naar domoticz (IN) ",
        "topic": "domoticz/in",
        "qos": "",
        "retain": "",
        "broker": "6242ef98.a960d",
        "x": 1540,
        "y": 560,
        "wires": []
    },
    {
        "id": "a6fc112d.39f25",
        "type": "comment",
        "z": "4a5eccea.110c64",
        "name": "uit domoticz naar google naar boven",
        "info": "bericht uit domoticz",
        "x": 481.5,
        "y": 761,
        "wires": []
    },
    {
        "id": "22faa080.73b01",
        "type": "debug",
        "z": "4a5eccea.110c64",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 730,
        "y": 660,
        "wires": []
    },
    {
        "id": "e31ee032.c53658",
        "type": "debug",
        "z": "4a5eccea.110c64",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 725.5,
        "y": 471,
        "wires": []
    },
    {
        "id": "c68d6e.b48daa9",
        "type": "debug",
        "z": "4a5eccea.110c64",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 728.5,
        "y": 394,
        "wires": []
    },
    {
        "id": "ef9e75ed.a8c3a",
        "type": "debug",
        "z": "4a5eccea.110c64",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 1450,
        "y": 480,
        "wires": []
    },
    {
        "id": "a712ce22.fd8b8",
        "type": "nora-config",
        "z": "",
        "name": "Wouter",
        "group": "",
        "notify": false
    },
    {
        "id": "6242ef98.a960d",
        "type": "mqtt-broker",
        "z": "",
        "name": "localhost1883",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]
Check my Domoticz tutorials, ESP8266 and Synology blog at https://www.twoenter.nl/blog
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

@twoenter

I have loaded your supplied flow into Node Red, and everything is fine.
You flow is more or less identical to mine, except some minor details.

Your error messages however indicate some issues with the MQTT configuration node.
Might their be any conflict? The SyntaxError (Invalid regular expression) is very strange, as there is not much you can do wrong.
However you did not insert in the outgoing node the values for QoS and Retain. I suggest you fill in the required field.

Screenshot_test-flow.png
Screenshot_test-flow.png (86.51 KiB) Viewed 2659 times
As you can see, it is connected. I have Node Red and Mosquitto running on the same device, so localhost works for me as well.

One thing is that the Topic (IDX) in your Nora node does not match with those in the split node.

So check your config.

Regards
twoenter
Posts: 76
Joined: Sunday 17 February 2019 15:01
Target OS: NAS (Synology & others)
Domoticz version: 4.10
Contact:

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

Post by twoenter »

I have a connection now.

I installed node js v12 and ran

Code: Select all

sudo npm install node-domoticz-mqtt
see https://www.domoticz.com/forum/viewtopi ... 21&t=10190
Maybe it is not nessesary and did node 12 the trick. I don't know.

when I start node-red I see

Code: Select all


4 Apr 12:15:27 - [info] Starting flows
4 Apr 12:15:28 - [info] Started flows
4 Apr 12:15:28 - [info] Server now running at http://127.0.0.1:1880/
4 Apr 12:15:28 - [info] [mqtt-broker:1] Connected to broker: mqtt://127.0.0.1:1883

the broker message did not show up earlier.



It is working!!
Check my Domoticz tutorials, ESP8266 and Synology blog at https://www.twoenter.nl/blog
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

@twoenter

That is nice. I don't think, you need the Domoticz node.
You will not find it in Node Red palette.

I don't use it.

Which was your NodeJS version?

Regards
twoenter
Posts: 76
Joined: Sunday 17 February 2019 15:01
Target OS: NAS (Synology & others)
Domoticz version: 4.10
Contact:

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

Post by twoenter »

FireWizard wrote: Saturday 04 April 2020 23:18 Hi,

@twoenter

That is nice. I don't think, you need the Domoticz node.
You will not find it in Node Red palette.

I don't use it.

Which was your NodeJS version?

Regards

Ok I will delete it. I was using nodejs 8.


When i close my putty session node red stops working. Do I need to configure it as a service (deamon)? How can I configure it on synology nas?

I red about pm2. But it throws errors when I try to install it. Something about Zlib.
Check my Domoticz tutorials, ESP8266 and Synology blog at https://www.twoenter.nl/blog
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

HI,

@twoenter

You wrote:
I was using nodejs 8.
According to https://nodered.org/docs/faq/node-versions, this should not have caused that issue.
However the version went "End of Live" by December 31st, 2019. So it is good that you have upgraded.
When i close my putty session node red stops working.
That is probably because you did started Node Red with the command: node red.

See at: https://nodered.org/docs/getting-started/local
Once installed as a global module you can use the node-red command to start Node-RED in your terminal. You can use Ctrl-C or close the terminal window to stop Node-RED.
Do I need to configure it as a service (daemon)?
See: https://nodered.org/docs/getting-started/raspberrypi
Running as a service

The install script for the Pi also sets it up to run as a service. This means it can run in the background and be enabled to automatically start on boot.

The following commands are provided to work with the service:

node-red-start - this starts the Node-RED service and displays its log output. Pressing Ctrl-C or closing the window does not stop the service; it keeps running in the background
node-red-stop - this stops the Node-RED service
node-red-restart - this stops and restarts the Node-RED service
node-red-log - this displays the log output of the service
Autostart on boot

If you want Node-RED to run when the Pi is turned on, or re-booted, you can enable the service to autostart by running the command:

sudo systemctl enable nodered.service

To disable the service, run the command:

sudo systemctl disable nodered.service
How can I configure it on synology nas?
The first hit on Google about Synology NAS and Node Red will point you to:
https://www.rs-online.com/designspark/i ... nology-nas

I suppose, it will also work for you.

Regards
twoenter
Posts: 76
Joined: Sunday 17 February 2019 15:01
Target OS: NAS (Synology & others)
Domoticz version: 4.10
Contact:

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

Post by twoenter »

FireWizard wrote: Sunday 05 April 2020 16:16
I was using nodejs 8.
According to https://nodered.org/docs/faq/node-versions, this should not have caused that issue.
However the version went "End of Live" by December 31st, 2019. So it is good that you have upgraded.
When I have node 12 installed and I want to install PM2 to run node-red as a service like your last link describe, it fails. The system Zlib in DSM (Synology OS) doe not work with node 10 or 12. See : https://stackoverflow.com/questions/602 ... ance-error

The system Zlib 1.2.8 (as included in the current version of DSM by Synology) does not work with npm in Node v12 or v10, as noted at https://github.com/nodejs/node/issues/2 ... -474484250

Synology's earlier versions of Node (e.g. v8) do not have this issue and npm works normally. I just ran across this error (npm can't do anything useful) with Node v12 on my Synology and backing off to Node v8 does make the issue go away.
So I have to stay with node 8 when I want to run node-red as a service via PM2. As I am not running on a pi I don't have the commands node-red-start, restart and stop. I have to use PM2 like in your link which cannot be installed on synology with node 12. The install of pm2 with node8 is succesful, when I start node-red this is my node-red start log:

Code: Select all


admin@SYNOLOGY_NAS:~$ node-red
6 Apr 08:26:14 - [info]

Welcome to Node-RED
===================

6 Apr 08:26:14 - [info] Node-RED version: v1.0.4
6 Apr 08:26:14 - [info] Node.js  version: v8.9.4
6 Apr 08:26:14 - [info] Linux 3.10.105 arm LE
6 Apr 08:26:20 - [info] Loading palette nodes
6 Apr 08:26:31 - [info] Settings file  : /var/services/homes/admin/.node-red/settings.js
6 Apr 08:26:31 - [info] Context store  : 'default' [module=memory]
6 Apr 08:26:31 - [info] User directory : /var/services/homes/admin/.node-red
6 Apr 08:26:31 - [warn] Projects disabled : editorTheme.projects.enabled=false
6 Apr 08:26:31 - [info] Flows file     : /var/services/homes/admin/.node-red/flows_SYNOLOGY_NAS.json
6 Apr 08:26:31 - [info] Server now running at http://127.0.0.1:1880/
6 Apr 08:26:31 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

6 Apr 08:26:31 - [info] Starting flows
6 Apr 08:26:31 - [error] [mqtt-broker:c850803c.f50b08] 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
6 Apr 08:26:31 - [error] [mqtt in:66e8774.81da788] missing broker configuration
6 Apr 08:26:31 - [info] Started flows
The broker is not working :( with node8

IfI try
Autostart on boot

If you want Node-RED to run when the Pi is turned on, or re-booted, you can enable the service to autostart by running the command:

sudo systemctl enable nodered.service

To disable the service, run the command:

sudo systemctl disable nodered.service
I have systemctl not found error.

Code: Select all

sudo systemctl enable nodered.service
sudo: systemctl: command not found



Is there a way to run node-red as a service without pm2 and with node 12?
Check my Domoticz tutorials, ESP8266 and Synology blog at https://www.twoenter.nl/blog
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

The conclusion so far is:

1. Node Red is not correctly functioning under NodeJS v8
2. Node Red is functioning on NodeJS v12, but not able to install it as a service.

Correct?

Of course there is a way in between.

I have used Node Red for a longer time on v10, which is also a LTS version.
Currently I run on the latest v11 (11.15), that is available for arm v6 (like the Raspberry Pi 1B)

All versions functions fine, but only used on the Raspberry Pi (I do not own a Synology NAS)

Can you try version 10 or, if you are fine with a "non supported" version, version 11?
You can find them here: https://nodejs.org/en/download/releases/

Regards
twoenter
Posts: 76
Joined: Sunday 17 February 2019 15:01
Target OS: NAS (Synology & others)
Domoticz version: 4.10
Contact:

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

Post by twoenter »

FireWizard wrote: Monday 06 April 2020 15:24 Hi,

The conclusion so far is:

1. Node Red is not correctly functioning under NodeJS v8
2. Node Red is functioning on NodeJS v12, but not able to install it as a service.

Correct?
Correct.

There is no synology package available for node 10 or 11 so I have to try to install a not supported version. Like you said.

If there is a other solution to run process in the background, let me know. In that case I will stay with node 12.
Check my Domoticz tutorials, ESP8266 and Synology blog at https://www.twoenter.nl/blog
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi.

@twoenter

As said, I do not own a Synology NAS and so I have no experience with it.

You wrote:
If there is a other solution to run process in the background, let me know. In that case I will stay with node 12.
Here: https://blog.spaps.de/run-command-in-ba ... ology-nas/, I found nohup <command> &.

This is in all unixes the same.

So you can try that.

Regards
twoenter
Posts: 76
Joined: Sunday 17 February 2019 15:01
Target OS: NAS (Synology & others)
Domoticz version: 4.10
Contact:

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

Post by twoenter »

FireWizard wrote: Monday 06 April 2020 21:14
If there is a other solution to run process in the background, let me know. In that case I will stay with node 12.
Here: https://blog.spaps.de/run-command-in-ba ... ology-nas/, I found nohup <command> &.

This is in all unixes the same.

So you can try that.

node-red still running since yesterday after running command:

Code: Select all

nohup your_command >out.log &
And in task manager for starting node-red after boot

Code: Select all

#!/bin/sh
HOME=/root
source $HOME/.profile
PATH=/opt/bin:/opt/sbin:$PATH
/usr/bin/node-red

thank you
Check my Domoticz tutorials, ESP8266 and Synology blog at https://www.twoenter.nl/blog
Thelion
Posts: 54
Joined: Saturday 08 October 2016 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: The Netherlands
Contact:

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

Post by Thelion »

Great solution, and free!

I do have a strange issue.

When I switch a light (IDX 423) on or off through Google Assistant, the MQTT command does arrive in Domoticz and it even switches the icon in Domoticz on and off, which proves that Domoticz does what it is supposed to, but the light doesn't turn on or off.

Code: Select all

MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":423,"switchcmd":"On"}
The light itself is controlled by a Sonoff, which is controlled through MQTT for switching on and off.

Any ideas why Domoticz doesn't relay the on/off command to the Sonoff?

I tried it with a second Sonoff (IDX 470), and that behaves exactly the same.

Code: Select all

 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":470,"switchcmd":"On"}
Or should I direct the MQTT command to the Sonoff in stead of Domoticz?

Any thoughts?

*** UPDATE ***

When trying exactly the same with a Shelly switch, is does work without any issues. The Shelly is also controlled by MQTT, but differently so it seems.
Strange.....
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

HI,

@Thelion
Any ideas why Domoticz doesn't relay the on/off command to the Sonoff?
See: https://www.domoticz.com/forum/viewtopi ... TT#p243865

You have to be on the latest beta.

Did you set the Prevent Loop to "False"?

Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

I use the thermostat node in combination with a Nefit Moduline 400 thermostat.

This thermostat has 3 different modes:
1. Auto
2. Manual
3. Off

The EMS-ESP software publishes the data to MQTT as follows:
Thermostat mode auto:
hc1: object
seltemp: 22 number
currtemp: 25.1 number
mode: "auto" string

Thermostat mode manual:
hc1: object
seltemp: 21
currtemp: 25.1
mode: "day"

Thermstat mode off:
hc1: object
seltemp: 12
currtemp: 25.2
mode: "night"
The Nora thermostat mode accepts the following nodes:

Screenshot_Thermostat-nora config.png
Screenshot_Thermostat-nora config.png (43.72 KiB) Viewed 2491 times
This values corresponds with the Google requirements.
You can find these at: https://developers.google.com/assistant ... uresetting

"On" is in fact not a mode, but switches back to the previous mode, if the mode is "Off"
I had to convert the modes from the thermostat (auto, day and night) to the requirements of Google Assistant and Nora.
So "auto" stays "auto", "day" (manual) becomes "heat" and "night" becomes "off".
This is done in a function node with the following contents:

Code: Select all

var mode = {};
switch (msg.payload.hc1.mode) {

    case "auto":
    mode = "auto";
    break;

    case "day":
    mode = "heat";
    break;

    case "night":
    mode = "off";
    break;
}

msg.payload = {
    setpoint : msg.payload.hc1.seltemp,
    temperature : msg.payload.hc1.currtemp,
    mode : mode
};
return msg
This functions perfect as the following picture shows.
Screenshot_Thermostat.png
Screenshot_Thermostat.png (16.14 KiB) Viewed 2491 times
The problem is in fact what you see in the Google Home app and what you see and hear in the Google Nest Hub.

The Google Home app display the auto mode as "Other" and indicates nicely the room temperature.
The other two nodes "Heat" and "Off" are recognized.

If you ask the Google Nest Hub for the temperature in the Living room (Woonkamer) it will tell you that the thermostat is set to automatic mode and the setpoint is (in my case) 22 degrees. However the display shows that the current mode is not supported.
The other modes (Heat and Off) are shown if you touch the "mode button". However it will not tell you the Living room temperature, what I asked for.

At a Home Assistant thread on Github (https://github.com/home-assistant/core/issues/30009) I found the following:
Got a response from Google confirming that we should return heatcool instead of auto when the HVAC mode in Home Assistant is auto.
This thread is about an Ecobee thermostat, but I think, as it is a Google issue, that it might be applicable for all thermostats linked to Google Assistant.

Is there anybody with a similar or other experience?
I look forward to some response.

Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

Some interesting review/documentation regarding nora.

https://notenoughtech.com/home-automati ... n-nodered/

Regards
delfisastre
Posts: 18
Joined: Wednesday 05 October 2016 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Catalonia, Barcelona
Contact:

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

Post by delfisastre »

salvacalatayud wrote: Thursday 02 April 2020 19:19
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!!!
Hello,

This functions works good, but my shutter it's inverted. When I say opens the shutter close... How can I fix?
Thanks!!!
delfisastre
Posts: 18
Joined: Wednesday 05 October 2016 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Catalonia, Barcelona
Contact:

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

Post by delfisastre »

Sorry I solved! invert value in my node.
DennisHermse
Posts: 2
Joined: Saturday 16 May 2020 10:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

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

Post by DennisHermse »

Hey guys,

I'm quite new to domoticz and node-red.

Does anyone know if it's also possible to send a google assistent command (e.g. "play 3FM radio") to a google speaker from node-red?
I would like to start the radio on my google home speaker when I enter a room on a specific time (e.g. entering in the dining room in the morning for breakfast).

I would like to use a motion sensor and the date/time variable to trigger this google assistent command.

I tried to search to forum but couldn't find it, maybe someone can help me out?
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

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

Post by FireWizard »

Hi,

@DennisHermse

The "speaker" node supports currently only:

Input payload can have one or more be of the following properties:
on - boolean. Speaker on or off state.
volume - number (0-100). represents the current volume of the speaker;

With the "Google Home" node you can cast a mediaURL to your speaker.

So, Yes, I think what you want to achieve is possible.

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest