IFTTT to control Domoticz

Alexa, Google Home and Siri

Moderator: leecollings

Post Reply
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

IFTTT to control Domoticz

Post by QNTL »

First of all; Hello.

For a couple of years I've read plenty of post on this site, and today I needed to register, because I need help.

It would be very easy for you guys, so I hope we can end this topic asap :mrgreen:

I want to tell Google Assistent ; 'hey google, turn on/of the livingroom lamp'. I wanted to do this, through IFTTT, since Controlicz is paid (Maybe in the future)

Easy right. I'm a little ashamed that with this big community, I cannot fix this.
I've search many articles, but you need to know, I don't have any knowledge of coding other than Blockly.

My setup:
Domoticz on my Synology NAS
Rfxtrx433e controller
Domoticz app

What I've learned so far:
I need a external IP, and have the port open: CHECK
An IFTTT key, and have it in Domoticz: CHECK

I'll attach a the screenshot of IFTTT: From there on, I'm at a loss. What do I have to do now. Or am I taking a wrong route?

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

Re: IFTTT to control Domoticz

Post by FireWizard »

Hello QNTL,

Welcome to this forum.

You wrote:
I want to tell Google Assistent ; 'hey google, turn on/of the livingroom lamp'. I wanted to do this, through IFTTT, since Controlicz is paid (Maybe in the future)
What you want is relative simple and you have several possibilities to do it.

Whether, you need Domoticz or not, depends on the native support in Google Home for your devices (lamps).
E. g., if you want to control Philips Hue lights, you don 't need Domoticz, as Google Assistant has native support for Philips Hue.
And there are others, that are all natively supported.

As you said there are many options:

1. Controlicz, but a paid subscription. See: https://www.controlicz.com/
2. IFTTT
3. Google Python Plugin. See: https://www.domoticz.com/forum/viewtopi ... 65&t=27435
4. Google Assistant Server Python See: https://www.domoticz.com/wiki/Google_As ... ver_python and
https://github.com/DewGew/Domoticz-Google-Assistant
5 Node Red with the "nora" node, See: https://www.domoticz.com/forum/viewtopi ... de#p211482
And also: https://github.com/andrei-tatar/node-red-contrib-nora

It is even possible to stream your webpages and/or camera streams to a Google Nest Hub.
See: https://www.domoticz.com/forum/viewtopi ... 35&t=27770 and
https://www.domoticz.com/forum/viewtopi ... 83#p233183

So, as you see, there is more than one alternative for Controlicz and it is up to you to choose.
You will get support, if you indicate for which solution, you want to go.

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hi FireWizard,

Thanks for your reply.
FireWizard wrote: Sunday 19 January 2020 15:05 You will get support, if you indicate for which solution, you want to go.
I'm interessted in getting things done with IFTTT.
It seems to my it should be the easiest way to get it up and runing, since I don't have any experience in python or lua etc.
If checked all the links you've posted. I've also found some links for IFTTT, but I just don't seem to get it done, that's why I've asked the question.

For the devices I want to control is no native Google Assistent support. They are just simple 433MHz devices.
I have 5 Smart Radiator knobs (Z-wave) as well. It would be interesting to control them through Google as well, but I'm taking small steps.
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: IFTTT to control Domoticz

Post by FireWizard »

Ok QNTL,

That's a clear answer.

Once I did a test with IFTTT, which activated a virtual switch in Domoticz.
As it is some time ago, I have to look it up, what I did.

I use 433.92 MHz switches (KlikaanKlikuit/CoCo) as well, but I went for Node Red with nora node.

I will keep you informed.

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

HEllo FIreWizard,

If you could, it would be great.

I read the 'Nora' way, but stumble over one of the first steps, since I'm not familiar with it ( Open your node-red instance ).
I'll try and look into that later on, but lets focus on IFTTT for now.

Thanks in advance!
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: IFTTT to control Domoticz

Post by FireWizard »

Hello QNTL,

It has been September 2018 that I looked into IFTTT. I do not remember that an API key was mandatory. At least I do not remember, that I used it.
I don't think it is needed if you send data from IFTTT to Domoticz. From Domoticz to IFTTT you will need it.

In that time I used version 3.8153 and I do not remember if the field below has been included.

But you have your key (starting with b5LX-).

Next step is to go to Domoticz.
Go to Setup > Settings > Notifications
Somewhere in the middle left you will find:

Screenshot_IFTTT.png
Screenshot_IFTTT.png (45.92 KiB) Viewed 6175 times
Tick the box "Enabled"
Insert (Copy/Paste) your API Key
And then Click on "Here" in "Create a Maker/Webhook Here)

This will take you to: https://ifttt.com/maker_webhooks

From there you can create a webhook to activate a switch, which on its turn will switch the lamp(s).

I made two applets, one for "Lamps On" and the other for "Lamps Off".

I filled in the following for the ON applet:
Say a simple phrase

This trigger fires when you say “Ok Google” to the Google Assistant followed by a phrase you choose. For example, say “Ok Google, I’m running late” to text a family member that you’re on your way home.

What do you want to say?
Turn Room Lamps On

What's another way to say it? (optional)
Turn Lamps On

And another way? (optional)

What do you want the Assistant to say in response?
OK Done

Language

Make a web request

This action will make a web request to a publicly accessible URL. NOTE: Requests may be rate limited.

URL
https://<username>:<user password>@<IP address>:18443/json.htm?type=command&param=udevice&idx=13&nvalue=1

Surround any text with "<<>>" to escape the content
Add ingredient
Method
GET
The method of the request e.g. GET, POST, DELETE
Content Type (optional)
text/plain
Optional
Body (optional)
The URL is important.
For the <username>:<user password> you have to fill in your user name and password, that you configured in System >Website Protection
I used a non standard port (18443), which you have to forward to you Domoticz https port (probably 443) .
The remaining part (json.htm?type=command&param=udevice&idx=13&nvalue=1) describes to send nvalue=1 to a switch with IDX 13
For the OFF applet the nvalue=0
The syntax you will find at: https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s

In my opinion the disadvantage is that (again) I have to open a port that is accessible from the internet(18443).

I tested it and it worked. It was more a "proof of concept" as a real application.
I did not use the API key in the URL. May be you have to add this key.

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hi,

Can't say thanks enough.

I follow you, but there is a problem. Where do I make the applet?
IN IFTTT I only found this:

Image

And I searched another applet called: Custom Google Home Response by Grahamwalter. But it doesn't let me enter 'Language' or 'Make a web request'.
Where do I do this?

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

Re: IFTTT to control Domoticz

Post by FireWizard »

Hi,

In the top right you find "Explore", Click on it.

Screenshot_IFTTTScreen.png
Screenshot_IFTTTScreen.png (13.49 KiB) Viewed 6151 times
Then you will see "Make your own Applets from scratch and a +.

Click on the +

Click again on the + between "If" and "This"
Use "Google Assistant". Click on it and follow the Wizard.

(I do not remember this and I believe it has evaluated since September 2018, when I used it for the last time)

You have something to explore and to try.

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hello,

Baby steps, but we're getting there I guess.
The Google phrase is there, but it says 'lamp is not available'
I'll try and fiddle with it later on. If you know exactly what is wrong, I'd love to hear it.
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: IFTTT to control Domoticz

Post by FireWizard »

Hi,

Did you create a web request? If so, how does it look like?

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hello,

I did (as far as I know).
It look like this:

https://test:test@'my external ip':'my port'/json.htm?type=command&param=switchlight&idx=3&switchcmd=On

Do I need to put something in front/at the end? You've mentioned this:
I did not use the API key in the URL. May be you have to add this key.
Maybe that is the solution? How should I add it?
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: IFTTT to control Domoticz

Post by FireWizard »

Hi QNTL,

I had created in Domoticz a virtual switch. It was not connected to something. Just for test.

I was able to switch it "ON" and "OFF" with the command:
https://<username>:<user password>@<IP address>:18443/json.htm?type=command&param=udevice&idx=13&nvalue=1
and
https://<username>:<user password>@<IP address>:18443/json.htm?type=command&param=udevice&idx=13&nvalue=0

I know, this is a command for updating a sensor.

But as said, I did not use any API key.

I will try and see, if this still works
[Update Edit] It does not work anymore. I created a new Webhook and try to get it running.
It has probably something to do with the password. See: https://www.domoticz.com/wiki/IFTTT_int ... h_Domoticz
See also: https://www.domoticz.com/forum/viewtopic.php?t=22687 and https://www.domoticz.com/forum/viewtopic.php?t=25363

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hi,

Thanks for the help.
I didn't got much time today, so only one quick update.
If received this error in IFTTT:
Unable to make web request: Error: write EPROTO 139776656385856:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:782:
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hello hello,

Back again. Big step today.

If got the right Webhook. It is this:
https://<domoticz public IP or URL>:<port>/json.htm?username=<user in base64 code>&password=<password in base64 code>&type=command&param=switchlight&idx=3&switchcmd=On
I used https://codebeautify.org/base64-encode Which worked perfect. Just keep in mind you have to encode the username and the password seperatly. At the first try, I combined them with the ':' in between.

When I put a bizar phrase in IFTTT, it works e.g. Blue Red Circle
I don't really want to see 'Hey Google, Blue Red Circle' to turn on the light. But admitted, it works.

When I say something normal like Turn on the light, Google doesn't play well. It says 'there are no lamps found, please add them in your account.

So a whole other problem. If you were to have a solution to this, I'm all ear. If not, we can close this topic, because the initial question is asked and answered.

Again, so many thanks. Now of to problem #2. :mrgreen:
User avatar
FireWizard
Posts: 1967
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: IFTTT to control Domoticz

Post by FireWizard »

Hi,

I did see your fault message:
Unable to make web request: Error: write EPROTO 139776656385856:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:782:
This indicated an error, regarding the https request (openssl) and I saw the link where you have to create your base64 password.

I'm afraid that I cannot test it, by creating a new web-hook, as I control my lights with Node Red and nora node and another one is a Philips Hue, which has native support from Google Assistant.

Strange that you can switch on your light with such a bizarre phrase and not with something normal.

But just a thought.

As you want to control a Domoticz switch, you actually create a https request, that should activate a Domoticz Switch with (in your case) IDX = 3.
This switch activates a component that activates the lamp.
In your first post you mentioned, that you use a RfXtrx433E controller. Do you control devices (lamps) with something like KlikAanKlikUIt (CoCo)?
In this case Google Assistant is not aware of this RFXtrx433E transceiver.

If you tell Google Assistant (your IFTT applet) to switch on a Lamp or Light, Google is going to look into its list of registered lamps

I assume you don't have added the lights in your Google Home app? Do you have any Google Nest device, such as the Speaker or Hub?

If so, they should be added in your Google Home app.

You can see it in the app.

Screenshot_20200121-213929.png
Screenshot_20200121-213929.png (25.55 KiB) Viewed 6062 times
Probably "Lamps" or "Lights" are "Reserved" words for the Google Assistant and the Assistant will try the find them.
If he/she cannot find it, he/she will tell you, that they cannot be found.

If you think, this is the case, try to avoid the words "Lamp" and "Lights".

But nice that, at least, part one functions well.

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

Re: IFTTT to control Domoticz

Post by FireWizard »

Hello QNTL,

I found some time to test the new setup, so I changed some applets, I created about 1.5 years ago.

I created a IFTTT user, called IFTTT, with a password. See: https://www.domoticz.com/wiki/IFTTT_int ... h_Domoticz
I also created a virtual switch, called Test Switch IFTTT, with an IDX number of 7.

With https://codebeautify.org/base64-encode, I created the base64 encoded username for IFTTT and also the base64 encoded password.

I created two applets (for ON/OFF) with a web request with the following contents:

Code: Select all

https://<External IP Address>:<port>/json.htm?username=base64 encoded username&password=base64 encoded password&type=command&param=udevice&idx=7&nvalue=1
and

Code: Select all

https://<External IP Address>:<port>/json.htm?username=base64 encoded username&password=base64 encoded password&type=command&param=udevice&idx=7&nvalue=0
For the first test I used the following phrases:

Screenshot_IFTTT_text.png
Screenshot_IFTTT_text.png (23.36 KiB) Viewed 6046 times
Afterwards I changed the word "Switch" for "Lamp" and later also for "Light".
It did not make any difference, in all cases the virtual switch was activated (ON) and de-activated (OFF).

So no request for "'there are no lamps found, please add them in your account".

So my previous suggestion that "Lamp" or "Light" are maybe "Reserved" words doesn't seem to be true.
The only difference we have is the last part of the command.

You use: type=command&param=switchlight&idx=3&switchcmd=On.
I use: type=command&param=udevice&idx=7&nvalue=1.

I hope you will find a solution or a workaround for this strange problem.
I'm not able to reproduce it.

Regards
User avatar
QNTL
Posts: 59
Joined: Sunday 19 January 2020 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: IFTTT to control Domoticz

Post by QNTL »

Hello,

I do have a Google Home Mini.
And I'm familiar with the devices you can link to Google Home.
Those words might be reserved, because I cant make use 'lights' or 'lamp'.
Switch does seem to work.

I think this is as far as I'll get with this free solution.
Your Json rule doesn't work for me, which I find strange.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest