Skip to content

Commit

Permalink
time_active code example
Browse files Browse the repository at this point in the history
  • Loading branch information
ALERTua committed Aug 6, 2024
1 parent 6a0817d commit 1dc4da7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,16 @@ true if the current time doesn't match any of the "not" (negative) specification
allows multiple arguments with and without ``not``. The condition will be met if the current time
matches any of the positive arguments, and none of the negative arguments.

.. code:: python
@state_trigger("binary_sensor.motion_detected == 'on'") # trigger on motion detection
@state_active("input_boolean.motion_light_automation == 'on'") # but only if the automation is enabled
@time_active("range(8:00, 22:00)") # but only during the day
def motion_controlled_light(**kwargs):
log.info(f"got motion. turning on the lights")
light.turn_on(entity_id="light.hallway")
@webhook_trigger
^^^^^^^^^^^^^^^^

Expand Down

0 comments on commit 1dc4da7

Please sign in to comment.