core/README.md

47 lines
2.8 KiB
Markdown
Raw Normal View History

2013-09-17 07:32:51 +00:00
Home Assistant
==============
2013-09-18 07:07:39 +00:00
Home Assistant automatically switches the lights on and off based on nearby devices and the sun.
2013-09-17 07:32:51 +00:00
It is currently able to do the following things:
2013-09-18 07:07:39 +00:00
* Turn on the lights when one of the tracked devices is nearby
* Turn off the lights when everybody leaves
* Turn on the lights when the sun sets and one of the tracked devices is home
2013-09-17 07:32:51 +00:00
2013-09-18 07:07:39 +00:00
It currently works with any wireless router with [Tomato firmware](http://www.polarcloud.com/tomato) in combination with [Philips Hue](http://meethue.com). The system is built modular so support for other wireless routers or other actions can be implemented easily.
2013-09-17 07:32:51 +00:00
Installation instructions
-------------------------
* install python modules [PyEphem](http://rhodesmill.org/pyephem/), [Requests](http://python-requests.org) and [PHue](https://github.com/studioimaginaire/phue)
* Clone the repository `git clone https://github.com/balloob/home-assistant.git`
* Copy home-assistant.conf.default to home-assistant.conf and adjust the config values to match your setup
* For Tomato you will have to not only setup your host, username and password but also a http_id. This one can be found by inspecting your request to the tomato server.
2013-09-18 07:07:39 +00:00
* Setup PHue by running `python -m phue --host HUE_BRIDGE_IP_ADDRESS` from the commandline
2013-09-17 07:32:51 +00:00
* The first time the script will start it will create a file called `tomato_known_devices.csv` which will contain the detected devices. Adjust the track variable for the devices you want the script to act on and restart the script.
Done. Start it now by running `python start.py`
2013-09-18 07:07:39 +00:00
Home Assistent architecture
---------------------------
2013-09-17 07:32:51 +00:00
2013-09-18 07:07:39 +00:00
Home Assistent has been built from the ground up with extensibility and modularity in mind. It is easy to swap in a different device tracker that polls another wireless router for example.
2013-09-17 07:32:51 +00:00
2013-09-18 07:07:39 +00:00
The beating heart of Home Assistant is an event bus. Different modules are able to fire and listen for specific events. On top of this is a state machine that allows modules to track the state of different things. For example each device that is being tracked will have a state of either 'Home' or 'Not Home'.
2013-09-17 07:32:51 +00:00
This allows us to implement simple business rules to easily customize or extend functionality:
In the event that the state of device 'Paulus Nexus 4' changes to the 'Home' state:
If the sun has set and the lights are not on:
Turn on the lights
In the event that the combined state of all tracked devices changes to 'Not Home':
If the lights are on:
Turn off the lights
In the event of the sun setting:
2013-09-18 07:07:39 +00:00
If the lights are off and the combined state of all tracked device equals 'Home':
2013-09-17 07:32:51 +00:00
Turn on the lights
These rules are currently implemented in the file [HueTrigger.py](https://github.com/balloob/home-assistant/blob/master/app/actor/HueTrigger.py).