Let's move the remote control from Google Home


IFTTT is a convenient app that allows you to set various "triggers" and set "what to do" when the trigger occurs.As a trigger, you can set "If you speak this word" on Google Home of your own home.
And you can set a webhook for "what to do".Then you can hit the webhook with "Turn on the fan" and run the program in the obniz cloud.


First is the program.However, this time, instead of the block program prepared for each obniz, save the new block program in your own repository in the cloud.If you save it here, you will be able to execute it automatically from the webhook.

For the process of creating an account on the cloud and registering obniz, see [About Account] (/doc/obniz_cloud/about_cloud_account).Based on that, we will create an account and link the obniz you have to the account.When that is completed, select "block program" as the type from the new repository creation from [Developer Console] (/console), give an appropriate file name (this time, "turn on"), and create a program file. ..


Let's program with this new block program.

In the last infrared lesson, infrared rays are stored even though it is called "power supply".
This time, it's very simple because it just uses the stored data to output the infrared signal of that "power supply".

All you have to do is bring the signal stored under the name "Power" from the cloud and emit it in infrared.

Try it out, it will emit infrared light as soon as you move it.It's OK if the fan works properly.

Register for the event

Well, We was able to save it in the repository.Next, set the event.By setting an event, you can automatically run the program on the cloud from the webhook.
Similarly, press "New" from the event in the developer console.

We named it Google Home. Anything is fine.Then, select the WebApp you created earlier to run. This time you chose "turn on", so you chose it. The trigger was a webhook.

Now create it.


Let's try it out!

The created event page has a "Run Test" button. You can execute the event by pressing this.
When you press the button, the program will be executed on the cloud. Did the fan work?

IFTTT settings

Put the IFTTT app on your smartphone and create a new applet.
Select Google Assistant for IF and select a simple phrase.
The keyword is "turn on the fan" and the reply is "hot monne".

Then select Webhook for THEN.
For the webhook URL, enter the webhook URL of the event created in the obniz cloud.

At this point, you're done!It may take some time for the IFTTT settings to work properly. If that doesn't work, wait a few minutes.

Try to speak

Let's say "OK Google fan on". I get a reply saying "It's hot" and I think the fan will turn on in a few seconds.