diff --git a/configuration/automations/behaviour-goto-sleep.yaml b/configuration/automations/behaviour-goto-sleep.yaml new file mode 100644 index 0000000..8a006ea --- /dev/null +++ b/configuration/automations/behaviour-goto-sleep.yaml @@ -0,0 +1,152 @@ +- id: goto_sleep + alias: '[Behaviour] Go to sleep' + description: '' + trigger: + - platform: time + at: '23:25' + - platform: time + at: '23:55' + condition: + - condition: time + weekday: + - mon + - tue + - wed + - thu + - sun + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + action: + - service: light.turn_on + data: + flash: long + rgb_color: + - 255 + - 0 + - 0 + target: + entity_id: light.table_light_up + - delay: '0:05:00' + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + - condition: state + entity_id: input_boolean.pc_caffeine + state: 'off' + sequence: + - service: shell_command.pc_poweroff + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + - condition: state + entity_id: input_boolean.pc_caffeine + state: 'off' + sequence: + - service: input_boolean.turn_off + target: + entity_id: input_boolean.pc_caffeine + - service: light.turn_off + target: + entity_id: light.table_light_up + mode: single + +- id: goto_sleep-2 + alias: '[Behaviour] Go to sleep 2 (next day)' + description: '' + trigger: + - platform: time + at: '0:25' + condition: + - condition: time + weekday: + - mon + - tue + - wed + - thu + - fri + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + action: + - service: light.turn_on + data: + flash: long + rgb_color: + - 255 + - 0 + - 0 + target: + entity_id: light.table_light_up + - delay: '0:05:00' + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + - condition: state + entity_id: input_boolean.pc_caffeine + state: 'off' + sequence: + - service: shell_command.pc_poweroff + - choose: + - conditions: + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + - condition: state + entity_id: input_boolean.pc_caffeine + state: 'off' + sequence: + - service: input_boolean.turn_off + target: + entity_id: input_boolean.pc_caffeine + - service: light.turn_off + target: + entity_id: light.table_light_up + mode: single + +- id: goto_sleep- + alias: '[Behaviour] Go to sleep 3 (hard cutoff)' + description: '' + trigger: + - platform: time + at: '0:55' + condition: + - condition: time + weekday: + - mon + - tue + - wed + - thu + - fri + - condition: state + entity_id: binary_sensor.desktop + state: 'on' + action: + - service: light.turn_on + data: + flash: long + rgb_color: + - 255 + - 0 + - 0 + target: + entity_id: light.table_light_up + - delay: '0:05:00' + - service: shell_command.pc_poweroff + - service: input_boolean.turn_off + target: + entity_id: input_boolean.pc_caffeine + - service: light.turn_off + target: + entity_id: light.table_light_up + - delay: '0:05:00' + - service: switch.turn_off + target: + entity_id: switch.computer_outlet + mode: single diff --git a/configuration/automations/goto-sleep.yaml b/configuration/automations/goto-sleep.yaml deleted file mode 100644 index 7eee242..0000000 --- a/configuration/automations/goto-sleep.yaml +++ /dev/null @@ -1,33 +0,0 @@ -- id: goto_sleep - alias: '[Behaviour] Go to sleep' - description: '' - trigger: - - platform: time - at: '23:25' - condition: - - condition: time - weekday: - - mon - - tue - - wed - - thu - - sun - - condition: state - entity_id: binary_sensor.desktop - state: 'on' - action: - - service: light.turn_on - data: - flash: long - brightness: 200 - rgb_color: - - 255 - - 0 - - 0 - entity_id: light.desk_lightbar_ambilight - - delay: '0:05:00' - - condition: state - entity_id: binary_sensor.desktop - state: 'on' - - service: shell_command.pc_poweroff - mode: single