Skip to content

lollotek/react-firebase-sample-sensors

Repository files navigation

react-firebase-sample-sensors

Sample gif

Description:

This is a simple reference project to lear how to use Firebase Realtime Database. The main porpouse is to show interaction between diffent applications, thanks to Firebase. This sample simulate an IoT enviroment of temperature sensors array, and show it on a dashboard. It's also possible to simulate fake sensor data.

Getting started:

  • Create a Firebase project from console.
  • Go to Console->Database->Rules and remove auth request writing following data: (WARNING: don't do it for production appplications!)
{
  "rules": {
    ".read": true,
    ".write": true
  }
}

Dashboard / Emulator:

Dashboard ans Emulator are based on create-react-app

how to start (same for each program):

Remember to copy your Firebase config on src/index.js (repeat for each program)

cd [dashboard or sensor]
npm install
npm start

Then follow create-react-app instruction and get fun exploring the code

Launching second application you will notice this message: Something is already running on port 3000. Probably: say yes (y) to to run each program.

Dashboard Image

Emulator image

Sensor:

This code is for Arduino IDE and is tailored for WeMos mini Board, using DHT11 Shield.

Before start remember to add Arduino core for ESP8266 WiFi chip into your Arduino IDE config.

Other libraryes could be necessary, install using Arduino Library Manager. Based on firebase-arduino, it need config:

FIREBASE_HOST "<Firebase host setting>"
FIREBASE_AUTH "<database code>"
WIFI_SSID "<WiFi Name>"
WIFI_PASSWORD "<your WiFi password>"

how to find database code :

  • Click on the settings/cog wheel icon next to your project name at the top of the new Firebase Console
  • Click Project settings
  • Click on the Service Account tab
  • Click on the Database Secrets link in the inner left-nav
  • Hover over the non-displayed secret and click Show

Warning: this method could change, check issue 224 and issue 265

Security warning:

This project doesn't cover security management and require an unauthorized read and write privileges. USE ONLY FOR STUDY POURPOSE! or add auth level.

About

Sample Firebase Realtime Database synch with React and Esp8266 temperature sensor

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published