Header Ads

IOT with Firebase : Home automation Light control using Google Assistant, Dialogflow and Firebase #Part 2

In this post i will finish IOT Home automation using Goggle assistant, Dialogflow and firebase which i started in previous post. Till now we are done with Hardware Setup, Connecting Arduino NodeMcu with Firebase & Setting Up/Configuring Dialogflow agent.
So, let's complete left out part i.e. Configuring Firebase Tools for Webhook and Integrating Google Assistant with Dialogflow.

Code Below Follows the Video to help:


Setting Up Firebase Tools:

  • Install Node.js and npm environment. 
  • Install firebase tools using npm.

npm install -g firebase-tools

  • Start Firebase sdk for firebase functions :

=> Run firebase login to login via browser.
  • Go to firebase project directory and type command  

=> firebase init functions.
  • above command will create directory which includes whole project files here we just need to focus on index.js file .

Code :

var admin = require('firebase-admin'); const functions = require('firebase-functions');
var database = admin.database();
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
exports.hello = functions.https.onRequest((request, response) => {
let params = request.body.result.parameters;
speech: "Light controlled successfully"

  • once done with writing code just need to deploy code to firebase functions. 
firebase deploy

    Integrating Google Assistant with Dialog-flow:

    Now, we are done with creating our chat bot which can control our lights, using firebase functions. Let's integrate our chatbot with google assistant so that we can easily control lights using our android device.

    Tip: Here i will suggest to use account which you are using in android device, so account google account should be same for : dialogflow, firebase, android.

    Let's start integration :
    • Navigate to integrations panel and select Google Assistant
    • In Explicit invocation select Intent you created (Lightcontrol)
    • Leave Implicit invocation blank
    • Now, click on Test button
    • You will be redirected to Actions on google, by default simulator opened
    • Navigate to Invocations tab (3rd from top) and put Display name : Light Control
    • Now do general settings as directed in video tutorial and test your app on simulator.
    So, that's end for IOT with Firebase using Google Assistant, if you face any query feel free to comment out .





    1. Code is not Working!! too...

    2. Is the code given typescript or javascript?

    3. Code is Working, thank you ^^

    4. Great post. Thanks for sharing it. Get the proper home automation courses of the IOT to learn the new technology in the proper way.

    5. how to display humidity data from firebase to google assistant ...

    6. This video is really informative on IOT technology. As, the IOT technology is emerging to provide the Smart home automation services in home to improve security in home.

    7. How to Build an App for the Google Assistant on Android Studio , please help me!

    8. I tried yours Project.
      BUT in actions on google test simulator
      How do I solve the problem as follows?
      Invocation Error
      You cannot use standard Google Assistant features in the Simulator. If you want to try them, use Google Assistant on your phone or other compatible devices.

    9. Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. CutTheWood

    10. Error: could not handle the request

    11. I had a power cut and had to re-set everything, but solved this by putting in 3xAAA batteries.
      Would I recommend the lamp? Yes, it works well. £30 is still hefty for an Alarm but I think it's worth it considering how expensive competitors are.
      Complete Security Alarms System

    12. It’s my first time to visit this site & I’m really surprised to see such impressive stuff out there.locksmith Alpharetta

    13. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. locksmith services

    14. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. Buy Fack Google Reviews

    15. I want to ask a question, how to get data form firebase database and speech that?

    16. we have sell some merchandise of rotate custom boxes.it's far absolutely useful and completely low fee allure visits this web page thanks and appeal component this say thinking of your links. control4

    17. Could you provide me with a API v2 compatible index.js?

    18. I love the way you write and share your niche! Very interesting and different! Keep it coming! interview transcription services

    19. Can you provide me with an API-V2 compatible index.js too?

    20. can you make v2 api version for index.js

    21. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. home automation

    22. Nice article, Which you have shared here about the home automation. Your article is very informative and useful to know more about the Google Assistant, Dialogflow and Firebase. If anyone looking for the Home Automation Services in Sydney, Nsautomate is the best choice.

    23. Please share dialogue flow V2 index.js beacuse V1 IS NOT WORKING ANYMORE

    24. I like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... best light therapy lamp

    25. Amazing things you've for the most part conferred to us. Essentially proceed with composed work this kind of posts.The time which was wasted in going for instructive cost now it tends to be used for studies.Thanks poe security camera system


    Powered by Blogger.