diff options
author | root <root@smartpi.suren.me> | 2023-01-10 07:45:02 +0400 |
---|---|---|
committer | root <root@smartpi.suren.me> | 2023-01-10 07:45:02 +0400 |
commit | 2c0c331eb7b7a03152309bbbd4e0fee157e8d86c (patch) | |
tree | 03391160212b39c4597ecc26010f2ba1235a65e3 /custom/scripts | |
download | hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.gz hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.bz2 hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.tar.xz hass-2c0c331eb7b7a03152309bbbd4e0fee157e8d86c.zip |
Initial configuration
Diffstat (limited to 'custom/scripts')
-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 |