• This repository has been archived on 06/Mar/2020
  • Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    Python
  • Created over 8 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OTA "server" in Python for Homie

homie-ota

This is a small OTA (Over the Air) "server" for the excellent Homie-ESP8266 framework for ESP8266 modules. In addition to providing OTA over HTTP/HTTPS, homie-ota also provides device inventory and firmware management with an explicitly retro-style Web interface (the KISS layout reminds us of the fact we're dealing with $4 IoT devices ...)

homie-ota

homie-ota contains a built-in HTTP server powered by Bottle; this is the bit that a Homie device talks to in order to obtain OTA firmware. On the other hand, homie-ota connects to your MQTT broker in order to obtain an inventory of Homie devices (current status ($online), firmware ($fwname) and firmware version ($fwversion), device name ($name), etc. These values are collected by homie-ota and stored in a JSON data structure in the file system.

Features

  • OTA firmware server for Homie devices.
  • Upload new firmware to the firmware store.
  • Trigger OTA firmware update by MQTT publish to a Homie device
  • Logging
  • View device details and sensor readings

Firmwares

Firmware files are uploaded into homie-ota via its Web interface, and they must contain the magic tokens in order for homie-ota to correctly process them. (See below for how to create those.) All firmware files are stored in the OTA_FIRMWARE_ROOT directory as <name>-<version>.bin, with name being the name of the firmware and version it's semantic version number (e.g. dual-relay-1.0.5). In addition, an optional description you enter is stored as <name>-<version>.txt.

homie-ota makes it easy to deploy a different firmware onto an ESP8266 device: simply select the firmware you want on the device and queue the OTA request. As per the Homie Convention, this request is published over MQTT, however note that homie-ota does not currently publish this message retained which means, that if the device is currently not online, it will miss an update. (This is by design to avoid OTA loops.)

Due to sensible limitations in Homie, the string containing the concatenation of firmware name and version may not be longer than 16 characters. In order for you to be able to name your firmware however you'd like to, what homie-ota does is to hash the name when triggering an OTA request to a device. As such, if you're watching a serial console, or the publish going via your MQTT broker, you'll see something like this:

devices/0fbbe2e0/$ota [email protected]

OTA available (version [email protected])

NOTE: homie-ota also supports external OTA update requests, as per the Homie Convention, which can be manually triggered by publishing the new version to the /$ota topic of a device. The payload should just be the version number in the format x.x.x. This only allows upgrades to the currently installed firmware, i.e. you cannot swap out the firmware as you can by scheduling an OTA update through homie-ota.

Installation

Obtain homie-ota and its requirements. Copy the exmple configuration file to homie-ota.ini and adjust, creating the OTA_FIRMWARE_ROOT firmware directory if it doesn't yet exist.

Launch homie-ota.py.

Configure your Homie devices to actually use homie-ota by providing the appropriate settings in their configuration:

Homie config

ESP8266 Arduino

For a complete setup (incl. autostart) check out the installation guide with step-by-step instructions.

Preparing the firmware

In order to use the Autodetectable Binary Uploadâ„¢, your Homie sketch should contain a magic expression in it as shown in the example sketch. When you're ready, compile the binary. To upload it: under the Sketch menu in the Arduino IDE, select Export compiled Binary; the binary .bin will be placed in the sketch's directory, and you upload that file to homie-ota; it will detect the firmware name and version, store it into the correct directory, and make it available in the list of upgradable firmware files.

You can upload the file directly to homie-ota from the command-line using curl, say:

$ curl -F [email protected]_mini.bin \
       -F description="D1-mini with homie-1.4.1" \
       http://homie-ota.example.org:9080/upload

Firmware from lt.ino.d1_mini.bin uploaded as /path/to/firmwares/lt-2.0.0.bin

If basic http authentication is enabled, add "-u username:password" to the curl command

We do this directly from the sketch directory into which the exported binary was written.

More Repositories

1

jo

JSON output from a shell
C
4,631
star
2

mqttwarn

Subscribe to MQTT topics (with wildcards) and notify pluggable services
Python
908
star
3

mosquitto-auth-plug

Authentication plugin for Mosquitto with multiple back-ends (MySQL, Redis, CDB, SQLite3)
C
808
star
4

mqtt-launcher

Execute shell commands triggered by published MQTT messages
Python
185
star
5

simple-mqtt-websocket-example

Simple MQTT Websocket example
JavaScript
111
star
6

scrumptious

Scrumptious Bookmarks in CouchDB
JavaScript
72
star
7

mqtt2graphite

Subscribe to MQTT topics and push to Graphite's Carbon server
Python
70
star
8

tempgauge

HTML5 canvas gauge for temperature obtained from an MQTT subscribe
Python
68
star
9

mqtt-svg-dash

SVG "live" dashboard from MQTT
JavaScript
60
star
10

check-mqtt

A Nagios/Icinga plugin for testing an MQTT broker
Python
58
star
11

mqtt-watchdir

Recursively watch a directory for modifications and publish file content to an MQTT broker
Python
38
star
12

ansible-m-dnsupdate

Ansible module to perform RFC 2136 dynamic DNS updates
Python
32
star
13

pico

C++
28
star
14

ansible-facts

Ansible module (python) to produce own "facts"
Python
24
star
15

qtripp

Queclink Track (air) Interface Protocol Processor
C
23
star
16

mqttcollect

collectd "Exec" plugin for MQTT
C
22
star
17

msoak

MQTT subscribe to mutliple servers / topics simultaneously
C
20
star
18

ansible-m-pdns_zone

Ansible module to create/delete/list PowerDNS zones
Python
19
star
19

mqtt-osx-notifier

Notify OSX from topics published on OSX (see mqttwarn)
Python
18
star
20

from-traccar

Traccar positions and events to MQTT
C
16
star
21

ansible-jinja2-templates

Example Jinja2 templates for Ansible
15
star
22

n-repo

Sample repository for Ansible in "Pull"-mode
Python
15
star
23

hared-hare

Alerting or notifying on SSH logins
C
14
star
24

nagval

Nagios/Icinga plugin to check validity of one or more DNSSEC domains
C
14
star
25

notify-by-mqtt

A Nagios/Icinga module to submit notifications to mqttwarn
Python
14
star
26

tempmonitor

A simple MQTT Websocket temperature monitoring page with Arduino support
JavaScript
13
star
27

ansible-graphite

very experimental: install Graphite via Ansible
Python
13
star
28

facts2sshfp

Create SSHFP records for DNS from YAML fact files on Puppet master
Python
12
star
29

1090-to-owntracks

Import ADS-B data into OwnTracks via MQTT
Python
11
star
30

sonospauseIR

Arduino-based remote control for Sonos
Java
11
star
31

revgeod

A reverse Geo lookup service written in C, accessible via HTTP and backed by OpenCage and LMDB
C
10
star
32

couch-sdb

BIND SDB driver for CouchDB
C
10
star
33

ansible-booklet

A reference card/cheat sheet/booklet for Ansible
Shell
10
star
34

dlz_lua

Lua "back-end" for BIND with dlz_dlopen()
C
10
star
35

pudo

Upload JSON documents and attachments to a CouchDB instance
9
star
36

mqtt-prowl

Subscribe to topics on an MQTT broker and notify via Prowl (obsolete: see mqttwarn)
Python
9
star
37

twitter2mqtt

A Twitter to MQTT gateway (1-shot)
Python
8
star
38

dnssecmagic.js

Minimal HTML/JavaScript/jQuery code to determine if Web-browser is using a DNSSEC-validating cache
JavaScript
8
star
39

fritzuploader

Upload phonebook to Fritz!Box from the command-line
8
star
40

ansible-zypp

Ansible module (shell) to install/remove packages on Suse Linux
8
star
41

bzl

Bind Zone List
C
8
star
42

airportsd

IATA airport code lookup server
C
8
star
43

ansible-ntfy

Ansible action plugin to post JSON messages to nfty
Python
7
star
44

syncthing-activity

Monitor file changes as syncthing performs them
Python
6
star
45

jopleet

Copy individual tweet status URLs into Joplin notes
Python
5
star
46

mqtt-chronos

Periodically submit time/date-related data to an MQTT broker
C
5
star
47

bind9stats

BIND9 statistics-server plugin for Munin
C
4
star
48

diablo

diablo-5-CUR-20090530-00 + XS4ALL patches
C
4
star
49

mqtwit

MQTT to Twitter. (obsolete: see mqttwarn)
Python
4
star
50

whatmon

Mozilla Firefox/Thunderbird add-on for Monitoring Whatever
JavaScript
4
star
51

tt

to T
Python
3
star
52

check_nix

This is a Nagios/Icinga plugin for checking a particular DNS TXT RR. See the documentation in the program.
C
3
star
53

go-progs

Go programs (single binary, dependencies included)
3
star
54

owntracks-livetable

OwnTracks Live table
Python
2
star
55

make-big-aa

create a large RFC 1035 zone file
Perl
2
star
56

eitime

print an RRSIG expiration / inception time in the form `YYYYMMDD000000`
C
2
star
57

SensorTag_iOS

SensorTag_iOS from https://git.ti.com
Objective-C
2
star
58

ob

openBerlin
JavaScript
2
star
59

beanstalkc3-ot

A simple beanstalkd client library for Python3 patched for YAML.safe_load
Python
2
star
60

mqtt-speedo

Speedometer for MQTT messages (unreliable!)
CSS
2
star
61

pdns-remote-airports

pdns remote backend for airport codes
Python
2
star
62

rfc2136tweetr

Twitter status updates via RFC 2136 dynamic DNS updates
JavaScript
2
star
63

pdns2graphite

pdns2graphite
Python
2
star
64

powerdns-datacheck

MySQL UDF to check data in PowerDNS tables
C
2
star
65

cattled

This is !NOCOWS for Ansible: a repo of a cattle daemon
Go
1
star
66

ypom-cli

Python
1
star
67

t3

test pubkey
1
star
68

ansible-ec2-userdata

Obtain user-data
Python
1
star
69

tpl02

HTML
1
star
70

zabbix

Bastille Template to create a Zabbix Monitoring Jail
Shell
1
star
71

airports-zonedata

$INCLUDE airport locations
1
star
72

revgeod-python

Python
1
star
73

cy-ddns

C
1
star
74

luadnszones

Testing
1
star
75

openhab-workshop

Support files for my openHAB Workshop
C++
1
star
76

whatmon-s

Whatmon for Safari
JavaScript
1
star
77

owa11-owntracks

owa11 MQTT to OwnTracks JSON
C
1
star
78

b1

tmp don't use
JavaScript
1
star
79

dv

POC: Lightweight file "signing" and verification using DNSSEC
C
1
star
80

jpmens.github.com

1
star
81

yaus

Yet Another URL Shortner
C
1
star
82

jndcalx

Get iCal/Sunbird to subscribe to your Lotus Notes calendar
C
1
star