diff options
Diffstat (limited to 'blueprints/automation/motion/halabyan24.yaml')
-rw-r--r-- | blueprints/automation/motion/halabyan24.yaml | 234 |
1 files changed, 234 insertions, 0 deletions
diff --git a/blueprints/automation/motion/halabyan24.yaml b/blueprints/automation/motion/halabyan24.yaml new file mode 100644 index 0000000..e06c26d --- /dev/null +++ b/blueprints/automation/motion/halabyan24.yaml @@ -0,0 +1,234 @@ +blueprint: + name: Halabyan24 Global Motions + description: Global motion/tracking rules for Halabyan 24 + domain: automation + +trigger: +# We get home (we rather rely on motion sensor here) +# - platform: state +# id: home +# entity_id: +# - group.master_phones +# from: not_home +# to: home +# for: +# hours: 0 +# minutes: 1 +# seconds: 0 + +# We get away from home (even near-by) + - platform: state + id: not_home + entity_id: + - group.master_phones + from: home + to: not_home + for: + hours: 1 + minutes: 0 + seconds: 0 + +# We get in home area (from outside) + - platform: state + id: around_home + entity_id: + - device_tracker.lm_g810 + from: not_home + to: HomeHalabyanExtended + for: + hours: 0 + minutes: 5 + seconds: 0 + +# We get away from home area + - platform: state + id: away_from_home + entity_id: + - device_tracker.lm_g810 + from: HomeHalabyanExtended + to: not_home + for: + hours: 1 + minutes: 0 + seconds: 0 + +# No motions in the hall for a day + - platform: state + entity_id: binary_sensor.hall_motions_occupancy + from: "on" + to: "off" + for: + hours: 24 + minutes: 0 + seconds: 0 + id: empty_day + +# No motions in the hall for a week + - platform: state + entity_id: binary_sensor.hall_motions_occupancy + from: "on" + to: "off" + for: + hours: 120 + minutes: 0 + seconds: 0 + id: empty_week + +# Motions in the hall detected + - platform: state + entity_id: binary_sensor.hall_motions_occupancy + from: "off" + to: "on" + for: + hours: 0 + minutes: 1 + seconds: 0 + id: motions + +# 'Away' security mode is turned off + - platform: state + entity_id: + - input_boolean.mode_away + from: 'on' + to: 'off' + id: away_gone + + +condition: [] +action: + - choose: + +# Set 'away' security mode if no motions for 1 day (or for 2 hours if we are 'alone' and left 'home area') + - conditions: + - condition: state + entity_id: input_boolean.mode_away + state: 'off' + - condition: or + conditions: + - condition: trigger + id: empty_day + - condition: and + conditions: + - condition: trigger + id: away_from_home + - condition: state + entity_id: input_boolean.mode_house_sleep + state: 'on' + sequence: + - service: switch.turn_on + target: + entity_id: switch.hall_lights_right + +# Set house to 'sleep' if no motions for 1 day (or for 2 hours if we are 'alone' and left 'home') + - conditions: + - condition: state + entity_id: input_boolean.mode_house_sleep + state: 'off' + - condition: or + conditions: + - condition: trigger + id: empty_day + - condition: and + conditions: + - condition: trigger + id: not_home +# - condition: state +# entity_id: input_boolean.mode_alone +# state: 'on' + - condition: state + entity_id: input_boolean.mode_guests + state: 'off' + - condition: state + entity_id: binary_sensor.hall_motions_occupancy + state: 'off' + for: + hours: 2 + minutes: 0 + seconds: 0 + sequence: + - service: script.sleep_and_wake + data: + mode: sleep + target: house + +# Set house to 'hibernate' if no motions for a week + - conditions: + - condition: trigger + id: empty_week + - condition: state + entity_id: input_boolean.mode_house_hibernate + state: 'off' + sequence: + - service: script.sleep_and_wake + data: + mode: hibernate + target: house + + +# Disable 'away' security mode if our phone is in vicinity + - conditions: + - condition: trigger + id: around_home + sequence: + - service: switch.turn_off + data: {} + target: + entity_id: switch.hall_lights_right + +# 'Wake' house if it was 'sleeping'/'hibernated' and +# * either there are motions in hall and 'away' security mode is not set +# * or 'away' security mode is just turned off + + - conditions: + - condition: or + conditions: + - condition: state + entity_id: input_boolean.mode_house_sleep + state: 'on' + for: + hours: 0 + minutes: 10 + seconds: 0 + - condition: state + entity_id: input_boolean.mode_house_hibernate + state: 'on' + for: + hours: 0 + minutes: 10 + seconds: 0 + - condition: or + conditions: + - condition: and + conditions: + - condition: trigger + id: motions + - condition: state + entity_id: input_boolean.mode_away + state: 'off' + - condition: and + conditions: + - condition: trigger + id: away_gone + - type: is_motion + condition: device + device_id: 6deb0a6fb7a4a849ba22afc166cf9919 + entity_id: binary_sensor.hall_motions_occupancy + domain: binary_sensor + sequence: + - if: + - condition: state + entity_id: input_boolean.mode_house_hibernate + state: 'on' + then: + - service: script.sleep_and_wake + data: + mode: wake + target: house + - service: input_boolean.turn_off + data: {} + target: + entity_id: + - input_boolean.mode_house_sleep + - input_boolean.mode_house_hibernate + default: [] +mode: single |