One important criteria was that any software that I would create must be multi platform capable. My primary development environment is Mac OSX, but the servers are running primarily Linux. My decision fell on Java and the journey in Eclipse began.

The application is still in the pre-alpha state and it aims to implement MySensors protocol and send this forward to channels that are implemented. Since my plan included MQTT, the one (and only) channel that is implemented now is the MQTT Channel. However, the project has a well defined interface so any other channels could easily be added in the future. The application also rely on a persistence implementation which holds the nodes and the sensors included in the sensor network. Also their ”last sensor value” is kept in the persistence layer in order to be able to respond back to any sensor requesting their ”last known value”.

The application is roughly separated in:

* Start-up code which parses the XML-configuration and executes 1..n SensorGatewayCommunicaotr. By making the application in this way, it is able to connect to many Sensor networks (buildings, different customers, etc) and send them independently to the configured Chanels.

* SensorGatewayCommunicator is the class that holds the intelligence of handling data from the sensors. It communicates with a sensor network via an IP-connection to a serial to IP-gateway (Ser2Net on a RPi for example). This is a ”early solution” which will be handled better in the future. For example via an IP enabled Arduino.

* Channels are the delivery channels on which events from MySensors network are ”forwarded”. In my thoughts, the application should grow in number of implemented channels. One is of course MQTT.

* Persistence is responsible for persisting nodes and sensors on the network. Today MySQL/MariaDB is the only supported persistence implementation.

* MySensors packages are Events, Messages, Sensors as shown in the image below. This is an abstraction and implementation of the items and ”things” that exists as artifacts in MySensors.

Below is a raw screenshot from Eclipse showing the actual file structure state of the project.

I have many thoughts on how to extend this application. My vision is to have MySensors as one ”input” but I also would like to add other ”inputs”. For example converting my Delphi application for the Visonic PowerMax alarm integration into this application. Would then of course also use the Channels implementation and persistence possibilities in some kind. Anyway, the entire project will be open sourced and available on GitHub in a near future.

As of today – the following things ”works”:

* Inclusion of new nodes

* Requesting IDs from SensorsToMQTT

* Receiving values from sensors

* Handle presentation events

* Sending Metrics answer

* (almost) Sending back replies regarding ”last known value” of a sensor

As a last evidence 🙂 – here are two rooms which now has sensor nodes that publishes data over the sensor network. Of course SensorToMQTT java application is responsible for publishing sensor values on the MQTT bus in order for openHAB to use them!

Please feel free to comment on any thoughts/question! I will publish more information in this topic!