From 0f1102fd68fc0e1578a10746ccca695772e9f2ba Mon Sep 17 00:00:00 2001 From: CCOSTAN Date: Thu, 23 Feb 2017 21:50:00 +0000 Subject: [PATCH] Closes #72 - Move IFTTT triggers locally to Input_booleans --- automation/flash_all.yaml | 19 ++++++++++++++ automation/good_morning.yaml | 10 +++++--- automation/good_night.yaml | 9 +++++-- automation/mealtime.yaml | 8 ++++-- automation/tv_time_on_and_off.yaml | 12 ++++++--- automation/work.yaml | 40 ++++++++++++++++------------- input_boolean/trigger_booleans.yaml | 24 +++++++++++++++++ 7 files changed, 93 insertions(+), 29 deletions(-) create mode 100755 automation/flash_all.yaml create mode 100755 input_boolean/trigger_booleans.yaml diff --git a/automation/flash_all.yaml b/automation/flash_all.yaml new file mode 100755 index 00000000..59764c0d --- /dev/null +++ b/automation/flash_all.yaml @@ -0,0 +1,19 @@ +###################################################################### +## Turn off my Office light whenever I leave the house. +###################################################################### +- alias: 'Carlo has left the building' + trigger: + - platform: state + entity_id: input_boolean.flash + state: 'on' + from: 'off' + + action: + - service: light.turn_on + entity_id: + - group.all_lights + data: + flash: long + + - service: input_boolean.turn_off + entity_id: input_boolean.flash diff --git a/automation/good_morning.yaml b/automation/good_morning.yaml index 69e7c897..4c4d2d0c 100755 --- a/automation/good_morning.yaml +++ b/automation/good_morning.yaml @@ -4,10 +4,12 @@ - alias: 'Good Morning Routine' trigger: - - platform: event - event_type: good_morning - platform: state - entity_id: + entity_id: input_boolean.good_morning + state: 'on' + from: 'off' + - platform: state + entity_id: - binary_sensor.sleepnumber_carlo_stacey_is_in_bed state: 'off' @@ -38,3 +40,5 @@ - delay: 00:01:00 - service: switch.turn_on entity_id: switch.kitchen_accents + - service: input_boolean.turn_off + entity_id: input_boolean.good_morning diff --git a/automation/good_night.yaml b/automation/good_night.yaml index dad2d4b2..c7b970ba 100755 --- a/automation/good_night.yaml +++ b/automation/good_night.yaml @@ -4,8 +4,10 @@ - alias: 'Good Night Trigger' trigger: - - platform: event - event_type: good_night + - platform: state + entity_id: input_boolean.good_night + state: 'on' + from: 'off' - platform: state entity_id: - binary_sensor.sleepnumber_carlo_carlo_is_in_bed @@ -27,6 +29,9 @@ state: 'on' action: + - service: input_boolean.turn_off + entity_id: input_boolean.good_night + - service: script.Voice_notify data_template: value1: > diff --git a/automation/mealtime.yaml b/automation/mealtime.yaml index 55b5e7ac..90e123b3 100755 --- a/automation/mealtime.yaml +++ b/automation/mealtime.yaml @@ -4,8 +4,10 @@ - alias: Meal Time trigger: - - platform: event - event_type: mealtime + - platform: state + entity_id: input_boolean.meal_time + state: 'on' + from: 'off' action: - service: light.turn_on @@ -15,3 +17,5 @@ - service: light.turn_off entity_id: - group.living_room_lights + - service: input_boolean.turn_off + entity_id: input_boolean.meal_time diff --git a/automation/tv_time_on_and_off.yaml b/automation/tv_time_on_and_off.yaml index c360a1af..461ee42b 100755 --- a/automation/tv_time_on_and_off.yaml +++ b/automation/tv_time_on_and_off.yaml @@ -7,8 +7,10 @@ - platform: sun event: sunset offset: '+01:00:00' - - platform: event - event_type: tv_time + - platform: state + entity_id: input_boolean.TV_time + state: 'on' + from: 'off' - platform: state entity_id: sensor.samsungtv state: 'Online' @@ -32,8 +34,10 @@ state: 'off' action: - service: scene.turn_on - entity_id: scene.tv_time + - service: scene.turn_on + entity_id: scene.tv_time + - service: input_boolean.turn_off + entity_id: input_boolean.tv_time ###################################################################### ## Turn off the Living room lights when the TV is turned off. diff --git a/automation/work.yaml b/automation/work.yaml index 922e6ad3..e1cb4995 100755 --- a/automation/work.yaml +++ b/automation/work.yaml @@ -1,18 +1,22 @@ -###################################################################### -## Time to work - Set it up! -###################################################################### - -- alias: Time to Work - trigger: - - platform: event - event_type: work - - action: - - service: light.turn_off - entity_id: - - group.dinette_lights - - group.kitchen_lights - - group.living_room_lights - - service: light.turn_on - entity_id: - - light.office_lamp +###################################################################### +## Time to work - Set it up! +###################################################################### + +- alias: Time to Work + trigger: + - platform: state + entity_id: input_boolean.work + state: 'on' + from: 'off' + + action: + - service: light.turn_off + entity_id: + - group.dinette_lights + - group.kitchen_lights + - group.living_room_lights + - service: light.turn_on + entity_id: + - light.office_lamp + - service: input_boolean.turn_off + entity_id: input_boolean.work diff --git a/input_boolean/trigger_booleans.yaml b/input_boolean/trigger_booleans.yaml new file mode 100755 index 00000000..c3c313ab --- /dev/null +++ b/input_boolean/trigger_booleans.yaml @@ -0,0 +1,24 @@ +#triggers +good_night: + name: Good Night + initial: off + +good_morning: + name: Good Morning + initial: off + +meal_time: + name: Meal Time + initial: off + +tv_time: + name: TV Time + initial: off + +work: + name: Work + initial: off + +flash: + name: Flash + initial: off