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:

Transcript/Cheat-sheet:

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');
admin.initializeApp(functions.config().firebase);
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;
database.ref().set(params);
response.send({
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 .

     

     


    
    

    47 comments:

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

      ReplyDelete
    2. Is the code given typescript or javascript?

      ReplyDelete
    3. Code is Working, thank you ^^

      ReplyDelete
    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.

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

      ReplyDelete
    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.

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

      ReplyDelete
    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.

      ReplyDelete
    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

      ReplyDelete
    10. Error: could not handle the request

      ReplyDelete
    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

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

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

      ReplyDelete
    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

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

      ReplyDelete
    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

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

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

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

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

      ReplyDelete
    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

      ReplyDelete
    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.

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

      ReplyDelete
    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

      ReplyDelete
    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

      ReplyDelete
    26. Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post. barriera automatica prezzi

      ReplyDelete
    27. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful. DUI Defense Lawyer

      ReplyDelete
    28. IoT is the trending advanced technology in this technological world. While many physical objects and sensors which we mention in the context of the Internet of Things use IP and IoT Platform, not all of them do so. Your blog helps peoples to understand IoT technology.

      ReplyDelete
    29. If your looking for Online Illinois license plate sticker renewals then you have need to come to the right place.We offer the fastest Illinois license plate sticker renewals in the state. Jed Fernandez

      ReplyDelete
    30. The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention. heat changing mugs

      ReplyDelete
    31. Gangaur Realtech is a professionally managed organisation specializing in real estate services where integrated services are provided by professionals to its clients seeking increased value by owning, occupying or investing in real estate. Accessories

      ReplyDelete
    32. Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. Amazon EC2 virtual machine

      ReplyDelete
    33. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. upload image to firebase android

      ReplyDelete
    34. fitness equipment is a requirement if you want to build muscles or loose fat,, https://royalcbd.com/how-to-make-cbd-gummies-at-home/

      ReplyDelete
    35. Very nice blog and articles. I am realy very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post. coordinates address api

      ReplyDelete
    36. I have read your excellent post. This is a great job. I have enjoyed reading your post first time. I want to say thanks for this post. Thank you... process servers near me

      ReplyDelete
    37. A complete sententious blog, intended to impress people.
      visual automation testing

      ReplyDelete
    38. A blog that mushroomed from visual edification.
      alpinestars leather trousers

      ReplyDelete
    39. It's late finding this act. At least, it's a thing to be familiar with that there are such events exist. I agree with your Blog and I will be back to inspect it more in the future so please keep up your act. Murakami

      ReplyDelete
    40. It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it! Distributors

      ReplyDelete
    41. I am looking for and I love to post a comment that "The content of your post is awesome" Great work! sports stores

      ReplyDelete

    Powered by Blogger.