Page 3 of 5

Re: Google Home

Posted: Tuesday 03 October 2017 23:54
by Wob76
Hi Bryan241,

The limiting factor is IFTTT, it does support secure connections, but only using basic auth, and does require you putting a username\path into the URL on IFTTT, now my reading tells me that IFTTT stores these in a secure manner, sharing of "recipes" is no longer supported, but take that with a grain of salt. To reduce my risk I created a special IFTTT user so as to limit access.

The url will look something like https://ifttt_username:ifttt_password@SERVER_IP:443/json.htm?type=command&param=updateuservariable&vname=GH_Request&vtype=2&vvalue={{TextField}}

I have further developed my flow, it now supports Actions for configured devices as well as an "Advanced" function, but that only includes a built response for my AC, any Advanced function would require the user to build the response. Actions work with switches and Thermostats, I did build in Selector Switches before I realised IFTTT will not let me send 2 Text Fields, so it doesn't work at the moment.

If there is any interest I will post an update, including how IFTTT needs to be configured with the new flow.

Wob

Re: Google Home

Posted: Wednesday 04 October 2017 7:07
by jeroenkl
Wob76 wrote: Tuesday 03 October 2017 23:54 Hi Bryan241,

The limiting factor is IFTTT, it does support secure connections, but only using basic auth, and does require you putting a username\path into the URL on IFTTT, now my reading tells me that IFTTT stores these in a secure manner, sharing of "recipes" is no longer supported, but take that with a grain of salt. To reduce my risk I created a special IFTTT user so as to limit access.

The url will look something like https://ifttt_username:ifttt_password@SERVER_IP:443/json.htm?type=command&param=updateuservariable&vname=GH_Request&vtype=2&vvalue={{TextField}}

I have further developed my flow, it now supports Actions for configured devices as well as an "Advanced" function, but that only includes a built response for my AC, any Advanced function would require the user to build the response. Actions work with switches and Thermostats, I did build in Selector Switches before I realised IFTTT will not let me send 2 Text Fields, so it doesn't work at the moment.

If there is any interest I will post an update, including how IFTTT needs to be configured with the new flow.

Wob
Yes please

Re: Google Home

Posted: Wednesday 04 October 2017 7:11
by jeroenkl
bryan241 wrote: Tuesday 03 October 2017 12:40 This IFTTT solution looks nice, but what I don't like is to open up unsecured connections to domoticz.

From what I understand is that you need to use unsecured http url's to connect to domoticz.

Is there a way to make the communication secure?

I'm currently using ha bridge locally, but it only supports ON/OFF/DIM commands (as stated before).
I would like to be able to send custom commands, but it must be secure.
Same issue, request at my side, somebody can advice?

Re: Google Home

Posted: Wednesday 04 October 2017 7:15
by Wob76
jeroenkl wrote: Wednesday 04 October 2017 7:11 Same issue, request at my side, somebody can advice?
Are you referring to securing IFTTT? I thought I answered that in my last post? It has limitation, but it is possible.

Re: Google Home

Posted: Wednesday 04 October 2017 7:29
by jeroenkl
Wob76 wrote: Wednesday 04 October 2017 7:15
jeroenkl wrote: Wednesday 04 October 2017 7:11 Same issue, request at my side, somebody can advice?
Are you referring to securing IFTTT? I thought I answered that in my last post? It has limitation, but it is possible.
Ok got it, sorry. I'll try to set it up this afternoon, thanks!

Re: Google Home

Posted: Wednesday 04 October 2017 7:36
by Wob76
I will post an update for action control in my flow, but you can get responses using the previous flow, and as I mention using basic auth with IFTTT.

Re: Google Home

Posted: Sunday 08 October 2017 12:13
by msvds
Wob76 wrote: Wednesday 04 October 2017 7:36 I will post an update for action control in my flow, but you can get responses using the previous flow, and as I mention using basic auth with IFTTT.
I am really looking forward on an update on this. I've followed Bradds and then Wob76 instructions, but I haven't got a response yet from Google Home. The value of the user variable is changing, but from there I am lost in how to debug what's going wrong.

Could you please explain in a bit more detail how to define the Regex expressions? And in which step of the process are they used? I clearly miss something here, probably because Node Red is also completely new to me. Perhaps a small flowchart would help to explain it?

Another question, how can I see what exactly happens in Node Red? I'd like to debug what's going on in there when IFTTT sends the webhook to domoticz.

Anothing thing that perhaps influences why it doesn't work for me is that I use the Google assistant on my NVidia Shield. This option has recently become available, so there is not much information about it yet,

I am really looking forward to get this working on my side. Many thanks in all the efforts that both of you have already put into this.

Re: Google Home

Posted: Monday 09 October 2017 21:34
by bryan241
Hmm, When I try to update a variable with https and basic auth, I get the forbidden page.
But when I update a switch, it works.

Example update variable (not working):
https: //test:test@externaliptodomoticz/json.htm?type=command&param=updateuservariable&vname=Status&vtype=2&vvalue=test

Example toggle switch (working):
https: //test:test@externaliptodomoticz/json.htm?type=command&param=switchlight&idx=1&switchcmd=Toggle

The space after https is intentional. Otherwise the url got abbreviated.

Re: Google Home

Posted: Tuesday 10 October 2017 22:36
by chatainsim
bryan241 wrote: Monday 09 October 2017 21:34 Hmm, When I try to update a variable with https and basic auth, I get the forbidden page.
But when I update a switch, it works.

Example update variable (not working):
https: //test:test@externaliptodomoticz/json.htm?type=command&param=updateuservariable&vname=Status&vtype=2&vvalue=test

Example toggle switch (working):
https: //test:test@externaliptodomoticz/json.htm?type=command&param=switchlight&idx=1&switchcmd=Toggle

The space after https is intentional. Otherwise the url got abbreviated.
Can you try to change your IFTTT user to admin user and try again ?
I think only the admin user can update variable.

Re: Google Home

Posted: Wednesday 11 October 2017 18:28
by bryan241
chatainsim wrote: Tuesday 10 October 2017 22:36
bryan241 wrote: Monday 09 October 2017 21:34 Hmm, When I try to update a variable with https and basic auth, I get the forbidden page.
But when I update a switch, it works.

Example update variable (not working):
https: //test:test@externaliptodomoticz/json.htm?type=command&param=updateuservariable&vname=Status&vtype=2&vvalue=test

Example toggle switch (working):
https: //test:test@externaliptodomoticz/json.htm?type=command&param=switchlight&idx=1&switchcmd=Toggle

The space after https is intentional. Otherwise the url got abbreviated.
Can you try to change your IFTTT user to admin user and try again ?
I think only the admin user can update variable.
I've tried to update a variable using an admin user, but that also does not work.

I'm going to try the reverse proxy method using nginx, but any tips to do this without nginx are welcome

Re: Google Home

Posted: Friday 13 October 2017 3:44
by Wob76
This is the URL taken from my Applet, no issues with updating the variable, using HTTPS and my ifttt user, which currently has admin access. Note I am using a non standard SSL port of 1443, but that should have little effect, my Variable has been changed from "Status" to "GH_Request" but it worked with both.

https: //ifttt:[email protected]:1443/json.htm?type=command&param=updateuservariable&vname=GH_Request&vtype=2&vvalue={{TextField}}

No reverse proxy here, have you tried just using your browser to do the update, do you see any json response?

Re: Google Home

Posted: Friday 13 October 2017 12:26
by Bradds
msvds wrote: Sunday 08 October 2017 12:13
Wob76 wrote: Wednesday 04 October 2017 7:36 I will post an update for action control in my flow, but you can get responses using the previous flow, and as I mention using basic auth with IFTTT.
I am really looking forward on an update on this. I've followed Bradds and then Wob76 instructions, but I haven't got a response yet from Google Home. The value of the user variable is changing, but from there I am lost in how to debug what's going wrong.

Could you please explain in a bit more detail how to define the Regex expressions? And in which step of the process are they used? I clearly miss something here, probably because Node Red is also completely new to me. Perhaps a small flowchart would help to explain it?

Another question, how can I see what exactly happens in Node Red? I'd like to debug what's going on in there when IFTTT sends the webhook to domoticz.

Anothing thing that perhaps influences why it doesn't work for me is that I use the Google assistant on my NVidia Shield. This option has recently become available, so there is not much information about it yet,

I am really looking forward to get this working on my side. Many thanks in all the efforts that both of you have already put into this.
Hi msvds.

First of all, you need an actual google home device and a raspberry pi for any of this to work in relation to google home speaking out status commands etc. It should work for switching stuff in domoticz but you wont get any feedback from your Nvidia shield device. (unless someone creates a node for this) I don't have a Nvidia shield device so cannot comment.

Assuming you have a raspberry pi, If you followed my instructions and are getting google assistant to update the uservariable, but are not getting anything in node red, then the problem is most likely with your domoticz to node-red link via MQTT.
Basically, what happens when you update the "Status" uservariable in domoticz, it activates the virtual "Status" switch. This "switch change" is then sent to the MQTT server (mosquitto) and the previously posted flows in node-red then look at the MQTT server for this switch activation, once detected it then requests the uservariable "Status" text from domoticz and compares that text with whatever you have in the filter. For testing purposes you don't need regex expressions in the filter, just whatever matches your uservariable text. Once the match is made, the flow output then continues to whatever action you want it to perform.

Code: Select all

[{"id":"1245edb.3d83f12","type":"mqtt in","z":"113cf1c6.2fcb7e","name":"dom local output","topic":"domoticz/out","qos":"0","broker":"32aa3862.20a188","x":85,"y":1305.781494140625,"wires":[["3657faff.9ce496","1f947d50.047ab3"]]},{"id":"1f947d50.047ab3","type":"debug","z":"113cf1c6.2fcb7e","name":"","active":true,"console":"false","complete":"false","x":265,"y":1305,"wires":[]},{"id":"32aa3862.20a188","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]
If you import the above flow into node-red and deploy it, it should say connected below the "dom local output" mqtt in node (purple one). The green debug node will show you all data being received from domoticz via mqtt (in the debug tab under the Deploy button in node-red).

If it does not say connected with the green dot next to it, then this is your problem.

There is already a very good Wiki explaining the dom to node red link and how to set it up here http://www.domoticz.com/wiki/MQTT

To summarize.

When you say "OK, Google, check test status" - The text "check test status" is sent to the IFTTT server and checked against any applets you have created, in this case the applet that you created for "Check $ status". It then substitutes the $ for the text you spoke, ie "test". This text is then added to the end of the json command send back to your domoticz server via the webhooks link which updates the uservariable called "Status" with the word "test"

Once domoticz detects the uservariable has changed, it then turns on the virtual switch called "status" and sends this "On command" to the MQTT server you have setup.

If it is all setup correctly, then Node-red is always looking at the information coming from the MQTT server and filters out the idx associated with the "Status" switch. Once this passes the IDX filter, it then requests the uservariable text from the uservariable "Status" in domoticz, which in this example would be "test"
It then passes the text "test" through a filter to output that command to do whatever you want with it.

There is a wealth of information already out there explaining in detail how to setup the dom to node red link, once you have this working it should then be self explanatory once you import the previously posted flows from either myself or wob.

If you just want to test the link between node red and your google home device. Import this flow and change the IP to that of your google home device.

Code: Select all

[{"id":"e45c4431.1b9408","type":"function","z":"fc663e33.3144c","name":"Change IP to the IP of your google home device","func":"msg.payload = {\n    ip: '192.168.1.2',\n    url: 'http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=this is a test message&tl=En-gb',\n    contentType: 'audio/mp3',\n};\nreturn msg;","outputs":1,"noerr":0,"x":509,"y":274,"wires":[["3eaf7cdf.8b0e74"]]},{"id":"3eaf7cdf.8b0e74","type":"chromecast-play","z":"fc663e33.3144c","name":"","url":"","contentType":"","ip":"","x":796,"y":274,"wires":[[]]},{"id":"a148fe81.1ec6c","type":"inject","z":"fc663e33.3144c","name":"Test switch","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":224,"y":276,"wires":[["e45c4431.1b9408"]]}]
This would still work If you have a chromecast audio device for reading out responses, just substitute the ip address in the function for your chromecast audio device. Alternatively, you could substitute the chromecast "play" node for a (node-red-contrib-audio) node and this would play the responses out of your raspberry pi audio connections instead. Example below.

Code: Select all

[{"id":"7dedf4ad.13adbc","type":"function","z":"1f3a73d7.20eacc","name":"Test message to raspberry pi speakers","func":"msg.payload = 'http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=this is a test message&tl=En-gb';\nreturn msg;","outputs":1,"noerr":0,"x":533,"y":187,"wires":[["222efc84.909734"]]},{"id":"60e25d54.b12174","type":"inject","z":"1f3a73d7.20eacc","name":"Test Switch","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":288,"y":189,"wires":[["7dedf4ad.13adbc"]]},{"id":"222efc84.909734","type":"audio","z":"1f3a73d7.20eacc","x":782,"y":186,"wires":[]}]
Regards.

Re: Google Home

Posted: Friday 13 October 2017 22:28
by bryan241
Wob76 wrote: Friday 13 October 2017 3:44 This is the URL taken from my Applet, no issues with updating the variable, using HTTPS and my ifttt user, which currently has admin access. Note I am using a non standard SSL port of 1443, but that should have little effect, my Variable has been changed from "Status" to "GH_Request" but it worked with both.

https: //ifttt:[email protected]:1443/json.htm?type=command&param=updateuservariable&vname=GH_Request&vtype=2&vvalue={{TextField}}

No reverse proxy here, have you tried just using your browser to do the update, do you see any json response?
I currently only test with the browser.
When I modify your link to connect to domoticz from a browser I get the 403-forbidden page after the notification that I'm going to login using the ifttt user.

I've installed a fresh domoticz (latest stable and latest beta) on a spare pi with the same security settings.
Tried other browsers, but could not update the variable.
Only when turning the security off, I can change the variable.

Re: Google Home

Posted: Tuesday 17 October 2017 20:02
by maxtrash
bloody brilliant! I got it to work reasonably quickly.

how big is the risk using something like http ://user:password@ipaddress:8080/json.htm?type=command&param=updateuservariable&vname=Status&vtype=2&vvalue={{TextField}}

in my router I've set up port forwarding of that port 8080 to my local IP.
I guess some computer in between IFTTT and my IP can read the password (which is obviously only used for this call and not anywhere else). Using that password some devices could be switched on and off, and data could be read. Not really something I appreciate but I would be more worried about opening the web page of domoticz by port forwarding.
Would using my.domoticz.com be useful or even possible? (so I'm rather clueless with regards to this topic)

update: chaning to ssl port 443 works fine too

Re: Google Home

Posted: Friday 20 October 2017 0:12
by Bradds
There is a new node for sending speech to google home (and other chromecast devices). It works well and even has a search function.
Available here - https://github.com/noelportugal/google-home-notifier

Re: Google Home

Posted: Friday 03 November 2017 9:53
by lassiko
I was following these nice instructions from Bradds and Wob76, and got things almost working.
What i cannot seems to figure out is device filtering part, how to do this? Output from Google Home is at the moment for my Check $ Status: "The device, $device, has not been configured"

Am i missing a idx setup from some point or what..?

E.g. i have e switch: "Front Door" with idx=3. When i ask google "Check Front door status" uservariable changes to Front door and Status switch gets updated -> activates the Node-red. Node-red flow goes through without errors and Google Home speaks: "The device, $device, has not been configured"

Thank you!

Re: Google Home

Posted: Friday 03 November 2017 22:28
by Bradds
Hi.

If you are getting that response, you must be using wob's flow.

Check you have included the "GoogleHome: (the )?(front door)" text in the description of your front door switch.

the regex text in the switch description has to match exactly the value in the variable.

Re: Google Home

Posted: Thursday 09 November 2017 15:19
by Fainted
Hi

Since there is an google home API i guess we would be able to build an "hardware plugin" in Domoticz for google assistent? I think that would be awesome if it's possible if some of us were able to do that. Unfortunatly I don't think I have the skills.

https://developers.google.com/actions/tools/
https://developers.google.com/actions/s ... create-app

Re: Google Home

Posted: Thursday 09 November 2017 17:18
by Madgeni
Hi -
i built the Controlicz app for Alexa - and am pleased to announce that i'm extending to include Google (Home and Assistant).
It's currently in beta, but has been submitted for certification.
Functionality (subject to additional testing from users) is:

Discovery of devices
Control of switches (On/Off)
Control of lights (On/Off/Brightness)
Control of Scenes & Groups (On/Off)
Query of devices (is this thing on? What is the temperature of that?)

Re: Google Home

Posted: Thursday 09 November 2017 17:30
by Phantom
Hey Madgeni, is your software opensource or in any way to run it on my own system?