diff options
Diffstat (limited to 'custom/scripts/sleep-and-wake.yaml')
-rw-r--r-- | custom/scripts/sleep-and-wake.yaml | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/custom/scripts/sleep-and-wake.yaml b/custom/scripts/sleep-and-wake.yaml new file mode 100644 index 0000000..b737e8d --- /dev/null +++ b/custom/scripts/sleep-and-wake.yaml @@ -0,0 +1,129 @@ +sleep_and_wake: + alias: "Sleep and Wake" + description: "Sleep, Hibernate, and Wake actions for Office and Complete House" + fields: + mode: + name: Mode + description: "Operation mode: Sleep is non-intrusive action while Hibernate aimed on maximum power-savings and security" + required: true + selector: + select: + options: + - hibernate + - sleep + - wake + target: + name: Target + description: "Area: Office or complete House (more areas might be added in future)" + required: true + selector: + select: + options: + - office + - house + + mode: single + + sequence: + - choose: + - conditions: + - condition: template + value_template: '{{ target == "office" }}' + sequence: + - choose: + - conditions: + - condition: template + value_template: '{{ mode == "sleep" }}' + sequence: + - parallel: + - service: switch.turn_off + target: + entity_id: switch.smart_power_strip_pro_socket_1 + - service: switch.turn_off + target: + entity_id: switch.living_lights_right + + - conditions: + - condition: template + value_template: '{{ mode == "hibernate" }}' + sequence: + - parallel: + - service: media_player.media_stop + target: + entity_id: media_player.smartpi +# Wait until we fix both sleep and WOL on laptop +# - service: switch.turn_off +# target: +# entity_id: switch.plugs_office + - service: switch.turn_off + target: + entity_id: switch.smart_power_strip_pro_socket_1 + - service: switch.turn_off + target: + entity_id: switch.living_lights_right + + - conditions: + - condition: template + value_template: '{{ mode == "wake" }}' + sequence: + - parallel: + - service: switch.turn_on + target: + entity_id: switch.plugs_office + - service: wake_on_lan.send_magic_packet + data: + mac: "e8:6a:64:7b:5d:0a" + - delay: + seconds: 2 + - service: wake_on_lan.send_magic_packet + data: + mac: "e8:6a:64:7b:5d:0a" + + - conditions: + - condition: template + value_template: '{{ target == "house" }}' + sequence: + - choose: + - conditions: + - condition: template + value_template: '{{ mode == "sleep" }}' + sequence: + - parallel: +# Wait until we fix both sleep and WOL on laptop +# - service: switch.turn_off +# target: +# entity_id: switch.plugs_office + - service: switch.turn_off + target: + entity_id: switch.smart_power_strip_pro_socket_1 + - service: switch.turn_off + target: + entity_id: switch.lights_all + # Thats a better way to allow some time for leaving + - service: switch.turn_on + target: + entity_id: switch.hall_lights_right + + - conditions: + - condition: template + value_template: '{{ mode == "hibernate" }}' + sequence: + - service: switch.turn_off + target: + entity_id: + - switch.lights_all + - switch.plugs_manual + - switch.plugs_controlled + - service: switch.turn_on + target: + entity_id: switch.hall_lights_right + + - conditions: + - condition: template + value_template: '{{ mode == "wake" }}' + sequence: + - service: switch.turn_on + target: + entity_id: + - switch.plugs_kitchen + - switch.bedroom_bedsidelampsocket |