- Simple Home Automation Solution with MQTT
- Home Automation with MQTT
- Completely independent from the used technology (most bindings are actually written in node.js)
- Cloud-based architecture (only the bindings to control the devices are running locally)
-
Install a MQTT Broker with Websocket Support, e.g.
-
Clone the repository and install the dependencies
git clone https://github.com/denschu/homepi npm install
-
Create a Firebase Account
-
Place you device configuration in a configuration file e.g. "firebase-config.json" and upload it to your firebase account. See also the example "firebase-config-example.json" for further details.
Example configuration:
{
"type" : "on_off",
"value" : false,
"name" : "Ceiling Light",
"topic" : "/home/devices/livingroom/ceiling_light/value",
"id" : "ceiling_light"
}
- Run with local HTTP Server
Open app/js/config.js and modify the Firebase URL. You can use https://homepi.firebaseio.com for testing
cd www
python -m SimpleHTTPServer 8080
mosca --http-port 8000 --http-bundle --verbose | bunyan
-
Run with Docker
docker run -p 1883:1883 -p 8000:8000 -v /var/db/mosca:/db matteocollina/mosca docker run -d -p 80:80 denschu/homepi
Build and Run it as native app
sudo npm install -g cordova ionic
ionic platform add ios
ionic build ios
ionic emulate ios
Subscribe to a topic for getting the value of a device
/home/devices/<room>/<device-name>/state
/home/devices/living_room/light1/state
Publish to a topic for setting the value of a device
/home/devices/<room>/<device-name>/state/set <value>
/home/devices/living_room/light1/state/set true
Take a look at my puppet manifests to setup the Raspberry Pi very easily with puppet. You also get some help for the manual setup.
At the moment the following "experimental" MQTT bindings are available:
- mqtt-exec Execute shell commands like "sudo shutdown -h now"
- mqtt-zway Connect to the Z-Wave RaZBerry Server Z-Way
- mqtt-google-calendar Use Google Calendar as a scheduling engine
- mqtt-rules Create rules and execute them on incoming MQTT messages
- mqtt-temperature Log temperature to MQTT
- mqtt-lirc Control infrared devices
- node.js
- MQTT
- Ionic Framework (with AngularJS)
For further informations and setup instructions please refer to my blog posts.

