In this tutorial, we will be using Chatfuel to control a light bulb by interacting with our chatbot in Facebook Messenger.
What You’ll Need:
- QBoat Sunny
- QIoT Suite Lite
- MediaTek LinkIt 7697
- Relay and Power Plug (Reference: Web Controlled Socket by Arduino by Laisan)
- AP Wireless Router
- Facebook Account
- Files used: Download Here
Create and Setup QIoT
- Open QIoT Suite > IoT Applications > Import > select
- Open the uploaded QIoT Application.
- Navigate to the Rule tab.
Create and Setup our Chatbot via Chatfuel
- Register or sign-in to Chatfuel using your Facebook account.
- Click Create from Template.
- Select Blank Bot.
- Click Connect.
- Select the page you’d like Chatbot to operate on.
- Navigate to Automate and add a block.
- Rename the block and add a text element which you want to show in Facebook Messenger.
- In QIoT Suite, go into the Dashboard tab and click on the icon shown below. This will open a new tab to show your current dashboard layout for your QIoT Application.
- In the new tab, copy this portion of the URL.
- Head back to Chatfuel and click Add Button (Optional).
- Rename the button, then click URL and enter the URL.
URL: <dashboard URL (copied from before)>/Option?Switch=on
- Follow Steps 10-11 to make another button for off.
URL: <dashboard URL (copied from before)>/Option?Switch=off
- Head to Set Up AI and type light or any activating keywords you’d like to use.
- Click Add Block and select QIoT (the block we created earlier).
- Head back to Automate tab.
Connect LinkIt 7697
- Connect the Relay and Power Plug to LinkIt 7697.
- GND to GND
- VCC to 5V
- Signal to P3
- Download and Install the Arduino IDE here
HTTPRelay.inoto Arduino IDE and change network SSID and password accordingly.
HTTPRelay.inoto LinkIt 7697 via Arduino IDE.
- Open the Serial Monitor (Ctrl + Shift + M). The serial monitor will show LinkIt’s IP address. Copy this IP address.
Connecting QIoT Suite to LinkIt
- Head back to QIoT Suite and double-click on LightOn node, then replace the URL with your the URL you copied from Arduino IDE, then hit Done.
- Repeat with LightOff node.
- Click Save.
Test If It Works
- Head back to Chatfuel and click Test your bot
lightand select on to turn on the lightbulb, off to turn it off. Of course, this will appear on your own Facebook Messenger.
Original Github: https://github.com/blackmesataiwan/qboat_chatbot_control