WisBlock Integration to Ubidots over MQTT and Voice Command using Google Assistant

Monitor your home or office with our RAKwireless WisBlock modules using a web or mobile dashboard, plus add voice commands with Google Assistant for automation and switch control just to integrate your IoT (Internet of Things) easier.

In the following article, we describe how you can monitor the environment in your home or office with our RAK11200 WisBlock Core (which is based on ESP32) then add the Google Assistant to control devices with voice commands.

Here are the few requirements that can help you to get started:

WisBlock Integration to Ubidots over MQTT

  1. Hardware Setup

    • In our example, we will be using the RGB LED strip as the load for our relay.


  2. Install the RAK11200 RAKwireless ESP32 BSP. Please see full instruction from this link: https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Quickstart/#install-rakwireless-esp32-bsp-on-arduino-boards-manager
    Download and install also the following libraries into your Arduino IDE:

    • PubSubClient
    • Ubidots ESP MQTT
    • Adafruit_BME680
  3. Before uploading codes to the RAK11200, please make sure to press the reset button while BOOT0 pin and GND pin are shorted first (as shown in the image below). Otherwise, your upload will fail if you don’t do this. Please take a look at this link for complete guide:
    https://docs.rakwireless.com/Product-Categories/WisBlock/RAK11200/Quickstart/#uploading-to-wisblock

  4. Copy and upload the code from our WisBlock Github repo into your Arduino IDE:

NOTE:

  • Input your WiFi credentials:
const char *WIFI_SSID = "******";
const char *WIFI_PASS = "******";
const char *UBIDOTS_TOKEN = "******";
  1. Once done uploading the code, go and log in to your ubidots account and it will automatically input the newly created device, its variables within the device and also the data of the sensors.


    As you can see from the above picture, the relay variable has not been automatically inserted in Ubidots and it is still missing. We need to add a variable for the relay manually and to do this:

    • select the “Add Variable”.
    • Then choose “Raw”
    • And rename the added variable with “relay”.
  2. Then you can create your own dashboard as shown in the image below where you can monitor the environment coming from the sensor. For dashboard making, please go into this link: https://help.ubidots.com/en/articles/2400308-create-dashboards-and-widgets

  1. Finally, you can set up an IFTTT to control your relay where the RGB LED strip is connected in your system by voice command using Google Assistant.

WisBlock Integration to Google Assistant over IFTTT

  1. After integrating your WisBlock with Ubidots, go and Log in to your IFTTT account.

  2. Then select “Create” to create a new Applet.

  3. Click the “If This +” as shown in the image below.

  4. Search and select “Google Assistant”.

  5. Select the “Say a simple phrase”.

  6. In the following step, 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
    • Click Create Trigger
  7. When the Trigger is already set, it’s time to create the action “Then That +” and choose Webhooks as action service:

  8. Make a web request and fill the fields of the WebHooks setup with the following parameters:

  9. Once the trigger and the action are properly configured and connected, you can now download and go to your Google Assistant and say “Turn on the led” and listen to the response of the Google Assistant and see how the relay is turned on to switch the RGB LED strip.

  10. Repeat the same process to create the applet to switch again the relay to turn off the RGB LED strip. All the previous steps provided are the same, the only differences are mentioned below:

    • Trigger Configuration (Google Assistant): switch “on” for “off”
    • Action Configuration (Webhooks): the body should be {"relay":0} to switch off the relay
  11. Once both applets are created and connected, you’re done! Congratulations Rakstar! you can now control and automate your devices using Google voice command.

Now, you have a smart home application for remotely controlling your devices by using Ubidots and Google Assistant!

Read more on WisBlock Integration with Blynk