Overview
You can monitor your home or office with our RAKwireless WisBlock modules using a web or mobile dashboard, add voice commands with Google Assistant for automation, and switch control to integrate your IoT (Internet of Things) easier.
Hardware
You need the following to get started:
- RAK11200 WisBlock Core Module for WiFi
- RAK5005-O WisBlock Base
- RAK1906 WisBlock Environmental Sensor to measure temperature, humidity, pressure, & gas resistance
- RAK13001 WisBlock Interface Relay IO Module
- Electrical Wires
- Light / AC Powered Devices
Software
The following are also required to get started:
WisBlock Integration
WisBlock Integration to Ubidots over MQTT
Setup the hardware components. The RGB LED strip was used as the load for our relay.
Install the RAKWireless ESP32 BSP on Arduino Boards Manager.
Download and install the following libraries into your Arduino IDE:
-
- PubSubClient
- Ubidots ESP MQTT
- Adafruit_BME680
Before uploading codes to the RAK11200, short circuit BOOT0 and GND pin and press the reset button. Make sure to do this so that your upload will not fail.
See Uploading to WisBlock for a complete guide on Arduino Tools Configuration.
Copy and upload the code from our WisBlock GitHub repo into your Arduino IDE.
đź“ť NOTE: Input your WiFi credentials:
|
- Input your Ubidots Default Token: Refer to this guide to find your Ubidots Default Token.
const char *UBIDOTS_TOKEN = "******";
Once you're done uploading the code, go and log in to your Ubidots account. It will automatically input the newly created device, its variables within the device, and sensor data.
The relay variable has not been automatically inserted in Ubidots, and it is still missing. We need to manually add a variable for the relay:
-
- Select the Add Variable.
- Choose Raw.
- Rename the added variable with relay.
Then, you can create your own dashboard where you can monitor the environment coming from the sensor. To create a dashboard, go to Create Dashboards and Widgets.
Set up an IFTTT to control your relay where the RGB LED strip is connected to your system via voice command using Google Assistant.
WisBlock Integration to Google Assistant over IFTTT
After integrating your WisBlock with Ubidots, log in to your IFTTT account.
Select Create to create a new Applet.
Then click the If This Add icon.
Search and select Google Assistant.
Select the Say a simple phrase.
You need to fill the fields with the Google Assistant to switch the relay and turn our RGB LED light on. For example:
- What do you want to say?: Turn on the led
- What's another way to say it? (optional): Switch on the led
- And another way? (optional): Lights on
- What do you want the Assistant to say in response?: Okay RAKstar! Turning on the led lights
- Language: English
Then, click Create trigger.
When the trigger is already set, create the action Then That Add.
Then, choose Webhooks as action service.
Make a web request and fill the fields of the WebHooks setup with the following parameters:
-
URL:
http://industrial.api.ubidots.com/api/v1.6/devices/{DEVICE-LABEL}?token={YOUR-UBIDOTS-TOKEN}
- Method: POST
- Content Type: application/json
- Body: {"relay":1}
Then, click Create action to finish.
Once the trigger and action have been properly configured and connected, go to your Google Assistant and say Turn on the led and listen to Google Assistant's response. See how the relay is turned on to switch the RGB LED strip.
Repeat the previous steps to create the applet that will switch the relay and turn off the RGB LED strip. All of the preceding steps are the same; the only differences are listed below:
-
Trigger Configuration (Google Assistant): switch
on
foroff
-
Action Configuration (Webhooks): the body should be
{"relay":0}
to switch off the relay
Once both applets are created and connected, you’re done! You can now control and automate your devices using Google voice commands.
Now, you have a smart home application for remotely controlling your devices by using Ubidots and Google Assistant!
Updated