Skip to content

Commit

Permalink
Small typo fix (home-assistant#3602)
Browse files Browse the repository at this point in the history
callack => callback
  • Loading branch information
johanvanderkuijl authored and fabaff committed Oct 21, 2017
1 parent bfbe694 commit a35cfbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/_docs/ecosystem/appdaemon.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This is also fairly easy to achieve with Home Assistant automations, but we are

## Motion Light

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 changes 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:
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 changes where the motion detector comes on by adding an additional parameter to the callback registration - `new = "on"`. When the motion is detected, the callback 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
Expand Down

0 comments on commit a35cfbf

Please sign in to comment.