Skip to content

Commit

Permalink
Change quick_check to immediate
Browse files Browse the repository at this point in the history
  • Loading branch information
acockburn committed Aug 18, 2017
1 parent 054dbe4 commit 7367088
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion appdaemon/appapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def listen_state(self, function, entity=None, **kwargs):
# In the case of a quick_start parameter,
# start the clock immediately if the device is already in the new state
#
if "quick_start" in kwargs and kwargs["quick_start"] is True:
if "immediate" in kwargs and kwargs["immediate"] is True:
if entity is not None and "new" in kwargs and "duration" in kwargs:
if conf.ha_state[entity]["state"] == kwargs["new"]:
exec_time = ha.get_now_ts() + int(kwargs["duration"])
Expand Down
12 changes: 6 additions & 6 deletions docs/APIREFERENCE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,18 @@ with the values of ``entity``, ``attr``, ``old`` and ``new`` that were
current at the time the actual event occured, since the assumption is
that none of them have changed in the intervening period.
quick_check = (optional)
''''''''''''''''''''''''
immediate = (optional)
''''''''''''''''''''''
True or False
Quick check enables the countdown for a delayt parameter to start at the time
Quick check enables the countdown for a ``delay`` parameter to start at the time
the callback is registered, rather than requiring one or more state changes. This can be useful if
for instance you want the duration to be triggered immediately if a light is already on.
If ``quick_check`` is in use, and ``new`` and ``duration`` are both set, AppDaemon will check if the entity
If ``immediate`` is in use, and ``new`` and ``duration`` are both set, AppDaemon will check if the entity
is already set to the new state and if so it will start the clock immediately. In this case, old will be ignored
and whern the timer triggers, it's state will be set to None. If new or entity are not set, ``quick_check`` will be ignored.
and when the timer triggers, it's state will be set to None. If new or entity are not set, ``immediate`` will be ignored.
\*\*kwargs
''''''''''
Expand Down Expand Up @@ -279,7 +279,7 @@ Examples
# Listen for a state change involving light.office1 changing to state on and remaining on for a minute
# Trigger immediately if the light is already on
self.handle = self.listen_state(self.my_callback, "light.office_1", new = "on", duration = 60, quick_check = True)
self.handle = self.listen_state(self.my_callback, "light.office_1", new = "on", duration = 60, immediate = True)
cancel\_listen\_state()
~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 7367088

Please sign in to comment.