Thermostat with home presence detection - dedicated binding

Hello,

I’ve been developing a “home presence” enabled thermostat based on the electronics assembled by myself and Openhab as a server.
I’ve put up a blog to document it here:

http://jwdevs.com/smart-thermostat-with-presence-detection

The system had been working great last winter and I have some plans to extend it further.

The Openhab connector translates the simple text messages {msg_type; sensor_nr; value; value; …} into items using Groovy.

Number TempSensor1 “Temperature First Floor [%.2f °C]” (TempSensors) {ihome=“ThermometerMessage|msg.sensorNumber==1|msg.value”}
Number TempSensor0 “Temperature Ground Floor [%.2f °C]” (TempSensors) {ihome=“ThermometerMessage|msg.sensorNumber==0|msg.value”}
Number HumiditySensor0 “Humidity Ground Floor [%.2f %%]” (HumiditySensors) {ihome=“HumidityMessage|msg.sensorNumber==0|msg.value”}
Switch MoveSensor0 “Movement Ground Floor” (MoveSensors) {ihome="PirMessage|msg.sensorNumber==0|msg.value”}

The connector uses an Xbee module on serial port (I will connect it to the local wifi network too for UDP messaging).
Acting back is also possible to send out text messages.

Anyhow I’ve done it to learn the system but I’m wondering if it makes sense or you have already something similar in place which I overlooked.
If think with some work it can be made generic. What do you guys think?

The code is on the github:

Any ideas/opinions are welcomed.

Cheers,
Jakub

A link with a better overview:
http://jwdevs.com/ihome-smart-home/