App/ XML-Config/ Plugin System/ MQTT [Update#2]

A project log for SmartRoom

A Raspberry Pi and Arduino based voice enabled smart room system that controls lighting and music and responses to questions.

bennetBennet 03/22/2016 at 13:040 Comments

Since quite some time the project has a Android app to control the lights, turn on the alarm system (just the PIR) and to view all important logs. Later I will add the possibility to live stream (or to slide show :P) from the RasPi-Cam.

The app has a ForegroundService with a permanent notification that allows quick access even from the lock screen and the actual app can be killed in the task manager.

Communication with the RasPi is done via MQTT with a broker on my vServer. Log entries generated on the Pi are currently sent to the App using Google Cloud Messaging; maybe I will switch that part to MQTT later on.

The Rasperry Pi Java software now has a plugin system that allows to outsource all user specific logic into runnable, .jar-packed plugins. Additionally their are non-runnable plugins that implement interfaces. So the user can decide on specific implementations e.g using Dropbox as cloud file service or to use a local text-to-speech engine instead of a cloud based solution.

The system supports hot deployment of runnable plugins.

Thanks to MQTT and the new XML configuration it is easy to have multiple RasPis all running the SmartRoom software. The config allows to do simple wiring without the need to write any code. E.g. controlling 433mhz outlets and relays or publishing the current value of a PIR-sensor to the broker server is as easy as that:

<?xml version="1.0" encoding="UTF-8"?>
<smartroom broker_uri="ssl://">
	<state topic="home/room/ceilinglight/state" type="boolean">
	    <!-- enables the relay if a message on that topic is "1" -->
	    <pinappender pin="GPIO 3"/> 
	<state topic="home/room/desklight/state" type="boolean">
	    <!-- controls a 433mhz outlet -->
	    <outletappender pin="GPIO 0" system_code="9" unit_code="8"/> 
	<state topic="home/room/pir/state" type="boolean">
	    <!-- publishes a message with "1" or "0" on that topic depending on the current pin state -->
	    <pinprepender pin="GPIO 4" mode="pull up"/>