Giter Club home page Giter Club logo

djangoiot's Introduction

SensorHub

SensorHub is a server to collect and visualize sensor data. That data could be a temperature measure from a sensor on an Arduino (or even better, a NodeMCU board) for example.

If you want to store that temperature and visualize it somewhere, SensorHub might be the right choice for you.

How it works

SensorHub is made with Django (Python). You can install it on a remote server or locally on a computer at home, even on a Raspberry Pi. Yes, ARM is supported. As long as it can run Python it should work.

Once you have the server running, enter the admin panel and create a sensor. Give it a name, we will use that as an identifier for this sensor.

You can have a look at the sensors/examples folder on this repo to see what the code on a sensor looks like (currently we have an example for NodeMCU and a Raspberry Pi connected to a DHT22 temperture and humidity sensor).
Basically what the sensor does (or the board to be more precise) is sending an HTTP request to the server every minute with a JSON payload containing the data.

The server stores that data in a CSV file in the data folder of the repo.
Why CSV? It is supported everywhere in case you want to do something else with it later. SensorHub focuses on simplicity and there is nothing more simple than a bunch of CSV files (one for each sensor and day).

There is a small SQLite database where the admin user and the sensor configuration is stored too.

Installation

You will need Python3 and pipenv installed.

  • Clone this repo.
  • Enter the sensorhub root folder and run pipenv install.
  • Then, run pipenv shell.
  • Create the database with python manage.py migrate.
  • And now let's configure an admin user for you: python manage.py createsuperuser

That's it, the server is ready to start.

Running the server

Manually

After running pipenv shell on the sensorhub root folder you can start the server with python manage.py runserver and open http://localhost:8000/ in your browser.

The easy but insecure way

Another option (not recommended for production) if you want to leave the server running, is using the sensorhub.service file as a template to run it with sudo systemctl start sensorhub on a device that has systemd.
You will have to adjust the user, working directory and maybe the port too depending on your use case.

This is not secure because it uses python runserver and that is a development server. If this is going to be on your home network it's fine, don't worry, otherwise see below.

The secure way

But the best option, if your server is going to be public is to use NGINX and Gunicorn.

djangoiot's People

Contributors

marcelovds avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.