Redesigning the JET model May 2017
The JET project (JeeLabs Embello Toolkit) is the continuation of the earlier HouseMon project (in turn the successor of JeeBus). It’s been a slow starter, but definitely not shelved. The JET “Hub” has been running for the past few years here at JeeLabs - dutifully collecting monitoring data from two different sensor networks, saving log files, and forwarding messages to MQTT.
The “Hub” was implemented with the assumption that a single process should be kept running at all times, with various “Packs” started and stopped on demand, as child processes.
But recent experience with Folie points to a much more practical design, with one process per external interface instead of this single monolithic hub. The always-on role can easily be taken over by the MQTT message broker, i.e. Mosquitto - which is widely use in today’s IoT … hype?
The Mosquitto background task consumes very few resources and can be kept running 24 / 7, acting as central switchboard and message exchange. Great for a low-end Linux board.
Mosquitto 1.4.8 and later include two major new features: 1) WebSocket support and 2) a built-in web server for static files. These can offer a perfect mechanism for rich and responsive web applications, together with Paho for MQTT message streams and React for the user interface.
The core JET system is trivial to set up: install Mosquitto from whatever
package manager you use (recent versions are available via
apt-get on Linux,
homebrew on Mac, for example).
Since MQTT is based on TCP/IP sockets, its clients can be located anywhere on the network.
You can configure SSL-secured connections where needed - it’s all well-documented and very easy to set up. And here is how to activate the built-in HTTP server with WebSocket support:
listener 9001 http_dir /var/www/mosquitto protocol websockets
Mosquitto supports listening on multiple ports and can restrict access to MQTT’s “topic tree”. These features are useful to expose only a subset of all your messages to the outside world.
What about the rest of JET?
Well… that’s mostly a matter of launching instances of Folie for each hardware interface, plus additional tasks to perform functions such as logging, database storage, and rule automation.
Each of these can then publish its results to MQTT and subscribe to specific MQTT topics (or wildcard topics) to be notified of events as they occur. There you go: messaging in action!