diff --git a/atom.xml b/atom.xml index e6f44eef0a..4bd7c8d46a 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/announcements/atom.xml b/blog/categories/announcements/atom.xml index 8c6bb77aee..dcd578c742 100644 --- a/blog/categories/announcements/atom.xml +++ b/blog/categories/announcements/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Announcements | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/cloud/atom.xml b/blog/categories/cloud/atom.xml index b53044c163..369a8a795f 100644 --- a/blog/categories/cloud/atom.xml +++ b/blog/categories/cloud/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Cloud | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index 70f3efc18f..d04012e5d2 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Community | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index 221a13273b..462ba2d103 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index e08d4e3ce8..f9e355b011 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index 10849a8f86..0ce06b29f0 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index 814aa56dfa..8299cee3d8 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index 601cb2b792..f00523cd3b 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index f413b6f4c1..da9f0d4c54 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/media/atom.xml b/blog/categories/media/atom.xml index d50fbe8625..bcde49e5c6 100644 --- a/blog/categories/media/atom.xml +++ b/blog/categories/media/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Media | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/merchandise/atom.xml b/blog/categories/merchandise/atom.xml index 6a2f34d337..5472848382 100644 --- a/blog/categories/merchandise/atom.xml +++ b/blog/categories/merchandise/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Merchandise | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index 6a9754e7a8..e1768b7b1a 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index c2afc19077..238219274a 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/organization/atom.xml b/blog/categories/organization/atom.xml index 33337c8fe4..cdcb4a1495 100644 --- a/blog/categories/organization/atom.xml +++ b/blog/categories/organization/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organization | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index 87c50094d9..da4eca8f27 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index 329ffa8dcb..4825edf8b4 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index 2be7d97b5a..a1d9647a76 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index 3775f259fa..4153789ff3 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index f04818002d..d27120445a 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index c0676cf5a9..e7c9b3454e 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index a3b22beb14..8fbba670bd 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index 7654fa0b65..c1a9e4726e 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index a16075b5f8..e23c11a729 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index 3db678e595..37cc44391c 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2018-03-05T22:27:56+00:00 + 2018-03-06T07:56:12+00:00 https://home-assistant.io/ diff --git a/docs/ecosystem/appdaemon/tutorial/index.html b/docs/ecosystem/appdaemon/tutorial/index.html index 1e2cd58dbc..92b7027852 100644 --- a/docs/ecosystem/appdaemon/tutorial/index.html +++ b/docs/ecosystem/appdaemon/tutorial/index.html @@ -101,20 +101,36 @@

How it Works

The best way to show what AppDaemon does is through a few simple examples.

Sunrise/Sunset Lighting

-

Lets start with a simple App to turn a light on every night at sunset and off every morning at sunrise. Every App when first started will have its initialize() function called which gives it a chance to register a callback for AppDaemons’s scheduler for a specific time. In this case we are using run_at_sunrise() and run_at_sunset() to register 2 separate callbacks. The argument 0 is the number of seconds offset from sunrise or sunset and can be negative or positive. For complex intervals it can be convenient to use Python’s datetime.timedelta class for calculations. When sunrise or sunset occurs, the appropriate callback function, sunrise_cb() or sunset_cb() is called which then makes a call to Home Assistant to turn the porch light on or off by activating a scene. The variables args["on_scene"] and args["off_scene"] are passed through from the configuration of this particular App, and the same code could be reused to activate completely different scenes in a different version of the App.

-
import homeassistant.appapi as appapi
+

Lets start with a simple App to turn a light on every night fifteen +minutes (900 seconds) before sunset and off every morning at sunrise. +Every App when first started will have its initialize() function +called which gives it a chance to register a callback for AppDaemons’s +scheduler for a specific time. In this case we are using +run_at_sunrise() and run_at_sunset() to register 2 separate +callbacks. The named argument offset is the number of seconds offset +from sunrise or sunset and can be negative or positive (it defaults to +zero). For complex intervals it can be convenient to use Python’s +datetime.timedelta class for calculations. In the example below, +when sunrise or just before sunset occurs, the appropriate callback +function, sunrise_cb() or before_sunset_cb() is called which +then makes a call to Home Assistant to turn the porch light on or off by +activating a scene. The variables args["on_scene"] and +args["off_scene"] are passed through from the configuration of this +particular App, and the same code could be reused to activate completely +different scenes in a different version of the App.

+
    import appdaemon.plugins.hass.hassapi as hass
 
-class OutsideLights(appapi.AppDaemon):
+    class OutsideLights(hass.Hass):
 
-  def initialize(self):
-    self.run_at_sunrise(self.sunrise_cb, 0)
-    self.run_at_sunset(self.sunset_cb, 0)
-    
-  def sunrise_cb(self, kwargs):
-    self.turn_on(self.args["off_scene"])
+      def initialize(self):
+        self.run_at_sunrise(self.sunrise_cb)
+        self.run_at_sunset(self.before_sunset_cb, offset=-900)
+        
+      def sunrise_cb(self, kwargs):
+        self.turn_on(self.args["off_scene"])
 
-  def sunset_cb(self, kwargs):
-    self.turn_on(self.args["on_scene"])
+      def before_sunset_cb(self, kwargs):
+        self.turn_on(self.args["on_scene"])
 
 
diff --git a/sitemap.xml b/sitemap.xml index d9fe74b637..1fb46bc883 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4090,7 +4090,7 @@ https://home-assistant.io/components/switch.hook/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/cookbook/automation_for_rainy_days/ @@ -4778,131 +4778,131 @@ https://home-assistant.io/docs/autostart/init.d/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/api/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/configuration/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/example_apps/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/installation/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/operation/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/reboot/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/running/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/tutorial/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/updating/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/appdaemon/windows/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/certificates/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/hadashboard/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/hass-configurator/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/ios/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/nginx/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/notebooks/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/scenegen/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/ecosystem/synology/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/benchmark/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/check_config/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/credstash/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/db_migrator/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/dev-tools/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/ensure_config/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/hass/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/influxdb_import/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/influxdb_migrator/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/keyring/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/docs/tools/scripts/ -2018-03-05T22:27:56+00:00 +2018-03-06T07:56:12+00:00 https://home-assistant.io/faq/after-upgrading/ @@ -6098,62 +6098,62 @@ https://home-assistant.io/demo/frontend.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/index.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-event.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-info.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-service.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-state.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-dev-template.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-history.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-iframe.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-logbook.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/demo/panels/ha-panel-map.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/googlef4f3693c209fe788.html -2018-03-05T22:26:39+00:00 +2018-03-06T07:55:23+00:00 https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html -2018-03-05T22:26:40+00:00 +2018-03-06T07:55:24+00:00 https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html -2018-03-05T22:26:40+00:00 +2018-03-06T07:55:24+00:00 https://home-assistant.io/static/mdi-demo.html -2018-03-05T22:26:40+00:00 +2018-03-06T07:55:24+00:00