From 0e6a9fbbae6844e9d3fd58be25cff843d2068875 Mon Sep 17 00:00:00 2001 From: Andrew Cockburn Date: Tue, 19 Sep 2017 11:55:06 -0400 Subject: [PATCH] Update tutorial.markdown --- source/_docs/ecosystem/appdaemon/tutorial.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_docs/ecosystem/appdaemon/tutorial.markdown b/source/_docs/ecosystem/appdaemon/tutorial.markdown index 18f25c5b1b6..8ce668ec7c5 100755 --- a/source/_docs/ecosystem/appdaemon/tutorial.markdown +++ b/source/_docs/ecosystem/appdaemon/tutorial.markdown @@ -69,7 +69,7 @@ This is also fairly easy to achieve with Home Assistant automations, but we are Our next example is to turn on a light when motion is detected and it is dark, and turn it off after a period of time. This time, the `initialize()` function registers a callback on a state change (of the motion sensor) rather than a specific time. We tell AppDaemon that we are only interested in state changesd where the motion detector comes on by adding an additional parameter to the callback registration - `new = "on"`. When the motion is detected, the callack function `motion()` is called, and we check whether or not the sun has set using a built-in convenience function: `sun_down()`. Next, we turn the light on with `turn_on()`, then set a timer using `run_in()` to turn the light off after 60 seconds, which is another call to the scheduler to execute in a set time from now, which results in `AppDaemon` calling `light_off()` 60 seconds later using the `turn_off()` call to actually turn the light off. This is still pretty simple in code terms: ```python -import homeassistant.appapi as appapi +import appdaemon.appapi as appapi class FlashyMotionLights(appapi.AppDaemon):