GioExperience
IoT, computer technology and other things
Not hobby, real stuff



Proudly made by myself
Welcome, my name is Giovanni, a 35 years old italian engineer that would like share his experience in IoT, electronic, raspberry, arduino, electrotechnic, and others things. In this blog i will try to realize a different approch to these stuff. It’s not a hobby or a toys…. I will try to explain my practical, pragmatical and REAL approch for building REAL, SAFE, and RELIABLE utilities.
all posts



Google Home and IFTTT, turn on the stove

In this post we can view a method for turn on the stove. It’s very comfortable and futuristic send command by voice to the stove… 😉 For make this things you have to knok the IFTTT service. Do you know? The website is http://www.ifttt.com/\" target=\"_blank\" rel=\"noopener\" title=\"\" style=\"box-sizing: border-box; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; font-family: "Open Sans", serif; font-size: 15px; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38); letter-spacing: normal;\">http://www.ifttt.com. ;

How works IFTTT?

IFTTT works in this way. First of all, login and subscribe with your Google Account. In this way your Google Home is automaticaly recognized. Now you have to create your first Applet. One Applet is composed by 2 parts…. the input or “This” part, and the output or the “That” part. In “This” part (the input) you have to select the service Google Assistant. Now I selected “Say a simple phrase” and i write “Turn on the stove” (realy I’m italian and I write “Accendi la stufa”).

In the second part, the “That” part, I select the service WebHook… that is a method for call a URL…. Most probabily you have just understand that we call a URL in our raspberry… we call an API like we saw in this post http://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/index.html\" title="http://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/index.html\" target="_blank">http://http://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/index.html\" title=\"\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">https://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/

I have a static IP in my home… but if you don’t have a static IP you can resolve using a DinamycDNS… I suggest https://www.duckdns.org/\" title="https://www.duckdns.org/\" target="_blank">https://www.duckdns.org/\" target=\"_blank\" rel=\"noopener\" title=\"\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">https://www.duckdns.org/

In my case, the url is http://xxx.xxx.xxx.xxx/api/ifttt/?key1=stufa&key2=accendi&token=xxxxxxxxxxxxxxxxx

Obviously I inserted xxxxxxx for my privacy.

Now, when I say “Turn on the stove” to my Google Home, IFTTT website calls the URL, and the script turn on the stove!

Now, you can write another Applet for TURN OFF the stove.

Use your script controlled stove

Obviously this post is based on the other post in this website where we make a stove controlled with a raspberry 🙂
Look at this posts

http://www.gioexperience.com/initially-setup-your-raspberrypi/index.html\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">1.01
http://www.gioexperience.com/use-temperature-sensor-ds18b20/index.html\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">1.02
http://www.gioexperience.com/1-03-reading-the-ds18b20-prepare-some-libraries/index.html\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">1.03
http://www.gioexperience.com/1-04-relais-board-and-thermostat-script/index.html\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">1.04
http://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/index.html\" title="http://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/index.html\" target="_blank">http://http://www.gioexperience.com/1-05-a-quick-webapp-for-your-thermostat/index.html\" style=\"box-sizing: border-box; border: 0px; font-variant: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; vertical-align: baseline; color: rgb(38, 38, 38);\">1.05

The API in Raspberry

In my raspberry I created a file ifttt.php dedicated for receive commands from IFTTT. In this way I can control all voice commands.
This script is almost this

<?php include(*****/init.php\");

if( $_GET[\"key1\"]==\"stufa\" )
{
   $json=json_decode(file_get_contents(\"http://127.0.0.1/api/temperature/\"),true);

   if( $_GET[\"key2\"]==\"accendi\" )
   {
      if( $json[\"statoStufa\"]==1 ) die();
      //imposta le soglie come piu alte della temperatura attuale.
      $t0=ceil($json[\"t0\"])+0.5;
      $t1=ceil($json[\"t1\"])+0.5;
   }

   if( $_GET[\"key2\"]==\"spegni\" )
   {
      if( $json[\"statoStufa\"]==0 ) die();
      //imposta le soglie come piu basse della temperatura attuale.
      $t0=floor($json[\"t0\"])-1;
      $t1=floor($json[\"t1\"])-1;
   }

   file_get_contents(\"http://127.0.0.1/api/temperature/?op=set&soglia0=$t0&soglia1=$t1\");

}

You can see that in the first case, “accendi” or “turn on”, the script write a thresold temperature higher than current temperature. In the second case, “spegni” or “turn off”, the script write a threshold temperature lower that current temperature.

I use this script and this way almost from 6 months and it’s comfortable and very usefull. : )