Giter VIP home page Giter VIP logo

thinx-device-api's Introduction

☢ thinx-device-api

Codacy Badge Twitter: @thinxcloud License Build Status Coverage Status

IoT Device Management Server running on node.js.

The Purpose

Update IoT device by pushing to a Git repository. Swap operating system for another over-the-air. Migrate multiple devices at once between WiFi networks.

As a user I have already many IoT new and/or legacy devices at home and new platforms are coming every day.

Sometimes we need to change WiFi credentials on a wireless switch mounted on a ceiling. The other day I we want to swap whole firmware for new one, but not always to rewrite working legacy Lua or Micropython code to PlatformIO.

It also covers other use-cases like remotely managing devices for customers with automatic updates for headless devices, or semi-automatic (with user consent after build and tests succed).

That's why we have decided to create the über-platform: THiNX.

Currently we're capable of building firmwares for PlatformIO, NodeMCU and Micropython (and simple Arduino firmware is also coming soon)

  • Remote Things Management console for monitoring devices, attaching source code and managing updates.

  • Implements Continuous Integration practices to update device apps/configurations from a GitHub repository using commit hooks.

  • Helps building secure MQTT infrastructure as an optional side-chain transport layer.

  • Serves as an IoT device registration endpoint while storing device data using CouchDB server and Redis session-store.

  • API is a back-end data provider (security agent) for RTM Admin Console Application.

  • Provides control to a dockerized build servers and pushes new firmware versions to client applications (FCM push) and devices (MQTT).

  • Provides HTTP-to-HTTPS proxy to secure legacy IoT devices that are not capable of TLS and/or AES-level encryption.

  • Allows transfer of device ownership (e.g. for pre-configured devices).

  • Custom firmware builder for MongooseOS, NodeMCU and Micropython (allow module selection, add THiNX as an OS-level library)

  • Transfer device to another owner along with sources/firmware.

Supported IoT Platforms

  • ESP8266 (thinx-firmware-esp8266)

  • Tested on Wemos D1 Mini, Wemos D1 Mini Pro, RobotDyn D1, RobotDyn D1 Mini, RobotDyn MEGA WiFi and various NodeMCU (Lolin, AI-THINKER) boards with Arduino, Lua and Micropython-based core firmwares

  • Expected: Arduino with networking support, MongooseOS-based devices...

THiNX Platform Library repositories:

Platform.io

Arduino

NodeMCU/Lua

Micropython

MongooseOS

Custom Firmwares

With built-in THiNX Client Library:

NodeMCU/Lua

Micropython

Arduino, Plaform.io and MongooseOS are firmwares by nature.

Dockerized Firmware Builders

PlatformIO

Arduino

MongooseOS

NodeMCU/Lua

Micropython

Prerequisites

  • Linux Server (min. 2 GB RAM, 32GB SSD)
  • Docker

Port mapping

  • API runs on HTTP port 7442 (possibly HTTPS 7443) and 7447 (websocket)
  • MQTT runs on HTTP port 1883 (possibly HTTPS 8883)
  • Admin runs on HTTP/HTTPS port (80/443)
  • GitHub commit hooks are listened to on port 9000, 9001
  • Optional monitoring services (Keymetrics, TrueSight) may run on other ports as well...

Installation

Using Docker

Experimental Docker installation can be found at Docker Hub.

First of all, set a valid FQDN for your new THiNX instance on your DNS server. Use this FQDN to parametrize the Docker image:

docker pull suculent/thinx-docker

docker build --build-arg THINX_HOSTNAME=staging.thinx.cloud -t suculent/thinx-docker .

docker run -ti -e THINX_HOSTNAME='staging.thinx.cloud' -e THINX_OWNER='[email protected]' suculent/thinx-docker

Installing Platform Builders

Attach to the running container with bash:

docker run -ti -e THINX_HOSTNAME='staging.thinx.cloud' -e THINX_OWNER='[email protected]' suculent/thinx-docker /bin/bash

Fetch required builder images from Docker Hub:

bash ./install-builders.sh

GitHub Webhook support

You can direct your GitHub webhooks to https://thinx.cloud:9001/ after adding a valid deploy key from GitHub to THiNX RTM.

Endpoints

See 03-test.sh. There is no point of maintaining documentation for this at current stage of development and user base zero.

Platforms State of Union

Overall

  • We need to take care of correct spelling for PlatformIO (and Git as well).
  • ACL implementation for MQTT is next in the queue.

PlatformIO

  • Docker builder works.
  • Deployment update can be tested now.
  • Firmware can be tested/tuned now.

Arduino

  • Docker builder works in specified workdir.
  • Deployment update can be tested now.

NodeMCU

  • File-based update has been pre-tested. Docker builder works fine but needs tighter integration with sources (workdir).
  • Deployment is not verified, therefore update cannot be tested.

Micropython

  • Docker builder works fine but needs tighter integration with sources.
  • Deployment is not verified, therefore update cannot be tested now.

Roadmap

  • PlatformIO: end-to-end update
  • Arduino: end-to-end update
  • Arduino/PlatformIO: end-to-end MQTT
  • Lua: build, file update
  • UPY: build, file update
  • MOS: build, file update; firmware update; library

thinx-device-api's People

Contributors

codacy-badger avatar qool avatar suculent 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.