From 046efe3acbfe4c2efcab915d342ab11dc94708bf Mon Sep 17 00:00:00 2001 From: andythigpen Date: Sat, 7 Mar 2015 21:14:21 -0600 Subject: [PATCH 1/4] Adds script component. A script is composed of a sequence of actions (currently service calls) that are executed in order. Individual actions can also be delayed by a given timedelta. --- config/configuration.yaml.example | 20 ++- homeassistant/__init__.py | 2 + .../polymer/layouts/home-assistant-main.html | 24 ++- .../layouts/partial-dev-call-service.html | 2 +- .../polymer/layouts/partial-states.html | 14 +- .../polymer/more-infos/more-info-content.html | 1 + .../polymer/more-infos/more-info-script.html | 22 +++ .../resources/home-assistant-icons.html | 3 + .../polymer/resources/home-assistant-js.html | 2 +- homeassistant/components/script.py | 140 ++++++++++++++++++ 10 files changed, 223 insertions(+), 7 deletions(-) create mode 100644 homeassistant/components/frontend/www_static/polymer/more-infos/more-info-script.html create mode 100644 homeassistant/components/script.py diff --git a/config/configuration.yaml.example b/config/configuration.yaml.example index c758833d336..49886682507 100644 --- a/config/configuration.yaml.example +++ b/config/configuration.yaml.example @@ -120,4 +120,22 @@ sensor: - type: 'memory_free' - type: 'processor_use' - type: 'process' - arg: 'octave-cli' \ No newline at end of file + arg: 'octave-cli' + +script: + # Turns on the bedroom lights and then the living room lights 1 minute later + wakeup: + alias: Wake Up + sequence: + # alias is optional + - alias: Bedroom lights on + execute_service: light.turn_on + service_data: + entity_id: group.bedroom + - delay: + # supports seconds, milliseconds, minutes, hours, etc. + minutes: 1 + - alias: Living room lights on + execute_service: light.turn_on + service_data: + entity_id: group.living_room diff --git a/homeassistant/__init__.py b/homeassistant/__init__.py index 354898c0319..0d41e7dd2e6 100644 --- a/homeassistant/__init__.py +++ b/homeassistant/__init__.py @@ -115,6 +115,7 @@ class HomeAssistant(object): action(now) self.bus.listen(EVENT_TIME_CHANGED, point_in_time_listener) + return point_in_time_listener # pylint: disable=too-many-arguments def track_time_change(self, action, @@ -154,6 +155,7 @@ class HomeAssistant(object): action(event.data[ATTR_NOW]) self.bus.listen(EVENT_TIME_CHANGED, time_listener) + return time_listener def stop(self): """ Stops Home Assistant and shuts down all threads. """ diff --git a/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html b/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html index 73be6cb166d..3a8730dac8b 100644 --- a/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html +++ b/homeassistant/components/frontend/www_static/polymer/layouts/home-assistant-main.html @@ -93,6 +93,13 @@ + +
@@ -124,10 +131,10 @@ This is the main partial, never remove it from the DOM but hide it to speed up when people click on states. --> - + filter="{{selected}}">