From 6c1fc639f71fc81827a1dc355a5ab0bd6ab04b89 Mon Sep 17 00:00:00 2001 From: Brian J King Date: Thu, 4 Oct 2018 12:52:47 -0500 Subject: [PATCH] Add new example for restricting motion sensor lights based on time and using transitions (#6512) --- ...r_10_minutes_when_motion_detected.markdown | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/_cookbook/turn_on_light_for_10_minutes_when_motion_detected.markdown b/source/_cookbook/turn_on_light_for_10_minutes_when_motion_detected.markdown index 27320af7a8f..eaa2175bab5 100644 --- a/source/_cookbook/turn_on_light_for_10_minutes_when_motion_detected.markdown +++ b/source/_cookbook/turn_on_light_for_10_minutes_when_motion_detected.markdown @@ -73,3 +73,36 @@ timer: hallway: duration: '00:10:00' ``` + +You can also restrict lights from turning on based on time of day and implement transitions for fading lights on and off. + +```yaml +- alias: Motion Sensor Lights On + trigger: + platform: state + entity_id: binary_sensor.ecolink_pir_motion_sensor_sensor + to: 'on' + condition: + condition: time + after: '07:30' + before: '23:30' + action: + service: homeassistant.turn_on + entity_id: group.office_lights + data: + transition: 15 + + +- alias: Motion Sensor Lights Off + trigger: + - platform: state + entity_id: binary_sensor.ecolink_pir_motion_sensor_sensor + to: 'off' + for: + minutes: 15 + action: + - service: homeassistant.turn_off + entity_id: group.office_lights + data: + transition: 160 +``` \ No newline at end of file