Here, the follwing article will take you through how to work with Firebase and how to make an account on Firebase. The following article will help you to fetch the data of Odinub and sending the data on firebase.
Firebase is a platform which allow to build a web app and mobile application very easily and quickly. Firebase is a Backend-as-a-Service(BaaS). By Firebase we can store the users data on its real-time database which sync the data among users data in no time. Firebase is a google product which offers Real-time database, Firebase cloud Messaging, Firebase storage, Firebase Hosting and so many other features it provide to us. Here, I use firebase to send and fetch the data from the Odinub.
Step 0: Setup WiFiTo set the Wi-Fi just go to link given here.
To turn on the Wi-Fi execute the following command:
ifup wlan0
Step 1: Prerequisites- The only prerequisites is you need an account on firebase which is free. To make an account click here.
you will get the screen like this,
- Click on Go to console > New Project
You will get the screen like given below,
- Just give any name of your project and click on “I accept…” and then click on Create project.
- Now we have to go to the Database section and select real time database for our project. And make the database like this,
(write Name as “LED” and Value as “off”)
If you want to send the data then create the database like this,
For this project we need to install Python and Firebase by executing following commands.
//For Python
sudo apt-get install pythonsudo apt-get install python-pip
//For Firebase
sudo pip install requestssudo pip install python-firebase
Step 3: Scripting- We have to write a script which will fetch the data from firebase.
- For that we have to make Python script by executing following command.
nano filename.py
Now you will get new screen in that just write code given below.
In this code we have to link the Python and firebase for that we have following logic to apply in Python script. we have to write the link of database of the firebase in the Python script.
firebase=firebase.FirebaseApplication('your firebase link')
After writing th code press ctrl+x and then press Y to save the code and then press Enter.
Step 4: Execution of codeTo execute the code execute the following command:
python filename.py
Firebase is very easy to make home automation application. We can also make an android app and many other appliacations with firebase. I hope above article is helping you to make your application and also fullfil all your requirements.
Comments
Please log in or sign up to comment.