Ready for first release

This commit is contained in:
Paulus Schoutsen 2014-12-21 14:40:18 -08:00
parent 775045fc86
commit 86bb2df430
10 changed files with 438 additions and 79 deletions

View file

@ -8,23 +8,25 @@ sharing: true
footer: true
---
<img src='{{ root_url }}/images/ha_architecture.png' style='background-color: white'/>
<a href='{{ root_url }}/images/ha_architecture.png'>
<img src='{{ root_url }}/images/ha_architecture.png' style='border: 0; box-shadow: none;'/>
</a>
The core of Home Assistant exists of the following parts.
The <b>Event Bus</b> facilitates the firing and listening of events. This is the beating heart of Home Assistant.
The **Event Bus** facilitates the firing and listening of events. This is the beating heart of Home Assistant.
The <b>State Machine</b> keeps track of the states of things. Fires a state_changed event when a state has been changed.
The **State Machine** keeps track of the states of things. Fires a state_changed event when a state has been changed.
The <b>Service Registry</b> listens on the event bus for call_service events and allows other code to register services.
The **Service Registry** listens on the event bus for call_service events and allows other code to register services.
The <b>Timer</b> will send every 10 seconds a time_changed event on the event bus.
The **Timer** will send every 10 seconds a time_changed event on the event bus.
Take for example the device_tracker component. This component is responsible for keeping track which devices are home. It checks which devices are home every time a time_changed event is fired on the event bus. It will then update the state machine with the information for each device.
This setup allows us to create simple yet powerful logic for controlling your home:
In the event that the state of device 'Paulus Nexus 5' changes to the 'Home' state:
In the event that device 'Paulus Nexus 5' changes to the 'Home' state:
If the sun has set and the lights are not on:
Turn on the lights
@ -37,3 +39,29 @@ This setup allows us to create simple yet powerful logic for controlling your ho
Turn on the lights
By using the Bus as a central communication hub between components it is easy to replace components or add functionality. If you would want to change the way devices are detected you only have to write a component that updates the device states in the State Machine.
## Multiple connected instances
Home Assistant supports running multiple synchronzied instances using a master-slave model. Slaves forward all local events fired and states set to the master instance which will then replicate it to each slave.
Because each slave maintains its own ServiceRegistry it is possible to have multiple slaves respond to one service call.
<a href='{{ root_url }}/images/architecture-remote.png'>
<img src='{{ root_url }}/images/architecture-remote.png' style='border: 0; box-shadow: none;' />
</a>
A slave instance can be started with the following code and has the same support for components as a master-instance.
```python
import homeassistant.remote as remote
import homeassistant.components.http as http
remote_api = remote.API("remote_host_or_ip", "remote_api_password")
hass = remote.HomeAssistant(remote_api)
http.setup(hass, "my_local_api_password")
hass.start()
hass.block_till_stopped()
```