Simple, lightweight, python-based management service for IoT devices for makers and hobbysts with SSL security and tornado web UI
Work in progress...
When creating hobby IoT projects based on linux embeded platforms (like Raspberry Pi, Onion, Arietta, CHIP, ...) or microcontroller platform (like Arduino, esp2866, Photon, ...) sooner or later one have to use some kind of management service to collect data from sensors and send commands to devices. If the devices are placed in remote locations, behind NAT or 3G network, the task of establishing reliable and secure two-way link between the device and management server is not trivial.
Existing IoT clouds are great, but are usually dedicated to specific device brand (like Photon) or big and feature rich or SaaS, which makes them difficult (or impossible) to install and configure on one's own hardware.
This project aims for creating simple, manageble and portable server application for collecting data from various brands and types of devices and sending commands to the devices. The application is written in python and can be run as a daemon on any linux system, for example Raspberry Pi. Second part of the project is the device part in form of client python script that runs as a daemon on the device side and is responsible for establishing secure socket link to the server, authenticating and handling communication. In order to read data from sensors or handle custom commands from the server one have to implement few lines of customized python code.
- server.py script runs as daemon and exposes SSL endpoint for devices to connect
- client.py script runs as daemon on a device and connects to configured server TLS endpoint
- once the link is established, server lists the device in web GUI
- device sends readings to the server
- server saves the readings in sqlite and presents the reports in web GUI
- web GUI supports sending commands to specific device
- pluggable device script device/app.py handles commands on the device part
- server-device communication by TLS TCP socket (for linux devices). Secure communication with two way certificate authentication
- alternative communication by encrypted UDP packets (for microcontrollers). Secure communication with SHA256 encryption and HMAC-SHA256 authentication.
- customizable device part: sensor reading part and command handling in form of python script
- WWW UI based on Pure.css, tornado and WebSockets
- Sensor readings storing using sqlite
- Sensor readings reports using Google Charts
- For linux devices support for SSH tunnel command for logging by SSH into the device behind NAT or 3G
- Customization by writing plugins in python
- implement client for Arduino using encrypted UDP communication
- add external display support for server side script to use on Raspbery Pi with small LCD screen
TODO
- Install dependencies: tornado, sqlite, ...
- Download IotCenter scripts
- Setup initial server configuration: python server.py init
- Create device configuration: python server.py newdevice
- Run the server: python server.py start
- Copy configuration to device and run device client daemon: python client.py start