Software apps and online services
Hand tools and fabrication machines
Ever since I have got Google Assistant working on my phone, I have wanted to control my house appliances with it. I have spent quite some time trying to figure this out, but when I saw PPV's blog, something just clicked.
This blog is kind of a replica of the earlier blog, the only difference being that I have used Google Assistant in the place of Amazon Alexa. This gives me the freedom to control home appliances from anywhere in the world, using my voice. The only things that I need is my phone and a good internet connection.WorkingStep 1: Hardware setup
Connect Gnd of Bolt module to Gnd of relay, VCC of relay to 5v of Bolt module, In1 of relay to Pin 0 of Bolt module
Log in to cloud.boltiot.com and note the ID of your Bolt WiFi module.
Now click on the 'API Tab' and under the section for 'Generate Key, ' click on 'Enable.'
Now click on device for device ID.
Since relay is a digital output device, we will need to get a Digital Write command that can be sent to Bolt over the Internet to switch on the relay.
Click here Bolt Cloud go to Docs Tab -> API Documentation -> GPIO Commands API -> Write Digital Output, to understand how to create a API command link to turn on or turn off a pin of the Bolt.
The structure of the command is:
The parameters that you need to replace are:API_KEY: You can get it from API tab on cloud dashboard.PIN_NUMBER: Pin to which you have connected the relay. Values can be either 0, 1, 2, 3 or 4HIGH/LOW: This value indicates if you want to turn on/off the relay. HIGH will turn it on, LOW will turn it off.DEVICE_ID: The id of your device. You can get it from cloud dashboard.
The sample command to turn the relay ON connected to device having ID BOLT##### to PIN 0 is:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=0&state=HIGH&deviceName=BOLT#####Step 4: IFTTT integration with Google Assistant and Webhooks
Go to IFTTT to create a new applet by clicking here
Login using your Gmail account. Make sure you use same account which you'll be using on your mobile to interact with Google Assistant.
Click on '+This' to create the trigger.
Choose Google Assistant -> Say Specific Phrase
Type the phrase you want to trigger the action. Make sure to specify the trigger command in different ways for example I used
a) Turn on the switch
Click on 'Create Trigger'
Click on '+That'
Select Webhooks and then Make a web request.
1 / 2
Enter the API URL you got in the previous Step. Make sure that you change the API Key and device name.
Method will be GET
Content type will be Application/json
Here is how your screen will look like
Click on 'Create Action' and then Click on 'Finish'Steps to turn OFF the Relay
Now do the same process for a command to switch of the relay. Here you will change the state to LOW i.e. state=LOW in your code. Here is a sample of the code. Also, add a suitable phrase to switch off the relay.Now it's time for testing!
Now wake your Android phone by saying "OK Google" followed by our Applet and watch the magic happen!