AutomationDataset/DarkFox/DarkFox_automations.yaml

9065 lines
267 KiB
YAML

- id: toggle_3d_printer_light
alias: Toggle 3D printer light
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.3d_printer_lys
from:
- 'on'
- 'off'
to:
- 'on'
- 'off'
actions:
action: light.turn_{{ states('binary_sensor.3d_printer_lys') }}
target:
entity_id: light.3d_printer_enclosure_light
- alias: Dehumidifier on after enclosure door closed
id: 0a95a5cd-b3ea-4fa1-b392-93bc9cce5379
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.3d_printer_skab
to: 'off'
actions:
- action: switch.turn_on
target:
entity_id: switch.filament_affugter
- id: 3d_printer_set_thermostat
alias: 3d Printer Set Thermostat
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id:
- sensor.3d_printer_build_volume_temperature
- binary_sensor.3d_printer_aktiv
- sensor.octoprint_current_state
actions:
- choose:
- alias: Printing
conditions:
- condition: template
value_template: "{{\n is_state('binary_sensor.3d_printer_aktiv', 'on')\n\
\ and states('sensor.octoprint_current_state') in ['Printing', 'Pausing',\
\ 'Resuming']\n}}"
sequence:
- action: scene.apply
data:
entities:
climate.3d_printer:
state: cool
temperature: '{{ states(''sensor.3d_printer_build_volume_temperature'')
| default(25) }}'
- alias: Cool down
conditions:
- condition: template
value_template: "{{\n is_state('binary_sensor.3d_printer_aktiv', 'on')\n\
\ and states('sensor.octoprint_current_state') not in ['Printing', 'Pausing',\
\ 'Resuming']\n}}"
sequence:
- action: scene.apply
data:
entities:
climate.3d_printer:
state: cool
temperature: 20
default:
- action: climate.turn_off
target:
entity_id: climate.3d_printer
- id: 3d_printer_ventilation_off
alias: 3d Printer Ventilation Off
initial_state: true
triggers:
- trigger: state
entity_id: climate.3d_printer
attribute: hvac_action
to: 'off'
actions:
action: fan.turn_off
target:
entity_id:
- fan.3d_printer_enclosure_ind
- fan.3d_printer_enclosure_ud
- id: 3d_printer_ventilation_low
alias: 3d Printer Ventilation Low
initial_state: true
triggers:
- trigger: state
entity_id: climate.3d_printer
attribute: hvac_action
to: idle
actions:
- action: fan.turn_on
target:
entity_id:
- fan.3d_printer_enclosure_ind
- fan.3d_printer_enclosure_ud
- action: fan.set_percentage
target:
entity_id:
- fan.3d_printer_enclosure_ind
data:
percentage: 5
- action: fan.set_percentage
target:
entity_id:
- fan.3d_printer_enclosure_ud
data:
percentage: 25
- id: 3d_printer_ventilation_high
alias: 3d Printer Ventilation High
initial_state: true
triggers:
- trigger: state
entity_id: climate.3d_printer
attribute: hvac_action
to: cooling
actions:
- action: fan.turn_on
target:
entity_id:
- fan.3d_printer_enclosure_ind
- fan.3d_printer_enclosure_ud
- action: fan.set_percentage
target:
entity_id:
- fan.3d_printer_enclosure_ind
- fan.3d_printer_enclosure_ud
data:
percentage: 100
- id: 3d_print_status_notification
alias: 3D Print status notification
initial_state: true
triggers:
- trigger: state
entity_id: sensor.octoprint_current_state
to: Printing
- trigger: time_pattern
minutes: /5
seconds: '0'
conditions:
- alias: Print active
condition: state
entity_id: sensor.octoprint_current_state
state: Printing
actions:
- action: notify.mobile_app_darkphone
data:
title: 3D Print Progress {{ states('sensor.octoprint_print_progress') }}% -
{{ states('sensor.octoprint_current_state') }}
message: '{% set seconds = states(''sensor.octoprint_print_time_left'') | int
%} {% set hours = seconds // 3600 %} {% set minutes = (seconds % 3600) //
60 %} {% set remaining_seconds = seconds % 60 %} Time left: {{ ''%02d:%02d:%02d''
| format(hours, minutes, remaining_seconds) }}'
data:
tag: 3d_print_status_notification
channel: 3D Printer Status
importance: low
persistent: true
image: /api/camera_proxy/camera.3d_printer_head
- id: 3d_print_stopped_notification
alias: 3D Print stopped notification
initial_state: true
triggers:
- trigger: state
entity_id: sensor.octoprint_current_state
from: Printing
actions:
- action: notify.mobile_app_darkphone
data:
message: clear_notification
data:
tag: 3d_print_status_notification
channel: 3D Printer Status
- action: script.translate
data:
message: '{{ states(''sensor.octoprint_current_state'') }}'
response_variable: output
- delay:
seconds: 1
- variables:
message: 3D Printer {{ states('sensor.3d_printer_status') }}
- action: notify.mobile_app_darkphone
data:
title: '{{ message }}'
message: ''
data:
tag: 3d_print_alert_notification
channel: 3D Printer Alerts
importance: high
image: /api/camera_proxy/camera.3d_printer
- action: script.voice_broadcast
data:
message: '{{ message }}'
- id: 3d_printer_active
alias: 3D Printer Aktiv
triggers:
- trigger: state
entity_id: binary_sensor.3d_printer_aktiv
to: 'on'
actions:
- action: automation.turn_on
target:
entity_id: automation.3d_printer_swap_cameras
- id: 3d_printer_auto_shutdown
alias: 3d Printer Auto Shutdown
triggers:
- trigger: state
entity_id: binary_sensor.3d_printer_aktiv
to: 'off'
for:
minutes: 15
actions:
- action: switch.turn_off
target:
entity_id: switch.3d_printer_afbryder
- action: automation.turn_off
target:
entity_id: automation.3d_printer_swap_cameras
- id: 3d_printer_swap_cameras
alias: 3D Printer Swap Cameras
triggers:
- trigger: time_pattern
seconds: /15
actions:
- action: input_boolean.toggle
target:
entity_id: input_boolean.3d_printer_swap_cameras
- alias: latest_motion_away
id: 9a681933-f941-4df6-80cf-47b3f73a809c
initial_state: true
triggers:
- trigger: state
entity_id: person.rook
not_to: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Away
- alias: Airmee Tracking Slow
id: 77061068-2db4-417c-abdb-ac4393dc20bb
mode: single
triggers:
- trigger: time_pattern
hours: '*'
minutes: /15
seconds: '0'
- trigger: state
entity_id: binary_sensor.airmee_active
to: 'on'
- trigger: state
entity_id: sensor.airmee_url
conditions:
- condition: state
entity_id: binary_sensor.airmee_within_delivery_window
state: 'off'
- condition: state
entity_id: binary_sensor.airmee_active
state: 'on'
actions:
- action: script.get_airmee_tracking
data:
tracking_code: '{{ state_attr(''sensor.airmee_url'', ''params'').get(''tracking_url'',
'''') }}'
phone_number_hash: '{{ state_attr(''sensor.airmee_url'', ''params'').get(''phone_number_hash'',
'''') }}'
- alias: Airmee Tracking Fast
id: 2f38d3c7-6973-480b-a33b-5299667c550c
mode: single
triggers:
- trigger: time_pattern
hours: '*'
minutes: '*'
seconds: '0'
conditions:
- condition: state
entity_id: binary_sensor.airmee_within_delivery_window
state: 'on'
- condition: state
entity_id: binary_sensor.airmee_active
state: 'on'
- condition: not
conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.airmee_tracking
state: UNASSIGNED
- condition: state
entity_id: sensor.airmee_tracking
state: DROPOFF_CONFIRMED
actions:
- action: script.get_airmee_tracking
data:
tracking_code: '{{ state_attr(''sensor.airmee_url'', ''params'').get(''tracking_url'',
'''') }}'
phone_number_hash: '{{ state_attr(''sensor.airmee_url'', ''params'').get(''phone_number_hash'',
'''') }}'
- alias: Airmee Courier Close
id: 960d4a70-4b56-4bbf-a353-d71985e28ff5
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.airmee_courier_close
to: 'on'
conditions:
- condition: state
entity_id: automation.delivery_unlock_front_door
state: 'off'
actions:
- parallel:
- action: automation.turn_on
data:
entity_id: automation.delivery_unlock_front_door
- action: script.notify_everywhere
data:
message: Airmee bud nærmer sig. Automatisk gadedør-oplåsning slået til.
- alias: Airmee Tracking Toggle
id: 84fd41b3-89c0-4b15-9461-a88f4e0a8f53
initial_state: true
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.airmee_active
condition:
- condition: state
entity_id: binary_sensor.airmee_active
state: 'on'
actions:
- alias: Airmee Code Present
choose:
- conditions:
- condition: state
entity_id: binary_sensor.airmee_active
state: 'on'
sequence:
- action: automation.turn_on
data:
entity_id:
- automation.airmee_tracking_slow
- automation.airmee_courier_close
default:
- action: automation.turn_off
data:
entity_id:
- automation.airmee_tracking_slow
- automation.airmee_courier_close
- alias: Automatic Backup
id: c9d66be2-eaa9-49c6-93f1-fe9bfd98fe91
initial_state: true
triggers:
trigger: time
at: 03:00:00
conditions:
condition: time
weekday:
- sun
- wed
actions:
- action: auto_backup.backup
data:
name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
keep_days: 7
exclude:
folders:
- media
- alias: Notify Backup Started
id: bb2ef893-b9db-4718-80f5-d141f0491327
triggers:
trigger: event
event_type: auto_backup.backup_start
actions:
action: persistent_notification.create
data:
title: Backup Started.
message: 'Name: {{ trigger.event.data.name }}'
- alias: Notify Backup Completed
id: 74d23a64-03e5-435a-95e7-988f81dddc30
triggers:
trigger: event
event_type: auto_backup.backup_successful
actions:
- action: persistent_notification.create
data:
title: Backup Complete. Syncing to Dropbox
message: 'Name: {{ trigger.event.data.name }}
Slug: {{ trigger.event.data.slug }}'
- action: hassio.addon_stdin
data:
addon: 719b45ef_dropback
input: sync
- alias: Notify Backup Sync Started
id: 0aa22b1d-627e-4625-84d9-78c50e3140b3
triggers:
trigger: state
entity_id: sensor.dropback_sync
not_to:
- unknown
- unavailable
- ''
actions:
action: persistent_notification.create
data:
title: Backup Sync started.
message: 'Name: {{ trigger.to_state.state }}'
- alias: Notify Backup Sync Complete
id: d768bde2-b457-49bd-87b4-ac89d96bfcbc
triggers:
trigger: state
entity_id: sensor.dropback_sync
not_from:
- unknown
- unavailable
- ''
actions:
action: persistent_notification.create
data:
title: Backup Synced.
message: 'Name: {{ trigger.from_state.state }}'
- alias: Notify Backup Failure
id: 75195f2a-43fd-4fee-8a66-463e1d426600
triggers:
trigger: event
event_type: auto_backup.backup_failed
actions:
action: persistent_notification.create
data:
title: Backup Failed.
message: 'Name: {{ trigger.event.data.name }}
Error: {{ trigger.event.data.error }}'
- alias: Notify Backup Sync Failed
id: 876cc78e-85b7-4f28-bbd8-abcd9563371c
triggers:
trigger: state
entity_id: sensor.dropback_status
to: Error
actions:
action: persistent_notification.create
data:
title: Backup Sync error.
message: Dropback failed to sync backup.
- alias: activate_light_profile_balcony
id: cd9e9d2a-a821-4adb-b29c-8cb577077ded
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.balcony_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.balcony_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.altan:
state: true
brightness: 255
color_temp_kelvin: 4000
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.altan:
state: true
brightness: 255
color_temp_kelvin: 2857
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.altan:
state: true
brightness: 128
color_temp_kelvin: 2000
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.altan:
state: true
brightness: 128
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.altan:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.altan:
state: false
- alias: bathroom_door_activity_on
id: e7500347-c170-40a2-a12b-9228a83bd56a
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.badevarelse_dor
to:
- 'on'
- 'off'
not_from:
- unavailable
- unknown
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.bathroom_door_activity
- alias: bathroom_door_activity_off
id: 21421df7-95cf-4e18-823f-b1c9dc88d03a
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.bathroom_door_activity
to:
- 'on'
- 'off'
for:
seconds: 5
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.bathroom_door_activity
- alias: activate_light_profile_bathroom
id: 4a9ce9a3-eb04-4bc8-8732-3ab0a988cb5e
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.bathroom_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.bathroom_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.badevaerelse_skab
state: true
brightness: 255
hs_color:
- 29
- 15
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.badevaerelse_loft:
state: true
brightness: 255
color_temp_kelvin: 4166
effect: solid
light.badevaerelse_lampe:
state: true
brightness: 255
color_temp_kelvin: 4166
- action: light.turn_on
target:
entity_id: light.bathroom_tablet
data:
brightness: 255
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.badevaerelse_skab
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'') }}'
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.badevaerelse_loft:
state: true
brightness: 255
color_temp_kelvin: 4166
effect: solid
light.badevaerelse_lampe:
state: true
brightness: 255
color_temp_kelvin: 4166
- action: light.turn_on
target:
entity_id: light.bathroom_tablet
data:
brightness: 255
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.badevaerelse_skab
state: true
brightness: 96
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'') }}'
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.badevaerelse_loft:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_12v'')
}}'
effect: Solid
light.badevaerelse_lampe:
state: true
brightness: 127
color_temp_kelvin: 2700
- action: light.turn_on
target:
entity_id: light.bathroom_tablet
data:
brightness: 127
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.badevaerelse_skab
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'') }}'
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.badevaerelse_loft:
state: true
brightness: 24
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_12v'')
}}'
effect: Lake
light.badevaerelse_lampe:
state: true
brightness: 64
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
- action: light.turn_on
target:
entity_id: light.bathroom_tablet
data:
brightness: 64
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.badevaerelse_skab
state: true
brightness: 24
hs_color:
- 0
- 100
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.badevaerelse_loft:
state: true
brightness: 10
rgb_color:
- 255
- 0
- 0
effect: Solid
light.badevaerelse_lampe:
state: true
brightness: 2
color_temp_kelvin: 2202
- action: light.turn_on
target:
entity_id: light.bathroom_tablet
data:
brightness: 24
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.badevaerelse_loft:
state: false
light.badevaerelse_lampe:
state: false
light.badevaerelse_skab:
state: false
- delay: '{{ (states(''input_number.scene_transition_time'') | float or 0.5)
+ 1 }}'
- condition: '{{ is_state(''sensor.bathroom_selected_light_profile'', ''Off'')
}}'
- action: light.turn_off
target:
entity_id: light.badevaerelse_loft
- delay: 00:01:00
- condition: '{{ is_state(''sensor.bathroom_selected_light_profile'', ''Off'')
}}'
- action: light.turn_off
target:
entity_id: light.badevaerelse_loft
- action: light.turn_off
target:
entity_id: light.bathroom_tablet
- alias: Set Bathroom Latest Motion
id: 2d6e3e42-2e63-4466-94d9-5cc5e0167885
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.badevaerelse_motion
- binary_sensor.badevaerelse_bevaegelse
to: 'on'
conditions:
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: person.rook
state: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Bathroom
- alias: Soveværelse Gardiner Automatisering
id: 21deeaa0-0cb8-44eb-95e5-ebc3ab3223bd
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.bedroom_curtains_auto_open
for:
minutes: 2
actions:
- action: "{% set open = states('binary_sensor.bedroom_curtains_auto_open') %} {%\
\ if open == 'on' %}\n cover.open_cover\n{% elif open == 'off' %}\n cover.close_cover\n\
{% else %}\n cover.stop_cover {# if the state is unknown do a no-op #}\n{%\
\ endif %}"
target:
entity_id:
- cover.sovevaerelse_gardin
- id: bedroom_balcony_door_open_reminder
alias: bedroom_balcony_door_open_reminder
triggers:
- trigger: state
entity_id: sensor.bedroom_activity_state
to: 'off'
for:
minutes: 15
conditions:
- alias: Balcony door open
condition: state
entity_id: binary_sensor.sovevarelse_altandor
state: 'on'
- alias: Outside temp below 18
condition: numeric_state
entity_id: sensor.kontor_altan_temperatur
below: 18
actions:
- action: script.notify_everywhere
data:
message: Soveværelse altandør står åben!
- alias: bedroom_door_activity_on
id: 2506073c-4190-4ed1-bcd8-55c4a2c9fe5e
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.sovevarelse_dor
to: 'on'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.bedroom_door_activity
- alias: bedroom_door_activity_off
id: 53b497b2-5f12-44b9-bfae-13f17845296f
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.bedroom_door_activity
to: 'on'
for:
seconds: 5
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.bedroom_door_activity
- alias: activate_light_profile_bedroom
id: 5ea088bc-b2bb-41c3-b342-f8d1422a88a4
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.bedroom_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.bedroom_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.sovevaerelse_gulv
state: true
brightness: 255
hs_color:
- 29
- 15
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.seng_laeselampe:
state: true
brightness: 255
color_temp_kelvin: 2700
light.sovevaerelse_loft:
state: true
brightness: 255
color_temp_kelvin: 4000
effect: solid
light.seng_spots_over:
state: true
brightness: 255
effect: None
light.seng_spots_under:
state: true
brightness: 255
effect: None
light.sovevaerelse_reol_spots:
state: true
brightness: 255
effect: None
light.seng_hylder_op:
state: true
brightness: 255
hs_color:
- 29
- 15
effect: Solid
light.seng_hylder_ned:
state: true
brightness: 255
hs_color:
- 29
- 15
effect: Solid
light.blyant:
state: true
brightness: 255
hs_color:
- 29
- 15
effect: Solid
- action: light.turn_on
target:
entity_id: light.bedroom_tablet
data:
brightness: 255
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.sovevaerelse_gulv
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'') }}'
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.seng_laeselampe:
state: true
brightness: 200
color_temp_kelvin: 2700
light.seng_spots_over:
state: true
brightness: 200
effect: None
light.seng_spots_under:
state: true
brightness: 200
effect: None
light.sovevaerelse_reol_spots:
state: true
brightness: 200
effect: None
light.sovevaerelse_loft:
state: true
brightness: 200
color_temp_kelvin: 4000
effect: Solid
light.seng_hylder_op:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
effect: Solid
light.seng_hylder_ned:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.blyant:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
- action: light.turn_on
target:
entity_id: light.bedroom_tablet
data:
brightness: 172
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- parallel:
- action: script.difficult_light
data:
entity_id: light.sovevaerelse_gulv
state: true
brightness: 96
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'') }}'
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.seng_laeselampe:
state: true
brightness: 51
color_temp_kelvin: 2173
light.seng_spots_over:
state: true
brightness: 12
effect: None
light.seng_spots_under:
state: true
brightness: 24
effect: None
light.sovevaerelse_reol_spots:
state: true
brightness: 64
effect: None
light.sovevaerelse_loft:
state: true
brightness: 9
color_temp_kelvin: 3100
effect: Solid
light.seng_hylder_op:
state: true
brightness: 4
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
effect: Solid
light.seng_hylder_ned:
state: true
brightness: 4
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.blyant:
state: true
brightness: 64
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
- action: light.turn_on
target:
entity_id: light.bedroom_tablet
data:
brightness: 64
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- parallel:
- action: number.set_value
data:
entity_id: number.sovevaerelse_loft_speed
value: 1
- action: number.set_value
data:
entity_id: number.sovevaerelse_loft_intensity
value: 100
- action: select.select_option
data:
entity_id: select.sovevaerelse_loft_color_palette
option: '* Colors 1&2'
- action: script.difficult_light
data:
entity_id: light.sovevaerelse_gulv
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'') }}'
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.seng_spots_over:
state: false
light.seng_spots_under:
state: false
light.sovevaerelse_loft:
state: true
brightness: 6
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_12v'')
}}'
effect: Noise2D
light.sovevaerelse_reol_spots:
state: true
brightness: 32
effect: None
select.seng_hylder_preset:
state: Ambient
light.seng_hylder_op:
state: true
brightness: 2
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
effect: Solid Pattern
light.seng_hylder_ned:
state: true
brightness: 2
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid Pattern
light.seng_laeselampe:
state: true
brightness: 2
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.blyant:
state: true
brightness: 24
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
- action: light.turn_on
target:
entity_id: light.bedroom_tablet
data:
brightness: 32
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- parallel:
- action: number.set_value
data:
entity_id: number.sovevaerelse_loft_speed
value: 1
- action: number.set_value
data:
entity_id: number.sovevaerelse_loft_intensity
value: 100
- action: select.select_option
data:
entity_id: select.sovevaerelse_loft_color_palette
option: '* Colors 1&2'
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.sovevaerelse_gulv:
state: false
light.seng_spots_over:
state: false
light.seng_spots_under:
state: false
light.sovevaerelse_reol_spots:
state: true
brightness: 8
effect: None
light.seng_laeselampe:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.blyant:
state: true
brightness: 24
rgb_color:
- 255
- 0
- 0
effect: Solid
select.seng_hylder_preset:
state: Night
light.seng_hylder_op:
state: false
light.seng_hylder_ned:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
effect: Solid Pattern
select.sovevaerelse_loft_preset:
state: Night
light.sovevaerelse_loft:
state: true
brightness: 5
rgb_color:
- 255
- 0
- 0
effect: Noise2D
- action: light.turn_on
target:
entity_id: light.bedroom_tablet
data:
brightness: 1
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: light.turn_off
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entity_id: light.sovevaerelse_lys
- choose:
- conditions:
- condition: state
entity_id: sensor.bedroom_activity_state
state: 'on'
sequence:
- action: light.turn_on
target:
entity_id: light.bedroom_tablet
data:
brightness: 1
- action: light.turn_on
target:
entity_id: light.bedroom_tablet_screensaver
default:
- action: light.turn_off
target:
entity_id: light.bedroom_tablet
- alias: Soveværelse TV on
id: 46491d6e-f434-4ae3-ba8d-c185127880ac
initial_state: true
triggers:
- trigger: state
entity_id: media_player.sovevaerelse_chromecast
not_to:
- 'off'
- unavailable
- unknown
actions:
- action: switch.turn_on
data:
entity_id: switch.sovevaerelse_tv
- alias: Soveværelse TV off
id: afbd2abd-bdb6-4df0-9b29-4317aad76b39
initial_state: true
triggers:
- trigger: state
entity_id: media_player.sovevaerelse_chromecast
to:
- 'off'
- idle
for:
minutes: 2
actions:
- action: switch.turn_off
data:
entity_id: switch.sovevaerelse_tv
- alias: bedroom_media_mute
id: e809091c-9c44-4a35-b9fa-c169204c6369
initial_state: true
triggers:
- trigger: state
entity_id: sensor.bedroom_room_state
to: 'off'
conditions:
- condition: state
entity_id: binary_sensor.sovevaerelse_video_out
state: 'on'
actions:
- action: media_player.volume_mute
data:
entity_id: media_player.sovevaerelse_soundbar_songpal
is_volume_muted: true
- alias: bedroom_media_unmute
id: c1c6e2bc-d829-4b64-8496-6acc69cbaedf
initial_state: true
triggers:
- trigger: state
entity_id: sensor.bedroom_room_state
to: active
conditions:
- condition: state
entity_id: binary_sensor.sovevaerelse_video_out
state: 'on'
actions:
- action: media_player.volume_mute
data:
entity_id: media_player.sovevaerelse_soundbar_songpal
is_volume_muted: false
- alias: sovevaerelse_soundbar_volume_remote_up
id: 641d990f-ecf5-4f08-a223-4bd0f604e190
initial_state: true
triggers:
- trigger: state
entity_id: input_select.sovevaerelse_soundbar_volume_remote_state
to: up
for:
milliseconds: 75
mode: single
actions:
- repeat:
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.sovevaerelse
state: playing
sequence:
- action: media_player.volume_up
data:
entity_id: media_player.sovevaerelse
default:
- action: media_player.volume_up
data:
entity_id: media_player.sovevaerelse_soundbar_songpal
- delay:
milliseconds: 75
until:
- condition: or
conditions:
- condition: state
entity_id: input_select.sovevaerelse_soundbar_volume_remote_state
state: 'off'
- condition: state
entity_id: input_select.sovevaerelse_soundbar_volume_remote_state
state: down
- alias: sovevaerelse_soundbar_volume_remote_down
id: 522eda0a-ea1a-4868-8066-ace9a757d203
initial_state: true
triggers:
- trigger: state
entity_id: input_select.sovevaerelse_soundbar_volume_remote_state
to: down
for:
milliseconds: 75
mode: single
actions:
- repeat:
sequence:
- choose:
- conditions:
- condition: state
entity_id: media_player.sovevaerelse
state: playing
sequence:
- action: media_player.volume_down
data:
entity_id: media_player.sovevaerelse
default:
- action: media_player.volume_down
data:
entity_id: media_player.sovevaerelse_soundbar_songpal
- delay:
milliseconds: 75
until:
- condition: or
conditions:
- condition: state
entity_id: input_select.sovevaerelse_soundbar_volume_remote_state
state: 'off'
- condition: state
entity_id: input_select.sovevaerelse_soundbar_volume_remote_state
state: up
- alias: Set Bedroom Latest Motion
id: bf4a1137-12a0-4e56-8029-2355e1f64c84
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.sovevaerelse_motion
- binary_sensor.sovevarelse_gulv
- binary_sensor.bedroom_door_activity
to: 'on'
conditions:
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: person.rook
state: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Bedroom
- id: car_delayed_charging_on
alias: Car Delayed Charging On
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.car_delayed_charging
from: 'off'
to: 'on'
- trigger: state
entity_id: input_datetime.car_start_charging_at
conditions:
- condition: state
entity_id: input_boolean.car_delayed_charging
state: 'on'
actions:
- parallel:
- action: switch.turn_off
target:
entity_id: switch.id_3_pro_start_stop_charging
- action: script.notify_darkphone
data:
message: Opladning er bliver stoppet. Den starter igen kl. {{ (states('input_datetime.car_start_charging_at')
or '').split(':')[0:-1] | join(':') }}.
- id: car_start_delayed_charging
alias: Car Delayed Charging
initial_state: true
triggers:
- trigger: time
at: input_datetime.car_start_charging_at
conditions:
- condition: state
entity_id: input_boolean.car_delayed_charging
state: 'on'
actions:
- parallel:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.car_delayed_charging
- action: switch.turn_on
target:
entity_id: switch.id_3_pro_start_stop_charging
- action: script.notify_darkphone
data:
message: Forsinket opladningstidspunkt er nået. Genstarter opladning.
- id: set_car_charging_started_time
alias: Set Car Charging Started Time
triggers:
- trigger: state
entity_id: sensor.id_3_pro_charging_connector_state
from: 'off'
to: 'on'
actions:
- alias: Set Car Charging Started to now
action: input_text.set_value
target:
entity_id: input_text.car_charging_started
data:
value: '{{ now().timestamp()|int }}'
- id: set_car_charging_type
alias: Set Car Charging Type
triggers:
- trigger: state
entity_id: sensor.id_3_pro_charging_type
from: invalid
to:
- ac
- dc
actions:
- alias: Set latest charge type
action: input_text.set_value
target:
entity_id: input_text.car_charging_type
data:
value: '{{ trigger.to_state.state }}'
- id: clear_car_charging_started_time
alias: Clear Car Charging Started Time
triggers:
- trigger: state
entity_id: sensor.id_3_pro_charging_connector_state
to: 'off'
actions:
- alias: Clear charge type
action: input_text.set_value
target:
entity_id: input_text.car_charging_type
data:
value: ''
- alias: Clear Car Charging Started to now
action: input_text.set_value
target:
entity_id: input_text.car_charging_started
data:
value: ''
- alias: notify_car_charging
id: notify_car_charging
initial_state: true
triggers:
- trigger: state
entity_id: sensor.id_3_pro_remaining_charging_time
not_from: unavailable
conditions:
- alias: Estimated charging time remaining changed by more than 5 minutes
condition: template
value_template: '{%- set from_time = trigger.from_state.state|int(0) -%} {%- set
to_time = trigger.to_state.state|int(0) -%} {{ (from_time - to_time > 5 or to_time
- from_time > 5) }}'
actions:
- delay: 00:00:05
- action: script.notify_darkphone
data:
message: 'Bilen lader op fra {{ states(''sensor.id_3_pro_soc_primary'')|int
}}% til {{ states(''number.id_3_pro_charging_target_level'')|int }}%.
Færdig ca. kl. {{ states(''sensor.id_3_pro_charging_estimated_date_reached'')|as_timestamp|timestamp_custom(''%H:%M'',
True) }}.
'
- alias: notify_15_minutes_till_car_charged
id: notify_15_minutes_till_car_charged
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.id_3_pro_remaining_charging_time
below: 16
conditions:
- condition: state
entity_id: sensor.id_3_pro_charging_state
state: charging
actions:
- action: script.notify_darkphone
data:
message: Bilen er ladt op til {{ states('sensor.id_3_pro_soc_primary')|int }}
af {{ states('number.id_3_pro_charging_target_level')|int }}%. Færdig om {{
states('sensor.id_3_pro_remaining_charging_time') }} minutter.
- alias: notify_car_charged
id: notify_car_charged
initial_state: true
triggers:
- trigger: state
entity_id: sensor.id_3_pro_charging_state
from: charging
conditions:
- condition: not
conditions:
- condition: state
entity_id: sensor.id_3_pro_charging_state
state: unavailable
actions:
- action: script.notify_darkphone
data:
message: Oplading afsluttet. Bilen er ladt op til {{ states('sensor.id_3_pro_soc_primary')|int
}}%.
- id: climatise_car_for_upcoming_drive
alias: climatise_car_for_upcoming_drive
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.upcoming_drive
to: 'on'
actions:
- alias: Climatise car
action: switch.turn_on
target:
entity_id: switch.id_3_pro_climatisation
- id: car_keep_climatising
alias: Car Keep Climatising
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.car_keep_climatising
from: 'off'
to: 'on'
- trigger: state
entity_id: binary_sensor.id_3_pro_klimatisering
from: 'off'
to: 'on'
for:
minutes: 5
conditions:
- condition: state
entity_id: input_boolean.car_keep_climatising
state: 'on'
actions:
- alias: Climatise car
action: switch.turn_on
target:
entity_id: switch.id_3_pro_climatisation
- id: car_keep_klimatising_off
alias: Car Keep Climatising Off
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.car_keep_climatising
from: 'on'
to: 'off'
actions:
- alias: Stop climatising car
action: switch.turn_off
target:
entity_id: switch.id_3_pro_climatisation
- alias: notify_car_climatising
id: notify_car_climatising
triggers:
- trigger: state
entity_id: binary_sensor.id_3_pro_klimatisering
to: 'on'
conditions:
- condition: numeric_state
entity_id: sensor.id_3_pro_remaining_climatisation_time
above: 6
actions:
- action: script.notify_darkphone
data:
message: 'Klimatiserer bilen til {{ state_attr(''climate.id_3_pro_start_stop_climatization'',
''temperature'')|int }}°.
{{ states(''sensor.id_3_pro_remaining_climatisation_time'') }} minutter tilbage.
'
data:
inline_keyboard:
- Stop klimatisering:/car_climatisation_off
- action: automation.turn_on
target:
entity_id: automation.notify_car_climatisation_end
- alias: notify_car_climatisation_end
id: notify_car_climatisation_end
initial_state: false
triggers:
- trigger: state
entity_id: binary_sensor.id_3_pro_klimatisering
to: 'off'
actions:
- action: script.notify_darkphone
data:
message: Klimatisering afsluttet.
- action: automation.turn_off
target:
entity_id: automation.notify_car_climatisation_end
- alias: Send upcoming travel location to car
id: 295f96ad-137a-4096-9bed-f2c2762fbc8c
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 30
conditions:
- condition: state
entity_id: sensor.upcoming_travel_location
attribute: mode
state: driving
- condition: state
entity_id: binary_sensor.car_at_destination
state: 'off'
actions:
- action: script.send_entity_destination_to_car
data:
entity_id: sensor.upcoming_travel_location
- alias: Send home destination to car
id: 5f90a704-bfc1-4f60-a525-6af990b697ed
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.upcoming_drive
to: 'on'
conditions:
- condition: numeric_state
entity_id: sensor.next_scheduled_leave_in
above: 60
- condition: not
conditions:
- condition: state
entity_id: device_tracker.id_3_pro_position
state: home
actions:
- action: script.send_home_destination
data:
entity_id: zone.home
- template:
- sensor:
- name: Car Distance to Rook
unique_id: c09db247-de53-4550-b417-442d7996e1f2
state: "{% if states('sensor.id_3_pro_vehicle_state') in ['ignition_on', 'driving']\
\ %}\n 0.0\n{%- else -%}\n {{ distance('device_tracker.id_3_pro_position',\
\ 'person.rook') }}\n{%- endif -%}"
device_class: distance
unit_of_measurement: km
- binary_sensor:
- name: Car at destination
unique_id: 02d2ad65-faa4-40a9-9db6-14923247252c
state: '{% set d = states(''sensor.rook_destination_distance'') %} {{ d is number
and d | float(1000) < 1 }}'
- name: Leave for drive within 5 min
unique_id: 022c6936-34f9-48ba-ac32-38ad68edd3b1
state: "{% set leave_sensor = 'sensor.next_scheduled_leave_at' %} {% set leave\
\ = as_local(states(leave_sensor) | as_datetime(none))\n if\
\ has_value(leave_sensor) else none %}\n{% if leave %}\n {% set mins = (leave\
\ - now()).total_seconds() / 60 %}\n {{ mins <= 5 and not is_state('binary_sensor.car_at_destination',\
\ 'on') }}\n{% else %}\n false\n{% endif %}"
- name: Driving event ends in 5 min
unique_id: d81b7af7-2992-4434-95b1-06cd89f9d7a5
state: "{% set events = state_attr('sensor.current_event', 'events') %} {% set\
\ driving = events | selectattr('bil', 'eq', true) | list if events else []\
\ %} {% if driving | length > 0 %}\n {% set e = driving[-1] %}\n {% if e.end\
\ %}\n {% set end = as_local(e.end | as_datetime(none)) %}\n {% set\
\ mins = (end - now()).total_seconds() / 60 %}\n {{ mins <= 5 }}\n {%\
\ else %}\n false\n {% endif %}\n{% else %}\n false\n{% endif %}"
- name: Upcoming drive
unique_id: 2f27b7a3-22d3-44e7-871f-bac1b42b3568
state: "{{\n is_state('binary_sensor.leave_for_drive_within_5_min', 'on')\n\
\ or is_state('binary_sensor.driving_event_ends_in_5_min', 'on')\n}}"
- id: car_menu
initial_state: true
alias: Bil Menu
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /bil
- trigger: event
event_type: telegram_command
event_data:
command: /bil
actions:
- action: notify.telegram_darkfox
data:
message: "{% if is_state('sensor.id_3_pro_charging_state', 'charging') -%}\n\
\ Opladning startet. Bilen lader op til {{ states('number.id_3_pro_charging_target_level')|int\
\ }}%.\n Færdig ca. {{ states('sensor.id_3_pro_charging_estimated_date_reached')\
\ }}\n{%- else -%}\n Oplading afsluttet. Bilen er ladt op til {{ states('sensor.id_3_pro_soc_primary')|int\
\ }}%.\n{%- endif %} {%- if states('sensor.id_3_pro_remaining_climatisation_time')|int\
\ > 0 -%}\n Klimatiserer bilen til {{ state_attr('climate.id_3_pro_start_stop_climatization',\
\ 'temperature')|int }}°. {{ states('sensor.id_3_pro_remaining_climatisation_time')\
\ }} minutter tilbage.\n{%- else -%}\n Klimatisering afsluttet.\n{%- endif\
\ -%}\n"
- action: notify.telegram_darkfox
data:
message: 'Menu:'
data:
inline_keyboard:
- Klimatisering:/car_climatisation, Opladning:/car_charging
- id: car_climatisation_menu
initial_state: true
alias: Bil Klimatisering Menu
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /car_climatisation
- trigger: event
event_type: telegram_command
event_data:
command: /car_climatisation
variables:
temp: '{{ state_attr(''climate.id_3_pro_start_stop_climatization'', ''temperature'')|int
}}'
actions:
- action: notify.telegram_darkfox
data:
message: Klimatisering Menu
data:
inline_keyboard:
- '{{ ''Stop klimatisering:/car_climatisation_off'' if states(''sensor.id_3_pro_remaining_climatisation_time'')|int
> 0 else ''Klimatiser nu:/car_climatisation_on'' }}'
- '{{ ''[18°]'' if temp == 18 else ''18°'' }}:/car_climatisation_set 18, {{
''[19°]'' if temp == 19 else ''19°'' }}:/car_climatisation_set 19, {{ ''[20°]''
if temp == 20 else ''20°'' }}:/car_climatisation_set 20'
- '{{ ''[21°]'' if temp == 21 else ''21°'' }}:/car_climatisation_set 21, {{
''[22°]'' if temp == 22 else ''22°'' }}:/car_climatisation_set 22, {{ ''[23°]''
if temp == 23 else ''23°'' }}:/car_climatisation_set 23'
- id: car_climatisation_set
initial_state: true
alias: Bil Klimatisering Sæt temperatur
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /car_climatisation_set
- trigger: event
event_type: telegram_command
event_data:
command: /car_climatisation_set
actions:
- action: climate.set_temperature
target:
entity_id: climate.id_3_pro_start_stop_climatization
data:
temperature: '{{ trigger.event.data[''args''][0] }}'
- action: switch.turn_on
target:
entity_id: switch.id_3_pro_climatisation
- action: notify.telegram_darkfox
data:
message: Temperatur sat til {{ trigger.event.data['args'][0] }}°.
- id: car_climatisation_on
initial_state: true
alias: Bil Klimatisering Tænd
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /car_climatisation_on
- trigger: event
event_type: telegram_command
event_data:
command: /car_climatisation_on
actions:
- action: switch.turn_on
target:
entity_id: switch.id_3_pro_climatisation
- id: car_climatisation_off
initial_state: true
alias: Bil Klimatisering Stop
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /car_climatisation_off
- trigger: event
event_type: telegram_command
event_data:
command: /car_climatisation_off
actions:
- action: switch.turn_off
target:
entity_id: switch.id_3_pro_climatisation
- id: car_charging_menu
initial_state: true
alias: Bil Opladning Menu
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /car_charging
- trigger: event
event_type: telegram_command
event_data:
command: /car_charging
actions:
- action: notify.telegram_darkfox
data:
message: Opladning Menu
data:
inline_keyboard:
- '{{ ''Stop opladning:/car_charging_off'' if is_state(''sensor.id_3_pro_charging_state'',
''charging'') else ''Start opladning:/car_charging_on'' }}'
- 50%:/car_charging_set 50, 60%:/car_charging_set 60, 70%:/car_charging_set
70, 80%:/car_charging_set 80, 90%:/car_charging_set 90, 100%:/car_charging_set
100
- initial_state: true
alias: Send destination til bil
id: 80abd8c2-ff5b-490e-9abd-411f10c0ad12
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /destination
- trigger: event
event_type: telegram_command
event_data:
command: /destination
variables:
dest_parts: '{{ (trigger.event.data[''args''] | join('' '')).split('' - '') }}'
name: '{{ dest_parts[0] if dest_parts|length > 1 else None }}'
destination: '{{ dest_parts[1] if dest_parts|length > 1 else dest_parts[0] }}'
actions:
- action: script.send_destination_to_car
data:
name: '{{ name }}'
destination: '{{ destination }}'
- alias: Check Climate
id: 5636f5f3-be1b-494b-95cd-be9ff7f4ba04
initial_state: true
mode: single
triggers:
- trigger: event
event_type: check_climate
actions:
- delay:
seconds: 30
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.check_climate
state: 'off'
sequence:
- action: automation.trigger
entity_id: automation.restart_tado
- alias: Termostat Badeværelse
id: 46bcccf0-05d3-4652-8d1c-d1cd2b747a56
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id:
- sensor.bathroom_min_temp
- trigger: event
event_type: set_climate
actions:
- action: climate.turn_on
data:
entity_id: climate.badevaerelse
- delay:
seconds: 1
- condition: '{{ is_state(''climate.badevaerelse'', ''heat'') }}'
- action: climate.set_temperature
data:
entity_id: climate.badevaerelse
temperature: '{{ states(''sensor.bathroom_min_temp'') }}'
- event: check_climate
- alias: Termostat Kontor
id: 83706625-cc7e-490a-affb-ee3fd42c2772
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: sensor.office_min_temp
- trigger: state
entity_id: binary_sensor.kontor_altandor
- trigger: event
event_type: set_climate
actions:
- action: "{%- if is_state('binary_sensor.kontor_altandor', 'off') -%}\n climate.turn_on\n\
{%- else -%}\n climate.turn_off\n{%- endif -%}\n"
data:
entity_id: climate.kontor
- delay:
seconds: 1
- condition: '{{ is_state(''climate.kontor'', ''heat'') }}'
- action: climate.set_temperature
data:
entity_id: climate.kontor
temperature: '{{ states(''sensor.office_min_temp'') }}'
- event: check_climate
- alias: Termostat Stue
id: af2fd7a5-316f-4296-853d-a3d1a99efe79
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: sensor.living_room_min_temp
- trigger: state
entity_id: binary_sensor.stue_altandor
- trigger: event
event_type: set_climate
actions:
- action: "{%- if is_state('binary_sensor.stue_altandor', 'off') -%}\n climate.turn_on\n\
{%- else -%}\n climate.turn_off\n{%- endif -%}\n"
data:
entity_id: climate.stue
- delay:
seconds: 1
- condition: '{{ is_state(''climate.stue'', ''heat'') }}'
- action: climate.set_temperature
data:
entity_id: climate.stue
temperature: '{{ states(''sensor.living_room_min_temp'') }}'
- event: check_climate
- alias: Termostat Værksted
id: 81f550e6-d1a0-451a-9ed7-40df34e1f8d6
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: sensor.workshop_min_temp
- trigger: state
entity_id: binary_sensor.varksted_vindue
- trigger: event
event_type: set_climate
actions:
- action: "{%- if is_state('binary_sensor.stue_altandor', 'off') -%}\n climate.turn_on\n\
{%- else -%}\n climate.turn_off\n{%- endif -%}\n"
data:
entity_id: climate.vaerksted
- delay:
seconds: 1
- condition: '{{ is_state(''climate.vaerksted'', ''heat'') }}'
- action: climate.set_temperature
data:
entity_id: climate.vaerksted
temperature: '{{ states(''sensor.workshop_min_temp'') }}'
- event: check_climate
- alias: Termostat Soveværelse
id: 1a0bc86a-84e4-43aa-8872-0666bb0f01bd
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: sensor.bedroom_min_temp
- trigger: state
entity_id: binary_sensor.sovevarelse_altandor
- trigger: event
event_type: set_climate
actions:
- action: "{%- if is_state('binary_sensor.sovevarelse_altandor', 'off') -%}\n climate.turn_on\n\
{%- else -%}\n climate.turn_off\n{%- endif -%}\n"
data:
entity_id: climate.sovevaerelse
- delay:
seconds: 1
- condition: '{{ is_state(''climate.sovevaerelse'', ''heat'') }}'
- action: climate.set_temperature
data:
entity_id: climate.sovevaerelse
temperature: '{{ states(''sensor.bedroom_min_temp'') }}'
- event: check_climate
- alias: Switchbot Curtain Battery Charged
id: 37f532fe-45ec-4c48-a2be-9b8f8de1ab17
initial_state: true
triggers:
- trigger: numeric_state
entity_id:
- sensor.stue_gardin_hojre_battery
- sensor.stue_gardin_venstre_battery
- sensor.sovevaerelse_gardin_vindue_battery
- sensor.sovevaerelse_gardin_dor_battery
above: 99
actions:
- action: script.notify_everywhere
data:
message: '{{ trigger.to_state.name }} er opladet'
- alias: Fold ind automatisk
id: c39877f9-c5dc-41e9-9bbe-fd4fbe973f7a
initial_state: true
mode: parallel
triggers:
- trigger: state
entity_id:
- input_boolean.fold_ud_altan_lys_panel
- input_boolean.fold_ud_badevaerelse_lys_panel
- input_boolean.fold_ud_sovevaerelse_lys_panel
- input_boolean.fold_ud_gang_lys_panel
- input_boolean.fold_ud_kokken_lys_panel
- input_boolean.fold_ud_stue_lys_panel
- input_boolean.fold_ud_kontor_lys_panel
- input_boolean.fold_ud_vaerksted_lys_panel
for:
minutes: 1
actions:
- action: input_boolean.turn_off
target:
entity_id: '{{ trigger.entity_id }}'
- alias: Away
id: 8eb5e623-aa20-4c04-b260-d9eb2251583e
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.rook_presence_delayed
to: 'off'
conditions:
- alias: Not in guest mode
condition: state
entity_id: input_boolean.guests
state: 'off'
actions:
- action: homeassistant.turn_off
target:
entity_id: group.all_media
- alias: Dishwasher leak warning
id: dishwasher_leak_warning
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.opvaskemaskine_lak
to: 'on'
actions:
- action: script.notify_everywhere
data:
message: Vand under opvaskemaskinen!
- alias: Dishwasher running claim chore
id: 5a97b74e-24c9-4926-a442-2d2877cd6810
initial_state: true
triggers:
trigger: state
entity_id:
- sensor.opvaskemaskine_operationstate
to: BSH.Common.EnumType.OperationState.Run
actions:
- action: kidschores.claim_chore
data:
kid_name: Rook
chore_name: Opvask
- alias: Dishwasher done set chore due date
id: 98c85620-147c-44c4-a250-302572907883
initial_state: true
triggers:
trigger: state
entity_id: sensor.opvaskemaskine_operationstate
to: BSH.Common.EnumType.OperationState.End
actions:
- action: kidschores.set_chore_due_date
data:
chore_name: Tøm opvaskemaskine
due_date: '{{ (now() + timedelta(seconds=2)).strftime(''%Y-%m-%dT%H:%M:%S'')
}}'
- alias: Door Phone Ringing
id: bad7cf41-46f2-408a-9844-aa94685c8310
initial_state: true
triggers:
- trigger: state
entity_id: event.dortelefon_ding
actions:
- parallel:
- action: script.notify_everywhere
data:
message: Dørtelefonen Ringer!
data:
inline_keyboard: Svar Dør:/unlock_front_door
- alias: Telegram Unlock Front Door
id: f592b73c-e539-45e0-86ce-5196cd010957
initial_state: true
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /unlock_front_door
- trigger: event
event_type: telegram_command
event_data:
command: /unlock_front_door
actions:
- parallel:
- action: notify.telegram_darkfox
data:
message: Døråbner Aktiveret!
- action: button.press
target:
entity_id: button.dortelefon_open_door
- alias: Guests Event
id: d1738a9b-6825-4159-8dcc-dabb41464335
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.guests_event
to:
- 'on'
- 'off'
actions:
- action: input_boolean.turn_{{ trigger.to_state.state }}
target:
entity_id: input_boolean.guests
- alias: Guests Mode On
id: 934d6298-ba45-4126-bd6c-65f85c928192
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.guests
to: 'on'
actions:
- parallel:
- action: homeassistant.turn_on
target:
entity_id:
- input_boolean.bathroom_separate_light_profile
- input_boolean.bathroom_activity_override
- input_boolean.bedroom_separate_light_profile
- input_boolean.office_separate_light_profile
- input_boolean.workshop_separate_light_profile
- action: homeassistant.turn_off
target:
entity_id:
- switch.living_room_curtain_automations
- alias: Guests Mode Off
id: 31e7c655-2b98-440d-9f0e-22121ebf901f
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.guests
to: 'off'
actions:
- parallel:
- action: homeassistant.turn_off
target:
entity_id:
- input_boolean.bathroom_separate_light_profile
- input_boolean.bathroom_activity_override
- input_boolean.bedroom_separate_light_profile
- input_boolean.office_separate_light_profile
- input_boolean.workshop_separate_light_profile
- action: homeassistant.turn_on
target:
entity_id:
- switch.living_room_curtain_automations
- id: doorbell_notification
alias: Doorbell Notification
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.dorklokke_knap
from: 'off'
to: 'on'
actions:
- action: notify.telegram_darkfox
data:
message: Ding dong!
- action: script.popup_notification
data:
message: Ding dong!
- alias: activate_light_profile_hallway
id: b586de7c-ccd2-4714-86a6-ae75a946f913
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.hallway_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.hallway_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.gang_loftlampe:
state: true
brightness: 255
color_temp_kelvin: 3906
light.gang_spots:
state: true
brightness: 255
color_temp_kelvin: 3906
light.skoskab:
state: true
brightness: 255
color_temp_kelvin: 3906
effect: Solid
light.gang_kommode:
state: true
brightness: 255
color_temp_kelvin: 3906
effect: None
light.gang_skab:
state: true
brightness: 255
color_temp_kelvin: 3906
effect: Solid
light.hallway_tablet:
state: true
brightness: 255
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.gang_loftlampe:
state: true
brightness: 255
color_temp_kelvin: 3030
light.gang_spots:
state: true
brightness: 255
color_temp_kelvin: 3030
light.skoskab:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.gang_kommode:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: None
light.gang_skab:
state: true
brightness: 172
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.hallway_tablet:
state: true
brightness: 172
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.gang_loftlampe:
state: true
brightness: 127
color_temp_kelvin: 3030
light.gang_spots:
state: true
brightness: 127
color_temp_kelvin: 3030
light.skoskab:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.gang_kommode:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: None
light.gang_skab:
state: true
brightness: 72
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.hallway_tablet:
state: true
brightness: 127
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.gang_loftlampe:
state: true
brightness: 46
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.gang_spots:
state: true
brightness: 46
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.skoskab:
state: true
brightness: 42
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.gang_kommode:
state: true
brightness: 72
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: None
light.gang_skab:
state: true
brightness: 8
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.hallway_tablet:
state: true
brightness: 72
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.gang_loftlampe:
state: false
light.gang_spots:
state: false
light.skoskab:
state: true
brightness: 48
rgb_color:
- 255
- 0
- 0
effect: Solid
light.gang_kommode:
state: true
brightness: 48
rgb_color:
- 255
- 0
- 0
effect: None
light.gang_skab:
state: true
brightness: 4
rgb_color:
- 255
- 0
- 0
effect: Solid
light.hallway_tablet:
state: true
brightness: 1
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.gang_spots:
state: false
light.gang_loftlampe:
state: false
light.skoskab:
state: false
light.gang_kommode:
state: false
light.gang_skab:
state: false
light.hallway_tablet:
state: false
- alias: activate_light_profile_hallway_candle_lights
id: activate_light_profile_hallway_candle_lights
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.hallway_active_light_profile
- trigger: state
entity_id: binary_sensor.badevarelse_las
- trigger: event
event_type: refresh_light_profile
actions:
- action: script.turn_on
target:
entity_id: "{% if is_state('input_boolean.guests', 'on') and (states('sensor.hallway_selected_light_profile')|lower)\
\ not in ['night', 'off'] %}\n script.hallway_candle_lights_{{ 'occupied'\
\ if is_state('binary_sensor.badevarelse_las', 'off') else 'free' }}\n{% else\
\ %}\n script.hallway_candle_lights_{{ (states('sensor.hallway_active_light_profile')|lower)\
\ }}\n{% endif %}"
- id: refresh_hass_agent_on_startup
alias: Refresh HASS.agent on startup
triggers:
trigger: homeassistant
event: start
actions:
- alias: Refresh HASS.agent Satellite
action: switch.turn_on
target:
entity_id: switch.rook_pc_satellite_publishallsensors
- alias: Refresh HASS.agent
action: button.press
target:
entity_id: button.rook_pc_publishallsensors
- alias: Claim weight chore on weight update
id: ca020a4b-bbe0-4e8f-869e-ba2dfacd67d5
initial_state: true
triggers:
- trigger: state
entity_id: sensor.withings_weight
actions:
- action: kidschores.claim_chore
data:
kid_name: Rook
chore_name: Vægt
- alias: Claim blood pressure chore on BP update
id: ab734918-2f34-4e43-b48c-55e383d58855
initial_state: true
triggers:
- trigger: state
entity_id: sensor.darkphone_systolic_blood_pressure
actions:
- action: kidschores.claim_chore
data:
kid_name: Rook
chore_name: Blodtryk
- alias: Set home_assistant_started on startup
id: e8b7e0a1-0e3e-45bd-9e48-53cb88d67650
initial_state: true
triggers:
trigger: homeassistant
event: start
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.home_assistant_started
- alias: Auto approve all chores for Rook
id: bf25eccf-deca-4c0c-8931-6fe727034ab5
description: Automatically presses the correct approval button for claimed chores.
initial_state: true
mode: queued
trigger:
- trigger: state
entity_id: sensor.rook_chores_claimed
attribute: chores
condition:
- condition: numeric_state
entity_id: sensor.rook_chores_claimed
above: 0
variables:
approval_buttons: "{{ \n state_attr('sensor.rook_chores_claimed', 'chores')\n\
\ | map('regex_replace',\n '^sensor\\\\.kc_([a-zA-Z0-9_]+)_chore_status_',\n\
\ 'button.kc_\\\\1_chore_approval_')\n | list\n}}"
action:
- repeat:
for_each: '{{ approval_buttons }}'
sequence:
- action: button.press
target:
entity_id: '{{ repeat.item }}'
- alias: Update KidsChore UI Helpers
id: 888e8507-69cb-4726-9d2f-d9ef18d943c0
triggers:
- trigger: homeassistant
event: start
- trigger: time_pattern
minutes: /5
action:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.kc_ui_set_date_helper
data:
datetime: '{{ (now().replace(hour=23, minute=0, second=0, microsecond=0) + timedelta(days=1)).isoformat()
}}'
- alias: Notify Rook about overdue chores
id: 663a693f-d58b-4f0c-9340-6c8961e0c76f
description: Notify Rook about chores that are overdue and have the Notify label
initial_state: true
mode: restart
trigger:
- trigger: state
entity_id: sensor.rook_chores_overdue_notify
attribute: chores
for:
seconds: 5
condition:
- condition: numeric_state
entity_id: sensor.rook_chores_overdue_notify
above: 0
variables:
chore_sensors: '{{ state_attr(''sensor.rook_chores_overdue_notify'', ''chores'')
}}'
actions:
- condition: template
value_template: '{{ chore_sensors | length > 0 }}'
- action: notify.mobile_app_darkphone
data:
title: Opgaver forfaldne
message: "Følgende opgaver er forfaldne: {% for entity_id in chore_sensors %}\n\
\ {% set sensor = states[entity_id] %}\n - {{ sensor.attributes.chore_name\
\ }}\n{% endfor %}"
data:
tag: kc_rook_overdue_chores_notification
channel: Overdue Chores
importance: high
ttl: 0
priority: high
clickAction: "{% set ns = namespace(has_health_chores=false) %} {% for entity_id\
\ in chore_sensors %}\n {% set sensor = states[entity_id] -%}\n {% if\
\ 'Helbred' in sensor.attributes.labels %}\n {% set ns.has_health_chores\
\ = true %}\n {% endif %}\n{% endfor %} {% if ns.has_health_chores %}\n\
\ /dashboard-health/symptomer\n{% else %}\n /dashboard-pligter/Rook\n\
{% endif %}"
- alias: Notify Rook about critical overdue chores
id: 601e476d-eabd-4300-960d-80fd307f1c86
description: Notify Rook about critical chores that are overdue every 5 minutes
initial_state: true
mode: restart
trigger:
- trigger: state
entity_id: sensor.rook_chores_overdue_critical_notify
attribute: chores
for:
seconds: 5
- trigger: time_pattern
minutes: /6
condition:
- condition: numeric_state
entity_id: sensor.rook_chores_overdue_critical_notify
above: 0
variables:
chore_sensors: '{{ state_attr(''sensor.rook_chores_overdue_critical_notify'',
''chores'') }}'
uri: "{% set ns = namespace(has_health_chores=false) %} {% for entity_id in chore_sensors\
\ %}\n {% set sensor = states[entity_id] %}\n {% if 'Helbred' in sensor.attributes.labels\
\ %}\n {% set ns.has_health_chores = true %}\n {% endif %}\n{% endfor %}\
\ {% if ns.has_health_chores %}\n /dashboard-health/symptomer\n{% else %}\n\
\ /dashboard-pligter/Rook\n{% endif %}"
actions:
- variables:
action_open: '{{ ''CRITICAL_CHORE_NOTIFICATION_OPEN.'' ~ context.id }}'
action_skip: '{{ ''CRITICAL_CHORE_NOTIFICATION_SKIP.'' ~ context.id }}'
action_snooze: '{{ ''CRITICAL_CHORE_NOTIFICATION_SNOOZE.'' ~ context.id }}'
- condition: template
value_template: '{{ chore_sensors | length > 0 }}'
- action: notify.mobile_app_darkphone
data:
title: Opgaver forfaldne
message: "Følgende kritiske opgaver er forfaldne: {% for entity_id in chore_sensors\
\ %}\n {% set sensor = states[entity_id] -%}\n - {{ sensor.attributes.chore_name\
\ }}\n{% endfor %}"
data:
tag: kc_rook_critical_overdue_chores_notification
channel: Critical Overdue Chores
importance: high
ttl: 0
priority: high
actions:
- action: '{{ action_open }}'
title: Åbn
uri: '{{ uri }}'
- action: '{{ action_skip }}'
title: Spring over
- action: '{{ action_snooze }}'
title: +30 min
clickAction: '{{ uri }}'
- alias: Wait for a response
wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_skip }}'
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_snooze }}'
- alias: Perform the action
choose:
- conditions: '{{ wait.trigger.event.data.action == action_skip }}'
sequence:
- repeat:
for_each: '{{ chore_sensors }}'
sequence:
- action: kidschores.skip_chore_due_date
data:
chore_name: '{{ states[repeat.item].attributes.chore_name }}'
- conditions: '{{ wait.trigger.event.data.action == action_snooze }}'
sequence:
- variables:
new_due_date: '{{ (now() + timedelta(minutes=30)).strftime(''%Y-%m-%dT%H:%M:%S'')
}}'
- repeat:
for_each: '{{ chore_sensors }}'
sequence:
- action: kidschores.set_chore_due_date
data:
chore_name: '{{ states[repeat.item].attributes.chore_name }}'
due_date: '{{ new_due_date }}'
- alias: activate_light_profile_kitchen
id: df388f52-33fe-4ab4-82ae-4690df1d906c
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.kitchen_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.kitchen_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kokken_loftlampe:
state: true
brightness: 255
color_temp_kelvin: 4000
light.emhatte:
state: true
brightness: 255
color_temp_kelvin: 3500
light.kokkenbord:
state: true
brightness: 255
color_temp_kelvin: 4000
light.kokken_spots:
state: true
brightness: 255
color_temp_kelvin: 4000
light.kitchen_tablet:
state: true
brightness: 255
light.lyskaede:
state: true
brightness: 255
effect: None
- delay:
seconds: '{{ (states(''input_number.scene_transition_time'') or 1) | round(0,
''ceil'')+2}}'
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kokken_loftlampe:
state: true
brightness: 127
color_temp_kelvin: 3076
light.emhatte:
state: true
brightness: 255
color_temp_kelvin: 3500
light.kokkenbord:
state: true
brightness: 200
color_temp_kelvin: 3076
light.kokken_spots:
state: true
brightness: 200
color_temp_kelvin: 3076
light.kitchen_tablet:
state: true
brightness: 172
light.lyskaede:
state: true
brightness: 255
effect: None
- delay:
seconds: '{{ (states(''input_number.scene_transition_time'') or 1) | round(0,
''ceil'')+2}}'
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kokken_loftlampe:
state: true
brightness: 72
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.emhatte:
state: true
brightness: 72
color_temp_kelvin: 2500
light.kokkenbord:
state: true
brightness: 72
color_temp_kelvin: 2500
light.kokken_spots:
state: true
brightness: 72
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.kitchen_tablet:
state: true
brightness: 127
light.lyskaede:
state: true
brightness: 127
effect: None
- delay:
seconds: '{{ (states(''input_number.scene_transition_time'') or 1) | round(0,
''ceil'')+2}}'
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kokken_loftlampe:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.emhatte:
state: true
brightness: 48
color_temp_kelvin: 2500
light.kokkenbord:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.kokken_spots:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.kitchen_tablet:
state: true
brightness: 72
light.lyskaede:
state: true
brightness: 72
effect: None
- delay:
seconds: '{{ (states(''input_number.scene_transition_time'') or 1) | round(0,
''ceil'')+2}}'
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kokken_loftlampe:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.emhatte:
state: false
light.kokkenbord:
state: true
brightness: 8
rgb_color:
- 255
- 0
- 0
light.kokken_spots:
state: true
brightness: 16
rgb_color:
- 255
- 0
- 0
light.kitchen_tablet:
state: true
brightness: 1
light.lyskaede:
state: true
brightness: 24
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
group.kitchen_lights:
state: false
light.kitchen_tablet:
state: false
- alias: kokken_soundbar_volume_remote_up
id: c6126fdc-bc40-4d2f-a904-24201aa18586
initial_state: true
triggers:
- trigger: state
entity_id: input_select.kokken_soundbar_volume_remote_state
to: up
for:
milliseconds: 75
mode: single
actions:
- repeat:
sequence:
- action: media_player.volume_up
data:
entity_id: media_player.kokken
- delay:
milliseconds: 75
until:
- condition: or
conditions:
- condition: state
entity_id: input_select.kokken_soundbar_volume_remote_state
state: 'off'
- condition: state
entity_id: input_select.kokken_soundbar_volume_remote_state
state: down
- alias: kokken_soundbar_volume_remote_down
id: b52dbb09-e7ef-45f2-a1eb-c6940a7c5f2c
initial_state: true
triggers:
- trigger: state
entity_id: input_select.kokken_soundbar_volume_remote_state
to: down
for:
milliseconds: 75
mode: single
actions:
- repeat:
sequence:
- action: media_player.volume_down
data:
entity_id: media_player.kokken
- delay:
milliseconds: 75
until:
- condition: or
conditions:
- condition: state
entity_id: input_select.kokken_soundbar_volume_remote_state
state: 'off'
- condition: state
entity_id: input_select.kokken_soundbar_volume_remote_state
state: up
- alias: Set Kitchen Latest Motion
id: 13ec133d-2e48-4b94-891b-7d3e08bc24a3
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.kokken_motion
to: 'on'
conditions:
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: person.rook
state: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Kitchen
- alias: Reset Scene Transition Time
id: reset_scene_transition_time
initial_state: true
triggers:
trigger: template
value_template: '{% if as_timestamp(now()) - as_timestamp(states.input_number.scene_transition_time.last_updated)
> 60 %}true{% endif %}'
actions:
- action: input_number.set_value
data:
entity_id: input_number.scene_transition_time
value: 0.5
- alias: Refresh Light Profile Event On Theme Change
id: refresh_light_profile_event_on_theme_change
initial_state: true
triggers:
- trigger: state
entity_id: input_select.theme
actions:
- event: refresh_light_profile
- alias: Set Light Profile
id: set_light_profile
initial_state: true
mode: queued
triggers:
- trigger: event
event_type: set_light_profile
variables:
rooms: '{{ trigger.event.data.room if trigger.event.data.room is list else [trigger.event.data.room]
}}'
profile: '{{ trigger.event.data.profile }}'
transition_time: "{{-\n trigger.event.data.transition_time\n if trigger.event.data.transition_time\
\ is defined\n and (\n trigger.event.data.transition_time|string|regex_match('^\\\
\\d+$')\n or trigger.event.data.transition_time|string|regex_match('^\\\\\
d*\\\\.\\\\d+$')\n )\n-}}"
light_profile_entity: "{%- set ns = namespace(ret=[]) -%} {%- for r in rooms -%}\n\
\ {%- if not r or is_state('input_boolean.'+r+'_separate_light_profile', 'off')\
\ -%}\n {%- set ns.ret = ns.ret + ['input_select.light_profile'] -%}\n {%-\
\ else -%}\n {%- set ns.ret = ns.ret + ['input_select.'~r~'_light_profile']\
\ -%}\n {%- endif -%}\n{%- endfor -%} {%- set ns.ret = ns.ret|unique|list -%}\
\ {{ ns.ret }}"
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ transition_time != '''' }}'
sequence:
- action: input_number.set_value
data:
entity_id: input_number.scene_transition_time
value: '{{ transition_time|float(0.5) }}'
- wait_template: '{{ is_state(''input_number.scene_transition_time'', transition_time|float(0.5))
}}'
timeout: 00:00:05
continue_on_timeout: true
- action: input_select.select_option
data:
entity_id: '{{ light_profile_entity }}'
option: '{{ profile }}'
- choose:
- conditions:
- condition: template
value_template: '{{ transition_time != '''' }}'
sequence:
- delay:
seconds: 2
- action: automation.trigger
data:
entity_id: automation.reset_scene_transition_time
- alias: Increase Light Profile
id: increase_light_profile
initial_state: true
mode: queued
triggers:
- trigger: event
event_type: increase_light_profile
variables:
room: '{{ trigger.event.data.room }}'
room_separate: '{{ not not room and is_state(''input_boolean.''+room+''_separate_light_profile'',
''on'') }}'
current_light_profile: '{{ states(''sensor.'' + room + ''_light_profile'' if room_separate
else ''input_select.light_profile'') }}'
light_profile_entity: "{%- if room_separate -%}\n input_select.{{ room }}_light_profile\n\
{%- else -%}\n input_select.light_profile\n{%- endif -%}\n"
conditions:
- condition: template
value_template: '{{ current_light_profile != ''Bright'' }}'
actions:
- action: input_select.select_previous
data:
entity_id: '{{ light_profile_entity }}'
- alias: Decrease Light Profile
id: decrease_light_profile
initial_state: true
mode: queued
triggers:
- trigger: event
event_type: decrease_light_profile
variables:
room: '{{ trigger.event.data.room }}'
room_separate: '{{ not not room and is_state(''input_boolean.''+room+''_separate_light_profile'',
''on'') }}'
current_light_profile: '{{ states(''sensor.'' + room + ''_light_profile'' if room_separate
else ''input_select.light_profile'') }}'
light_profile_entity: "{%- if room_separate -%}\n input_select.{{ room }}_light_profile\n\
{%- else -%}\n input_select.light_profile\n{%- endif -%}\n"
conditions:
- condition: template
value_template: '{{ current_light_profile != ''Off'' }}'
actions:
- action: input_select.select_next
data:
entity_id: '{{ light_profile_entity }}'
- alias: Cycle Light Profile
id: cycle_light_profile
initial_state: true
mode: queued
triggers:
- trigger: event
event_type: cycle_light_profile
variables:
room: '{{ trigger.event.data.room }}'
room_separate: '{{ not not room and is_state(''input_boolean.''+room+''_separate_light_profile'',
''on'') }}'
current_light_profile: '{{ states(''sensor.'' + room + ''_light_profile'' if room_separate
else ''input_select.light_profile'') }}'
light_profile_entity: "{%- if room_separate -%}\n input_select.{{ room }}_light_profile\n\
{%- else -%}\n input_select.light_profile\n{%- endif -%}\n"
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ current_light_profile == ''Bright'' }}'
sequence:
- action: input_select.select_option
data:
option: Night
entity_id: '{{ light_profile_entity }}'
- conditions:
- condition: template
value_template: '{{ current_light_profile == ''Off'' }}'
sequence:
- action: input_select.select_option
data:
option: Default
entity_id: '{{ light_profile_entity }}'
default:
- action: input_select.select_previous
data:
entity_id: '{{ light_profile_entity }}'
- alias: Room Separate Light Profile
id: room_separate_light_profile
initial_state: true
mode: parallel
triggers:
trigger: state
entity_id:
- input_boolean.bathroom_separate_light_profile
- input_boolean.bedroom_separate_light_profile
- input_boolean.hallway_separate_light_profile
- input_boolean.kitchen_separate_light_profile
- input_boolean.living_room_separate_light_profile
- input_boolean.office_separate_light_profile
- input_boolean.workshop_separate_light_profile
- input_boolean.balcony_separate_light_profile
- input_boolean.office_balcony_separate_light_profile
variables:
room: '{{ trigger.entity_id.replace(''input_boolean.'', '''').replace(''_separate_light_profile'',
'''') }}'
actions:
- action: input_select.select_option
data:
entity_id: input_select.{{ room }}_light_profile
option: '{{ states(''input_select.light_profile'') }}'
- id: close_bar_after_no_activity
alias: Close bar after 4 hours with no activity
triggers:
- trigger: state
entity_id: binary_sensor.stue_tilstedevarelse_bar
to: 'off'
for:
hours: 4
conditions:
- condition: state
entity_id: input_boolean.bar_open
state: 'on'
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.bar_open
- alias: Stue Gardiner Automatisering
id: 22f774d8-6463-4115-84b0-2f5529326a79
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.living_room_curtains_auto_open
for:
minutes: 5
actions:
- action: "{% set open = states('binary_sensor.living_room_curtains_auto_open')\
\ %} {% if open == 'on' %}\n cover.open_cover\n{% elif open == 'off' %}\n \
\ cover.close_cover\n{% else %}\n cover.stop_cover {# if the state is unknown\
\ do a no-op #}\n{% endif %}"
target:
entity_id:
- cover.stue_gardin
- alias: living_room_curtains_open_balcony_door
id: 2c0834d8-a4b9-43b3-b085-05565890e98f
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.stue_altandor
to: 'on'
conditions:
- condition: state
entity_id: cover.stue_gardin_venstre
state: closed
actions:
- action: script.turn_on
target:
entity_id: script.stue_gardin_aabn_dor
- alias: living_room_curtains_close_balcony_door
id: fe60b467-8c49-43e1-a4c7-39b69daeaf0d
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.stue_altandor
to: 'off'
for:
minutes: 1
conditions:
- condition: state
entity_id: cover.stue_gardin_venstre
state: open
- condition: state
entity_id: cover.stue_gardin_hojre
state: closed
actions:
- action: cover.close_cover
target:
entity_id: cover.stue_gardin_venstre
- alias: Bar åbnet
id: d7ce60c1-c867-4ff0-b24b-ee3b2d4500e9
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.bar_open
to: 'on'
actions:
- event: refresh_light_profile
- alias: Bar lukket
id: 909a3888-901a-47fd-9def-fe843c52e610
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.bar_open
to: 'off'
actions:
- event: refresh_light_profile
- id: bar_close_timeout
alias: Bar luk ved idle
triggers:
- trigger: state
entity_id: binary_sensor.living_room_activity
to: 'off'
for:
hours: 4
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.bar_open
- id: living_room_balcony_door_open_reminder
alias: living_room_balcony_door_open_reminder
triggers:
- trigger: state
entity_id: sensor.living_room_activity_state
to: 'off'
for:
minutes: 15
conditions:
- alias: Balcony door open
condition: state
entity_id: binary_sensor.stue_altandor
state: 'on'
- alias: Outside temp below 18
condition: numeric_state
entity_id: sensor.altan_temperatur
below: 18
actions:
- action: script.notify_everywhere
data:
message: Stue altandør står åben!
- alias: living_room_balcony_door_activity_on
id: a9ab798e-6086-4054-b31f-9430bbc860b0
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.stue_altandor
to: 'on'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.living_room_balcony_door_activity
- alias: living_room_balcony_door_activity_off
id: f2716cf8-226a-408c-b7ef-8ff6ffdda3f5
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.living_room_balcony_door_activity
to: 'on'
for:
seconds: 5
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.living_room_balcony_door_activity
- alias: activate_light_profile_living_room
id: 0f9e2d9a-7d28-484c-a0de-6bef156ac906
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.living_room_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.living_room_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
group.living_room_lights:
state: true
brightness: 255
color_temp_kelvin: 4000
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- action: script.turn_on
target:
entity_id: script.hue_scene_or_light_profile
data:
variables:
room: Stue
scene: '{{ states(''sensor.theme'') }}'
fallback_scene:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.stue_spots:
state: true
brightness: 128
color_temp_kelvin: 2325
light.sofa_laeselampe:
state: true
brightness: 172
color_temp_kelvin: 2564
light.sofalampe:
state: true
brightness: 128
color_temp_kelvin: 2325
light.skaenk_lampe:
state: true
brightness: 128
color_temp_kelvin: 2325
light.sofa_uplight:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.globe:
state: true
brightness: 192
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.stue_tv:
state: true
brightness: 192
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.stue_tv_bund:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
- action: script.turn_on
target:
entity_id: script.wled_preset_or_light_profile
data:
variables:
preset: '{{ states(''sensor.theme'') }}'
entities:
light.stue_gardinstang:
state: true
brightness: 96
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_12v'')
}}'
effect: Solid
light.tv_mobel:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.stue_skaenk_gulv:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.stue_skaenk:
state: true
brightness: 128
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
effect: '{{ states(''sensor.theme'') if states(''sensor.theme'') is
in state_attr(''light.stue_skaenk'', ''effect_list'') else '''' }}'
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- action: script.turn_on
target:
entity_id: script.hue_scene_or_light_profile
data:
variables:
room: Stue
scene: '{{ states(''sensor.theme'') }}'
fallback_scene:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.globe:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.sofa_laeselampe:
state: true
brightness: 76
color_temp_kelvin: 2202
light.sofa_uplight:
state: true
brightness: 172
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.sofalampe:
state: true
brightness: 76
color_temp_kelvin: 2202
light.skaenk_lampe:
state: true
brightness: 76
color_temp_kelvin: 2202
light.stue_spot_1:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.stue_spot_2:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.stue_spot_3:
state: true
brightness: 76
color_temp_kelvin: 2202
light.stue_tv:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.stue_tv_bund:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
- action: script.turn_on
target:
entity_id: script.wled_preset_or_light_profile
data:
variables:
preset: '{{ states(''sensor.theme'') }}'
entities:
light.stue_gardinstang:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_12v'')
}}'
effect: Solid
light.tv_mobel:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.stue_skaenk_gulv:
state: true
brightness: 64
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.stue_skaenk:
state: true
brightness: 64
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
effect: '{{ states(''sensor.theme'') if states(''sensor.theme'') is
in state_attr(''light.stue_skaenk'', ''effect_list'') else '''' }}'
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- parallel:
- action: script.turn_on
target:
entity_id: script.hue_scene_or_light_profile
data:
variables:
room: Stue
scene: '{{ states(''sensor.theme'') }}'
fallback_scene:
transition: '{{ (states(''input_number.scene_transition_time'') |
float or 0.5) }}'
entities:
light.stue_spots:
state: false
light.sofa_laeselampe:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.sofa_uplight:
state: true
brightness: 86
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.sofalampe:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.skaenk_lampe:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.globe:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
light.stue_tv:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
light.stue_tv_bund:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color_hue'')
}}'
- action: number.set_value
data:
entity_id: number.stue_gardinstang_speed
value: 45
- action: number.set_value
data:
entity_id: number.stue_gardinstang_intensity
value: 60
- action: select.select_option
data:
entity_id: select.stue_gardinstang_color_palette
option: '* Colors 1&2'
- action: script.turn_on
target:
entity_id: script.wled_preset_or_light_profile
data:
variables:
preset: '{{ states(''sensor.theme'') }}'
entities:
light.stue_gardinstang:
state: true
brightness: 16
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_12v'')
}}'
effect: Blends
light.tv_mobel:
state: true
brightness: 8
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'')
}}'
effect: Solid
light.stue_skaenk_gulv:
state: true
brightness: 8
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'')
}}'
effect: Solid
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.stue_skaenk:
state: true
brightness: 24
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
effect: '{{ states(''sensor.theme'') if states(''sensor.theme'') is
in state_attr(''light.stue_skaenk'', ''effect_list'') else ''''
}}'
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.globe:
state: true
brightness: 12
rgb_color:
- 255
- 0
- 0
light.tv_mobel:
state: true
brightness: 4
rgb_color:
- 255
- 0
- 0
effect: Solid
light.stue_gardinstang:
state: true
brightness: 6
rgb_color:
- 255
- 0
- 0
effect: Solid
light.sofa_laeselampe:
state: true
brightness: 12
rgb_color:
- 255
- 0
- 0
light.sofa_uplight:
state: true
brightness: 12
rgb_color:
- 255
- 0
- 0
light.stue_spots:
state: false
light.sofalampe:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.skaenk_lampe:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.stue_skaenk_gulv:
state: true
brightness: 4
rgb_color:
- 255
- 0
- 0
effect: Solid
light.stue_tv:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.stue_tv_bund:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.stue_skaenk:
state: true
brightness: 8
rgb_color:
- 255
- 0
- 0
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: light.turn_off
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entity_id: group.living_room_lights
- alias: activate_light_profile_living_room_dining_table
id: activate_light_profile_living_room_dining_table
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.living_room_active_light_profile
- trigger: state
entity_id: binary_sensor.stue_tilstedevarelse_spisebord
to: 'on'
- trigger: state
entity_id: binary_sensor.stue_tilstedevarelse_spisebord
to: 'off'
for:
seconds: 30
- trigger: event
event_type: refresh_light_profile
actions:
- action: script.turn_on
target:
entity_id: "{%- set profile = states('sensor.living_room_selected_light_profile')\
\ -%} {% \n if profile != 'Off'\n and (\n is_state('binary_sensor.stue_tilstedevarelse_spisebord',\
\ 'on')\n )\n%}\n {%- set profiles = state_attr('input_select.light_profile',\
\ 'options') -%}\n script.dining_table_lights_{{ (profiles[profiles.index(profile)-1]\
\ or 'Bright')|lower }}\n{% else %}\n script.dining_table_lights_{{ (states('sensor.living_room_active_light_profile')|lower)\
\ }}\n{% endif %}"
- alias: activate_light_profile_living_room_bar
id: activate_light_profile_living_room_bar
mode: queued
initial_state: true
triggers:
- trigger: state
entity_id:
- sensor.living_room_active_light_profile
- sensor.living_room_selected_light_profile
- input_boolean.bar_open
- trigger: state
entity_id: binary_sensor.stue_tilstedevarelse_bar
to: 'on'
- trigger: state
entity_id: binary_sensor.stue_tilstedevarelse_bar
to: 'off'
for:
seconds: 30
- trigger: event
event_type: refresh_light_profile
actions:
- action: script.turn_on
target:
entity_id: "{%- set profile = states('sensor.living_room_selected_light_profile')\
\ -%} {% \n if profile != 'Off'\n and (\n is_state('binary_sensor.stue_tilstedevarelse_bar',\
\ 'on')\n or is_state('input_boolean.bar_open', 'on')\n )\n%}\n {%- set\
\ profiles = state_attr('input_select.light_profile', 'options') -%}\n script.bar_lights_{{\
\ (profiles[profiles.index(profile)-1] or 'Bright')|lower }}\n{% else %}\n\
\ script.bar_lights_{{ (states('sensor.living_room_active_light_profile')|lower)\
\ }}\n{% endif %}"
- alias: Set Living Room Latest Motion
id: 8f82703e-c8ac-4280-bc4d-53e86c83e9bd
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.stue_motion
- binary_sensor.stue_tilstedevarelse_alle_zoner
- binary_sensor.stue_tilstedevarelse_bar
- binary_sensor.stue_tilstedevarelse_spisebord
- binary_sensor.stue_tilstedevarelse_sofa
- binary_sensor.stue_tilstedevarelse_altandor
to: 'on'
conditions:
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: person.rook
state: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Living Room
- alias: switch_climate_sensors_thermostats
id: 5850f484-6c2f-4fcf-8f08-1731207f3dd1
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.show_climate_sensors
to: 'on'
- trigger: state
entity_id: input_boolean.show_thermostats
to: 'on'
actions:
- action: input_boolean.turn_off
data:
entity_id: "{% if (trigger.entity_id == 'input_boolean.show_climate_sensors')\
\ -%}\n input_boolean.show_thermostats\n{% else -%}\n input_boolean.show_climate_sensors\n\
{% endif -%}\n"
- alias: close_climate_sensors
id: 92dbda3e-b736-4d13-89c6-ed7412bd9d2a
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.show_climate_sensors
to: 'on'
for:
seconds: 30
actions:
- action: input_boolean.toggle
data:
entity_id: input_boolean.show_climate_sensors
- alias: close_thermostats
id: 4d1fe726-f8cf-49b4-8fdb-a03fe092a0f8
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.show_thermostats
to: 'on'
for:
seconds: 30
actions:
- action: input_boolean.toggle
data:
entity_id: input_boolean.show_thermostats
- id: speaker_details_timeout
alias: Speaker Details Timeout
mode: parallel
initial_state: true
triggers:
- trigger: state
entity_id:
- input_boolean.show_stue_speaker_details
- input_boolean.show_kokken_speaker_details
- input_boolean.show_kontor_speaker_details
- input_boolean.show_sovevaerelse_speaker_details
- input_boolean.show_badevaerelse_speaker_details
- input_boolean.show_roam_speaker_details
to: 'on'
for:
minutes: 5
actions:
- action: input_boolean.turn_off
target:
entity_id: '{{ trigger.entity_id }}'
- alias: Mikroovn startet
id: 6ff8d64d-b0ff-450b-8b51-5c2da4c546e1
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.microwave_running
to: 'on'
actions:
- action: automation.turn_off
data:
entity_id: automation.sluk_mikroovn_hvis_ikke_startet_efter_dor_lukket
stop_actions: false
- alias: Mikroovn Færdig
id: de4b6b42-b9aa-4f47-aa7a-8a51180ed774
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.microwave_running
from: 'on'
to: 'off'
actions:
- action: script.notify_everywhere
data:
message: Mikroovnen er færdig.
- alias: Tænd mikroovn når dør åbnes
id: 0cd271e7-3331-40b8-a772-d70e3f984bfb
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.mikroovn_dor_abner
to: 'on'
actions:
- action: switch.turn_on
data:
entity_id: switch.mikroovn
- action: automation.turn_on
data:
entity_id: automation.sluk_mikroovn_hvis_ikke_startet_efter_dor_lukket
- alias: Sluk mikroovn hvis ikke startet efter dør lukket
id: f10c2677-b5cc-425e-9556-6fd4a2fd632d
initial_state: false
triggers:
- trigger: state
entity_id: binary_sensor.mikroovn_dor_abner
to: 'off'
for:
minutes: 1
conditions:
- condition: state
entity_id: binary_sensor.microwave_running
state: 'off'
actions:
- action: switch.turn_off
data:
entity_id: switch.mikroovn
- action: automation.turn_off
data:
entity_id: automation.sluk_mikroovn_hvis_ikke_startet_efter_dor_lukket
stop_actions: false
- alias: Cold water leak warning
id: cold_water_leak_warning
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.koldt_vand_forbrug
above: 200
for:
minutes: 10
actions:
- action: script.notify_everywhere
data:
message: Koldt vand løber!
severity: 2
- alias: Warm water leak warning
id: warm_water_leak_warning
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.varmt_vand_forbrug
above: 200
for:
minutes: 10
actions:
- action: script.notify_everywhere
data:
message: Varmt vand løber!
severity: 2
- alias: Apartment Door Lock Notification
id: apartment_door_lock_notification
initial_state: true
triggers:
trigger: state
entity_id: lock.hoveddor_las
to: unlocked
for:
minutes: 3
actions:
- action: script.notify_everywhere
data:
message: Hoveddøren er ikke låst!
severity: 2
- alias: Freezer Door Open Notification
id: freezer_door_open_notification
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.fryser_dor
to: 'on'
for:
minutes: 3
actions:
- action: script.notify_everywhere
data:
message: Fryseren står åben!
severity: 2
- alias: Fridge Door Open Notification
id: fridge_door_open_notification
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.koleskab_dor_abner
to: 'on'
for:
minutes: 3
actions:
- action: script.notify_everywhere
data:
message: Køleskabet står åben!
severity: 2
- alias: Smartwatch charged notification
id: smartwatch_charged_notification
initial_state: true
triggers:
trigger: numeric_state
entity_id: sensor.darkwatch_battery_level
above: 98
actions:
- action: script.notify_everywhere
data:
message: Ur er fuldt opladet!
- alias: Kontor Gardiner Automatisering
id: 202e827a-1c17-4941-b4ea-86598ef1a8d0
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.office_blinds_auto_open
for:
minutes: 2
actions:
- action: "{% set open = states('binary_sensor.office_blinds_auto_open') %} {% if\
\ open == 'on' %}\n cover.open_cover\n{% elif open == 'off' %}\n cover.close_cover\n\
{% else %}\n cover.stop_cover {# if the state is unknown do a no-op #}\n{%\
\ endif %}"
target:
entity_id:
- cover.kontor_rullegardin
- cover.kontor_altandor_gardin
- id: office_balcony_door_open_reminder
alias: office_balcony_door_open_reminder
triggers:
- trigger: state
entity_id: sensor.office_activity_state
to: 'off'
for:
minutes: 15
conditions:
- alias: Balcony door open
condition: state
entity_id: binary_sensor.kontor_altandor
state: 'on'
- alias: Outside temp below 18
condition: numeric_state
entity_id: sensor.kontor_altan_temperatur
below: 18
actions:
- action: script.notify_everywhere
data:
message: Kontor altandør står åben!
- alias: office_balcony_door_activity_on
id: 3e1c2b9f-ad00-4781-b346-b0da8fbec9e8
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.kontor_altandor
to: 'on'
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.office_balcony_door_activity
- alias: office_balcony_door_activity_off
id: e1204019-f3e1-472c-ba71-41015227f4cc
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.office_balcony_door_activity
to: 'on'
for:
seconds: 5
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.office_balcony_door_activity
- alias: activate_light_profile_office_balcony
id: 282a1712-2ab0-45d2-8988-7b357ad91279
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.office_balcony_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.office_balcony_active_light_profile'') }}'
actions:
- delay:
seconds: 0.1
- alias: activate_light_profile_office
id: efe4262d-9e2d-4649-a756-fd61c97185bf
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.office_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.office_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- parallel:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kontor_loftlampe:
state: true
brightness: 255
color_temp_kelvin: 3846
light.kontor_loftlys:
state: true
brightness: 255
color_temp_kelvin: 3846
light.projektor:
state: true
brightness: 255
color_temp_kelvin: 3846
light.kontor_hylde:
state: true
brightness: 255
hs_color:
- 15
- 43
effect: Solid
light.pc_skaerme_hojre:
state: true
brightness: 255
hs_color:
- 15
- 43
effect: Solid
light.pc_skaerme_midt:
state: true
brightness: 255
hs_color:
- 15
- 43
effect: Solid
light.motherboard:
state: true
brightness: 255
hs_color:
- 15
- 43
light.g502_lightspeed_wireless_gaming_mouse_1_led_0:
state: true
brightness: 255
hs_color:
- 15
- 43
light.gpu_stand:
state: true
brightness: 255
hs_color:
- 15
- 43
light.gigabyte_rtx3070_ti_gaming_oc_8g_0:
state: true
brightness: 255
hs_color:
- 15
- 43
light.g502_lightspeed_wireless_gaming_mouse_1_led_1:
state: true
brightness: 255
hs_color:
- 15
- 43
light.spogelse:
state: true
brightness: 255
color_temp_kelvin: 2700
effect: None
light.spogelse_ojne:
state: true
brightness: 255
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- parallel:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kontor_loftlampe:
state: true
brightness: 127
color_temp_kelvin: 2564
light.kontor_loftlys:
state: true
brightness: 255
color_temp_kelvin: 2564
light.projektor:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
effect: 'off'
light.kontor_hylde:
state: true
brightness: 172
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
effect: Solid
light.pc_skaerme_hojre:
state: true
brightness: 172
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.pc_skaerme_midt:
state: true
brightness: 172
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.motherboard:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
light.g502_lightspeed_wireless_gaming_mouse_1_led_0:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
light.gpu_stand:
state: true
brightness: 64
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.gigabyte_rtx3070_ti_gaming_oc_8g_0:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.g502_lightspeed_wireless_gaming_mouse_1_led_1:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.spogelse:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: None
light.spogelse_ojne:
state: true
brightness: 255
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- parallel:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kontor_loftlampe:
state: true
brightness: 1
color_temp_kelvin: 2202
light.kontor_loftlys:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
effect: 'off'
light.projektor:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'')
}}'
effect: 'off'
light.kontor_hylde:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
effect: Solid
light.pc_skaerme_hojre:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.pc_skaerme_midt:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.motherboard:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
light.g502_lightspeed_wireless_gaming_mouse_1_led_0:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
light.gpu_stand:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.gigabyte_rtx3070_ti_gaming_oc_8g_0:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.g502_lightspeed_wireless_gaming_mouse_1_led_1:
state: true
brightness: 255
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.spogelse:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: None
light.spogelse_ojne:
state: true
brightness: 127
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kontor_loftlampe:
state: false
light.kontor_loftlys:
state: true
brightness: 100
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
effect: 'off'
light.projektor:
state: true
brightness: 100
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
effect: 'off'
light.kontor_hylde:
state: true
brightness: 64
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
effect: Solid
light.pc_skaerme_hojre:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.pc_skaerme_midt:
state: true
brightness: 32
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: Solid
light.motherboard:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
light.g502_lightspeed_wireless_gaming_mouse_1_led_0:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color'') }}'
light.gpu_stand:
state: true
brightness: 24
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.gigabyte_rtx3070_ti_gaming_oc_8g_0:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.g502_lightspeed_wireless_gaming_mouse_1_led_1:
state: true
brightness: 127
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
light.spogelse:
state: true
brightness: 96
hs_color: '{{ state_attr(''sensor.theme'', ''secondary_color'') }}'
effect: None
light.spogelse_ojne:
state: true
brightness: 96
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.kontor_loftlampe:
state: false
light.kontor_loftlys:
state: true
brightness: 32
rgb_color:
- 255
- 0
- 0
effect: 'off'
light.projektor:
state: true
brightness: 32
rgb_color:
- 255
- 0
- 0
effect: 'off'
light.kontor_hylde:
state: true
brightness: 32
rgb_color:
- 255
- 0
- 0
effect: Solid
light.pc_skaerme_hojre:
state: true
brightness: 8
rgb_color:
- 255
- 0
- 0
effect: Solid
light.pc_skaerme_midt:
state: true
brightness: 8
rgb_color:
- 255
- 0
- 0
effect: Solid
light.motherboard:
state: true
brightness: 64
rgb_color:
- 255
- 0
- 0
light.gigabyte_rtx3070_ti_gaming_oc_8g_0:
state: true
brightness: 64
rgb_color:
- 255
- 0
- 0
light.g502_lightspeed_wireless_gaming_mouse_1_led_0:
state: true
brightness: 64
rgb_color:
- 255
- 0
- 0
light.gpu_stand:
state: true
brightness: 16
rgb_color:
- 255
- 0
- 0
light.g502_lightspeed_wireless_gaming_mouse_1_led_1:
state: true
brightness: 64
rgb_color:
- 255
- 0
- 0
light.spogelse:
state: true
brightness: 24
rgb_color:
- 255
- 0
- 0
effect: None
light.spogelse_ojne:
state: false
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: homeassistant.turn_off
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entity_id:
- group.office_lights
- alias: refresh_lights_after_openrgb_becomes_available
id: d63a2c52-7387-4991-9511-82fbb31f2575
initial_state: true
mode: single
triggers:
- trigger: state
entity_id:
- light.gpu_stand
- light.gigabyte_rtx3070_ti_gaming_oc_8g_0
- light.g502_lightspeed_wireless_gaming_mouse_1_led_0
- light.motherboard
- light.g502_lightspeed_wireless_gaming_mouse_1_led_1
from: unavailable
for:
seconds: 30
actions:
- event: refresh_light_profile
- alias: Office PC active trigger
id: 9f0915b1-24af-4406-b12e-5510d87377d2
initial_state: true
triggers:
trigger: template
value_template: "{{\n is_state('sensor.office_room_state', 'active')\n or is_state('binary_sensor.rook_pc_activity',\
\ 'on')\n or is_state('switch.rook_pc', 'on')\n}}"
actions:
action: switch.turn_on
data:
entity_id: switch.pc_afbryder
- alias: Office PC inactive trigger
id: 1baf4ea3-3efd-4f60-90dc-50d2f65b24a9
initial_state: true
triggers:
- trigger: template
value_template: "{{\n is_state('sensor.office_room_state', 'off') \n and is_state('binary_sensor.rook_pc_activity',\
\ 'off')\n and is_state('switch.rook_pc', 'off')\n}}"
for:
minutes: 5
conditions:
- alias: Quest not in use
condition: state
entity_id: binary_sensor.quest_in_use_delayed
state: 'off'
actions:
action: switch.turn_off
data:
entity_id: switch.pc_afbryder
- alias: Office Speaker/PC Accessories active trigger
id: 25fc64ea-5663-4be4-aa3a-08fb6caf6c6a
initial_state: true
triggers:
trigger: template
value_template: "{{\n states('sensor.pc_afbryder_forbrug')|float > 0.03\n or\
\ is_state('binary_sensor.rook_pc_activity', 'on')\n or is_state('binary_sensor.vagtskema_wfh',\
\ 'on')\n}}"
actions:
action: switch.turn_on
data:
entity_id: switch.pc_tilbehor_afbryder
- alias: Office Speaker/PC Accessories inactive trigger
id: 79c485f8-79de-47b2-9169-884bc6e020bc
initial_state: true
triggers:
- trigger: template
value_template: "{{\n is_state('switch.pc_afbryder', 'off')\n and states('sensor.pc_afbryder_forbrug')|float\
\ < 0.02\n and is_state('binary_sensor.rook_pc_activity', 'off')\n and is_state('binary_sensor.vagtskema_wfh',\
\ 'off')\n and is_state('binary_sensor.quest_in_use_delayed', 'off')\n}}"
actions:
action: switch.turn_off
data:
entity_id:
- switch.pc_tilbehor_afbryder
- switch.printer_afbryder
- alias: Turn PC Printer on when print queue not empty
id: e5d8426d-2ded-49af-adf8-6f39e98a9bc2
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.rook_pc_printers_npid634ed_hpcolorlaserjetm255dw
above: 0
conditions:
- condition: state
entity_id: switch.printer_afbryder
state: 'off'
actions:
- action: switch.turn_on
target:
entity_id: switch.printer_afbryder
- alias: Mute PC TV line in on Office TV off
id: mute_pc_tv_line_in_on_office_tv_off
initial_state: true
triggers:
- trigger: state
entity_id:
- media_player.kontor_tv
- media_player.kontor_shield_remote
to: 'off'
actions:
- action: button.press
target:
entity_id: button.rook_pc_mute_tv
- alias: Unute PC TV line in on Office TV on
id: unute_pc_tv_line_in_on_office_tv_on
initial_state: true
triggers:
- trigger: state
entity_id: media_player.kontor_tv
to: 'on'
actions:
- action: button.press
target:
entity_id: button.rook_pc_unmute_tv
- alias: Switch Office TV speaker output to internal when PC off
id: switch_office_tv_speaker_output_to_internal_when_pc_off
initial_state: true
triggers:
- trigger: state
entity_id: switch.rook_pc
to: 'off'
- trigger: state
entity_id: media_player.kontor_tv
to: 'on'
conditions:
- condition: state
entity_id: media_player.kontor_tv
state: 'on'
- condition: state
entity_id: switch.rook_pc
state: 'off'
actions:
- action: webostv.select_sound_output
data:
entity_id: media_player.kontor_tv
sound_output: tv_speaker
- alias: Switch Office TV Speaker Output to optical when PC on
id: switch_office_tv_speaker_output_to_optical_when_pc_on
initial_state: true
triggers:
- trigger: state
entity_id: switch.rook_pc
to: 'on'
- trigger: state
entity_id: media_player.kontor_tv
to: 'on'
conditions:
- condition: state
entity_id: media_player.kontor_tv
state: 'on'
- condition: state
entity_id: switch.rook_pc
state: 'on'
actions:
- action: webostv.select_sound_output
data:
entity_id: media_player.kontor_tv
sound_output: external_optical
- alias: Set Office Latest Motion
id: a0b61be0-7171-4225-8d61-e40fd3c6d888
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.kontor_motion
- binary_sensor.kontor_gulv_bevagelse
- binary_sensor.rook_pc_activity
- binary_sensor.rook_pc_activity_ping
to: 'on'
conditions:
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: person.rook
state: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Office
- alias: Paid parking
id: 9639dddf-8e3b-4321-811d-6df6b8562c24
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.parking_lot_paid
to: 'on'
actions:
- action: script.notify_darkphone
data:
message: 'Du har parkeret på {{ states(''sensor.parking_lot'') }}.
Husk at oprette parkering i receptionen eller online.
'
- alias: Set Parked Time
id: c562770a-5958-46b7-ace8-3cbf4996fe88
initial_state: true
triggers:
trigger: state
entity_id: sensor.parkeringsskive
for:
seconds: 10
actions:
- condition: numeric_state
entity_id: sensor.parking_duration_limit
above: 0
- variables:
parked_time: "{{\n as_timestamp(states('sensor.parking_last_captured'))\n \
\ | timestamp_custom('%H:%M')\n if has_value('sensor.parking_last_captured')\n\
\ else None\n}}"
parkeringsskive: "{{\n as_timestamp(states('sensor.parkeringsskive'))\n |\
\ timestamp_custom('%H:%M')\n if has_value('sensor.parkeringsskive')\n else\
\ None\n}}"
parking_limit: "{{\n as_timestamp(states('sensor.parking_limit'))\n | timestamp_custom('%H:%M')\n\
\ if has_value('sensor.parking_limit')\n else None\n}}"
parking_alarm: "{{\n as_timestamp(states('sensor.parking_alarm'))\n | timestamp_custom('%H:%M')\n\
\ if has_value('sensor.parking_alarm')\n else None\n}}"
- action: script.android_set_alarm
data:
action: notify.mobile_app_darkphone
timehour: '{{ parking_alarm.split('':'')[0] }}'
timemin: '{{ parking_alarm.split('':'')[1] }}'
message: Flyt bilen!
- action: script.notify_darkphone
data:
message: 'Parkeret på {{ states(''sensor.parking_lot'') }} klokken {{ parked_time
}}.
Timer sat til kl. {{ parkeringsskive }}, flyt bilen inden kl. {{ parking_limit
}}.
Alarm sat til kl. {{ parking_alarm }}.
'
- alias: Parking Alarm
id: parking_alarm
initial_state: true
triggers:
trigger: time
at: sensor.parking_alarm
actions:
- action: script.notify_darkphone
data:
message: Flyt bilen!
- action: switch.turn_on
target:
entity_id: switch.id_3_pro_climatisation
- alias: Stop Climatisation on parking
id: 45fa7427-0498-4f77-a9f4-3e5983c15dc3
initial_state: true
triggers:
trigger: state
entity_id: sensor.bil_placering
not_to:
- Away
- unknown
- unavailable
conditions:
condition: state
entity_id: switch.id_3_pro_climatisation
state: 'on'
actions:
- action: switch.turn_off
target:
entity_id: switch.id_3_pro_climatisation
- alias: Toggle GDQ on event state
id: 5d6fc4e6-291f-43f0-b555-831251da9ac5
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.gdq_event_active
to:
- 'on'
- 'off'
for:
minutes: 1
condition:
- condition: template
value_template: '{{ not is_state(''group.gdq_automations'', states(''binary_sensor.gdq_event_active''))
}}'
actions:
- action: homeassistant.turn_{{ states('binary_sensor.gdq_event_active') }}
target:
entity_id: group.gdq_automations
- alias: Slow update GDQ
id: dc222bee-ba1b-49b4-80cf-7dee61761268
initial_state: true
triggers:
- trigger: time_pattern
hours: '0'
minutes: '0'
seconds: '0'
actions:
- action: pyscript.get_gdq_event
- alias: Refresh GDQ Tracker
id: refresh_gdq_tracker
mode: single
triggers:
- trigger: time_pattern
hours: '*'
minutes: /1
seconds: '0'
actions:
- action: script.refresh_gdq_data
- alias: Notify GDQ Run Coming Up
id: notify_gdq_run_coming_up
triggers:
- trigger: numeric_state
entity_id: sensor.gdq_next_watch_run
below: 30
- trigger: numeric_state
entity_id: sensor.gdq_next_watch_run
below: 15
- trigger: numeric_state
entity_id: sensor.gdq_next_watch_run
below: 5
variables:
release_year: '{{ state_attr(''sensor.gdq_next_watch_run'', ''next_run'').release_year
}}'
game: '{{ state_attr(''sensor.gdq_next_watch_run'', ''next_run'').summary | replace(''
(''+(release_year|string)+'')'', '''') }}'
runner: '{{ state_attr(''sensor.gdq_next_watch_run'', ''next_run'').runner }}'
time: "{% from 'easy_time.jinja' import custom_relative_time %} {{ custom_relative_time(\n\
\ state_attr('sensor.gdq_next_watch_run', 'next_run').get('start', ''),\n \
\ 'day, hour, minute'\n) }}"
playing_gdq: '{{ is_state(''binary_sensor.tv_currently_streaming_gdq'', ''on'')
}}'
actions:
- action: script.notify_everywhere
data:
severity: '{{ -1 if playing_gdq else 1 }}'
message:
- tts: 'Næste GDQ spil: '
language: da-DK
offset: -500
- tts: '{{ game }} — Run by {{ runner }},'
language: en-US
voice: SteffanNeural
offset: -900
- tts: ' starter {{ time }}'
language: da-DK
offset: -900
- alias: Watchlisted GDQ game now streaming
id: e8acab09-6c30-4d0c-9c1a-3301013a34c6
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.gdq_currently_streaming_watchlist_game
to: 'on'
variables:
game: '{{ state_attr(''sensor.gamesdonequick'', ''game'') }}'
runner: "{% set run = state_attr('binary_sensor.gdq_calendar', 'events')\n \
\ | selectattr('summary', 'eq', game) | list | first %}\n{% if run %}\n\
\ {{ run.runner }}\n{% else %}\n {{ None }}\n{% endif %}"
playing_gdq: '{{ is_state(''binary_sensor.tv_currently_streaming_gdq'', ''on'')
}}'
actions:
- action: script.notify_everywhere
data:
severity: '{{ 0 if playing_gdq else 1 }}'
message:
- tts: 'GDQ streamer nu: '
language: da-DK
offset: -500
- tts: '{{ game }} — Run by {{ runner }},'
language: en-US
voice: SteffanNeural
offset: -900
- alias: Refresh GDQ Runs Regex
id: refresh_gdq_runs_regex
initial_state: true
mode: restart
triggers:
- trigger: state
entity_id: &id001
- todo.gdq_runs
- todo.gdq_games
- todo.gdq_runners
- todo.gdq_commentators
- todo.gdq_hosts
- todo.gdq_categories
- trigger: state
entity_id: group.gdq_automations
to: 'on'
actions:
- repeat:
for_each: *id001
sequence:
- action: todo.get_items
data:
status: needs_action
target:
entity_id: '{{ repeat.item }}'
response_variable: todo_items
- event: gdq_runs_updated
event_data:
watchlist: '{{ repeat.item }}'
todo_items: '{{ todo_items }}'
- alias: Update GDQ Bids After Calendar Update
id: 680e332d-e89a-4170-b2b3-e997cbd830d3
mode: single
triggers:
- trigger: event
event_type: gdq_calendar_updated
actions:
- action: script.run_pyscript
data:
action: pyscript.gdq_get_bids
- alias: Update GDQ Milestones After Donation Stats
id: bc6dbbf8-d7fd-44d6-921d-9e31b0564302
mode: single
triggers:
- trigger: event
event_type: gdq_donation_stats
actions:
- action: script.run_pyscript
data:
action: pyscript.gdq_get_milestones
- id: update_gdq_calendar
alias: Update GDQ Calendar
mode: single
triggers:
- trigger: state
entity_id: calendar.gdq_schedule
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
variables:
days: 10
regexes: '{{ states.sensor.calendar_regexes.attributes }}'
attrs:
game: "{{ \n {\n 'regex': '^(?:BONUS GAME \\d+ - )?(.+)$',\n 'fields':\
\ ['summary']\n }\n}}"
category: (.+) — .+ — .+
platform: .+ — (.+) — .+
release_year: .+ — .+ — (.+)
runner: Run by (.+)
host: Hosted by (.+)
commentators: Commentary by (.+)
tags: Tagged (.+)
bool_attrs:
watch: "{{ [{\n 'regex': (state_attr('sensor.gdq_runs_regex', 'regex') or 'xxxxxxxx'),\n\
\ 'fields': ['summary']\n}] }}"
watch_game: "{{ [{\n 'regex': (state_attr('sensor.gdq_games_watchlist', 'regex')\
\ or 'xxxxxxxx'),\n 'fields': ['summary']\n}] }}"
watch_runner: "{{ [{\n 'regex': (state_attr('sensor.gdq_runners_watchlist',\
\ 'regex') or 'xxxxxxxx'),\n 'fields': ['runner']\n}] }}"
watch_host: "{{ [{\n 'regex': (state_attr('sensor.gdq_hosts_watchlist', 'regex')\
\ or 'xxxxxxxx'),\n 'fields': ['host']\n}] }}"
watch_commentators: "{{ [{\n 'regex': (state_attr('sensor.gdq_commentators_watchlist',\
\ 'regex') or 'xxxxxxxx'),\n 'fields': ['commentators']\n}] }}"
watch_category: "{{ [{\n 'regex': (state_attr('sensor.gdq_categories_watchlist',\
\ 'regex') or 'xxxxxxxx'),\n 'fields': ['category']\n}] }}"
watch_tags: "{{ [{\n 'regex': (state_attr('sensor.gdq_tags_watchlist', 'regex')\
\ or 'xxxxxxxx'),\n 'fields': ['tags']\n}] }}"
actions:
- action: homeassistant.update_entity
target:
entity_id: calendar.gdq_schedule
- delay:
seconds: 5
- action: calendar.get_events
data:
start_date_time: '{{ (now() + timedelta(days=-1)).strftime(''%Y-%m-%d'') }}
00:00:00'
end_date_time: '{{ (now() + timedelta(days=days)).strftime(''%Y-%m-%d'') }}
23:59:59'
target:
entity_id: calendar.gdq_schedule
response_variable: all_events
- variables:
agenda_events: "{% from 'agenda.jinja' import agenda_event %} {% set ns = namespace(ret=[])\
\ %} {% for event in all_events['calendar.gdq_schedule'].events | sort(attribute='start')\
\ | list -%}\n {% set ns.ret = ns.ret + [agenda_event(\"GDQ Kalender\", dict(event,\
\ location=none), regexes, bool_attrs, attrs)|from_json] %}\n{%- endfor -%}\
\ {{ ns.ret }}"
- event: gdq_calendar_updated
event_data:
events: '{{ agenda_events }}'
- alias: kitchen_timer_finished_event
id: ddee7c3a-5809-44ba-97fd-297a63076b9c
initial_state: true
mode: parallel
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_1
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_2
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_3
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.timer_{{ trigger.event.data.entity_id | replace('timer.',
'') }}_finished
- action: script.notify_everywhere
data:
message: '{{ state_attr(trigger.event.data.entity_id, ''friendly_name'') }}
er færdig!'
- alias: kitchen_timer_finished
id: 7b9af13b-fd32-4ff1-83c2-90a5981b13a7
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: binary_sensor.kitchen_timer_finished
to: 'on'
- trigger: state
entity_id: &id002
- light.blyant
- light.kontor_hylde
- light.hobbybord_vaerktojsskab
- light.gang_kommode
- light.gang_skab
- light.tv_mobel
- light.skoskab
- light.lyskaede
- light.seng_hylder_ned
- light.bar
- light.badevaerelse_lampe_hojre
- light.globe
- light.skaenk_lampe
to:
- 'on'
- 'off'
- trigger: state
entity_id: *id002
attribute: effect
conditions:
- condition: state
entity_id: binary_sensor.kitchen_timer_finished
state: 'on'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ ''light'' in trigger.to_state.entity_id }}'
sequence:
- action: light.turn_on
target:
entity_id: '{{ trigger.to_state.entity_id }}'
data:
brightness_pct: 100
effect: '{{ ''Fade'' if ''Fade'' in state_attr(trigger.to_state.entity_id,
''effect_list'') else ''opal'' }}'
default:
- repeat:
for_each: *id002
sequence:
- action: light.turn_on
target:
entity_id: '{{ repeat.item }}'
data:
brightness_pct: 100
effect: '{{ ''Fade'' if ''Fade'' in state_attr(repeat.item, ''effect_list'')
else ''opal'' }}'
- alias: kitchen_timer_dismissed
id: 1cc6a65e-b3c0-4e26-89b3-55bf7a260c7d
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: binary_sensor.kitchen_timer_finished
to: 'off'
actions:
- event: refresh_light_profile
- id: notify_washing_machine_started
alias: Notify Washing Machine Started
initial_state: true
triggers:
- trigger: state
entity_id: sensor.washing_machine
to: Running
- trigger: numeric_state
entity_id: sensor.wash_cycle_remaining_time
above: 5
conditions:
- condition: state
entity_id: sensor.washing_machine
state: Running
- condition: numeric_state
entity_id: sensor.wash_cycle_remaining_time
above: 5
actions:
- delay:
seconds: 10
- action: script.notify_everywhere
data:
message: Vaskemaskine startet. Færdig ca. kl. {{ states('sensor.vaskemaskine_faerdig')
| as_timestamp | timestamp_custom('%H:%M') }}
- id: notify_washing_machine_almost_finished
alias: Notify Washing Machine Almost Finished
initial_state: true
triggers:
- trigger: numeric_state
entity_id: sensor.wash_cycle_remaining_time
below: 6
conditions:
- condition: state
entity_id: sensor.washing_machine
state: Running
actions:
- action: script.notify_everywhere
data:
message: Vaskemaskine færdig om 5 minutter.
- id: washing_machine_finished
alias: Washing Machine Finished
initial_state: true
triggers:
- trigger: state
entity_id: sensor.washing_machine
to: Finished
actions:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.washing_machine_finished
- action: script.notify_everywhere
data:
message: Vaskemaskine Færdig
- id: washing_machine_finished_reset
alias: washing_machine_finished_reset
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.vaskemaskine_dor_abner
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.washing_machine_finished
state: 'on'
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.washing_machine_finished
- id: washing_machine_finished_reminder
alias: Washing Machine Finished Reminder
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.vaskemaskine_skal_tommes
to: 'on'
for:
minutes: 15
- trigger: state
entity_id: binary_sensor.vaskemaskine_skal_tommes
to: 'on'
for:
minutes: 30
- trigger: state
entity_id: binary_sensor.vaskemaskine_skal_tommes
to: 'on'
for:
minutes: 60
- trigger: state
entity_id: binary_sensor.vaskemaskine_skal_tommes
to: 'on'
for:
minutes: 120
- trigger: state
entity_id: binary_sensor.bathroom_activity
to: 'on'
for:
seconds: 10
conditions:
- condition: state
entity_id: binary_sensor.vaskemaskine_skal_tommes
state: 'on'
for:
minutes: 10
actions:
- action: script.notify_everywhere
data:
message: Husk at tømme vaskemaskinen
- id: dryer_finished
alias: Dryer Finished
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.torretumbler
from: 'on'
to: 'off'
for:
minutes: 10
actions:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.dryer_finished
- action: script.notify_everywhere
data:
message: Tørretumbleren er færdig.
- id: dryer_finished_reset
alias: dryer_finished_reset
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.torretumbler_dor_abner
to: 'on'
conditions:
- condition: state
entity_id: input_boolean.dryer_finished
state: 'on'
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.dryer_finished
- id: dryer_finished_reminder
alias: Dryer Finished Reminder
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.dryer_finished
to: 'on'
for:
minutes: 15
- trigger: state
entity_id: input_boolean.dryer_finished
to: 'on'
for:
minutes: 30
- trigger: state
entity_id: input_boolean.dryer_finished
to: 'on'
for:
minutes: 60
- trigger: state
entity_id: input_boolean.dryer_finished
to: 'on'
for:
minutes: 120
- trigger: state
entity_id: binary_sensor.bathroom_activity
to: 'on'
for:
seconds: 10
conditions:
- condition: state
entity_id: input_boolean.dryer_finished
state: 'on'
for:
minutes: 10
actions:
- action: script.notify_everywhere
data:
message: Husk at tømme tørretumbleren
- alias: Notify HA Shutdown
id: e87622e0-9691-421b-8691-94fdab200eef
initial_state: true
triggers:
trigger: homeassistant
event: shutdown
actions:
- action: notify.telegram_darkfox
data:
message: Home Assistant er ved at lukke ned!
- alias: Notify High Memory Usage
id: 9b460db9-09da-4b32-8183-7e315bd8d9d6
initial_state: true
mode: single
triggers:
trigger: numeric_state
entity_id: sensor.system_monitor_memory_use_percent
above: 90
for:
seconds: 30
variables:
memory_use: '{{ states(''sensor.system_monitor_memory_use_percent'') }}'
actions:
- action: homeassistant.update_entity
entity_id: sensor.add_ons_stats
- delay: 2
- action: notify.telegram_darkfox
data:
message: "Hukommelsesforbrug er højt! {{ memory_use }}%\nTop 5 Add-ons:\n{%-\
\ set stats = state_attr('sensor.add_ons_stats', 'addon_stats') or {} -%}\n\
{%- set memory = stats.get('memory', {}) -%}\n{%- for key, value in memory.items()\
\ %}\n {{ key }}: {{ value }}%\n {%- if loop.index > 4 -%}\n {%- break\
\ -%}\n {%- endif -%}\n{%- endfor -%}\n"
- delay:
minutes: 15
- alias: Notify high CPU Usage
id: 46d3d0e5-746b-4976-a66b-da481afbe993
initial_state: true
mode: single
triggers:
trigger: numeric_state
entity_id: sensor.processor_use
above: 80
for:
seconds: 30
variables:
cpu_use: '{{ states(''sensor.processor_use'') }}'
actions:
- action: homeassistant.update_entity
entity_id: sensor.add_ons_stats
- delay: 2
- action: notify.telegram_darkfox
data:
message: "CPU forbrug er højt! {{ cpu_use }}%\nTop 5 Add-ons:\n{%- set stats\
\ = state_attr('sensor.add_ons_stats', 'addon_stats') or {} -%}\n{%- set cpu\
\ = stats.get('cpu', {}) -%}\n{%- for key, value in cpu.items() %}\n {{ key\
\ }}: {{ value }}%\n {%- if loop.index > 4 -%}\n {%- break -%}\n {%-\
\ endif -%}\n{%- endfor -%}\n"
- delay:
minutes: 15
- alias: Notify Of New External IP
id: e86275ad-9c5a-4243-9428-e47f82c03586
initial_state: true
triggers:
trigger: state
entity_id: sensor.gateway_external_ip
conditions:
- condition: template
value_template: '{{ trigger.from_state and trigger.to_state }}'
- condition: template
value_template: '{{ not trigger.from_state.state == ''unknown'' }}'
- condition: template
value_template: '{{ not trigger.to_state.state == ''unknown'' }}'
actions:
- action: notify.telegram_darkfox
data:
message: Din eksterne IP har ændret sig fra {{ trigger.from_state.state }} til
{{ trigger.to_state.state }}
- alias: Uncommitted Changes Notification
id: bc36b25e-030a-4f15-a0e1-65cf739b7c37
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.uncommitted_changes
to: 'on'
for:
hours: 2
- trigger: state
entity_id: input_select.sleep_state
to: awake
for:
hours: 2
conditions:
- condition: state
entity_id: binary_sensor.uncommitted_changes
state: 'on'
for:
hours: 2
actions:
- action: persistent_notification.create
data:
notification_id: uncommitted_changes
title: Uncommitted changes!
message: You have uncommitted changes in your configuration!
- alias: Clear TTS Cache
id: ac4fb256-a4c2-4a83-ba9c-edf92df19852
initial_state: true
triggers:
trigger: time
at: 04:45:00
actions:
- action: chime_tts.clear_cache
data:
clear_temp_tts_cache: true
clear_www_tts_cache: true
clear_chimes_cache: false
clear_ha_tts_cache: false
- alias: Low Battery
id: low_battery
initial_state: false
triggers:
- trigger: state
entity_id: sensor.low_battery
attribute: entities
for:
minutes: 15
- trigger: state
entity_id: input_select.sleep_state
to: awake
for:
minutes: 15
conditions:
- condition: template
value_template: '{{ bool((state_attr(''sensor.low_battery'', ''entities'') or
[]) | length > 0) }}'
- condition: state
entity_id: input_select.sleep_state
state: awake
variables:
entities: '{{ state_attr(''sensor.low_battery'', ''entities'') or [] }}'
friendly_names: '{{ entities | map(''state_attr'', ''friendly_name'') | list }}'
entity_count: '{{ friendly_names | length }}'
entity_list: '{{ friendly_names | join(''
- '') }}'
actions:
- action: persistent_notification.create
data:
notification_id: low_battery
title: 'Lavt batteri på {{ entity_count }} enhed{{ ''er'' if entity_count >
1 else '''' }}
'
message: '- {{ entity_list }}
'
- alias: Check for duplicate package names
id: f9814b8f-6cd7-42bc-9cf2-138832c4b484
initial_state: true
triggers:
- trigger: time_pattern
hours: '*'
minutes: /5
seconds: '0'
actions:
- action: script.run_pyscript
data:
action: pyscript.find_duplicate_package_names
- alias: Notify of duplicate package names
id: b606263a-6423-4b66-b0b4-dfbbd0358ff9
initial_state: true
triggers:
- trigger: event
event_type: duplicate_package_names
conditions:
- condition: template
value_template: '{{ trigger.event.data.get(''duplicates'', {})|length > 0 }}'
actions:
- action: persistent_notification.create
data:
notification_id: duplicate_package_names
title: Duplicate Package Names
message: "{%- set duplicates = trigger.event.data.get('duplicates', {}) -%}\n\
{%- set n = duplicates|length -%}\nFound {{ n }} duplicate package names:\n\
{%- for name, entities in duplicates.items() %}\n - {{ name }}:\n {%-\
\ for entity in entities %}\n - {{ entity }}\n {%- endfor %}\n{% endfor\
\ %}\n"
- alias: living_room_tv_on
id: 9c31a41b-1c54-469b-8cec-77d4f46fde2a
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.living_room_video_out
to: 'on'
actions:
- action: switch.turn_on
target:
entity_id:
- switch.stue_tv_active
- condition: template
value_template: '{{ is_state(''select.sync_box_hdmi_input'', ''Nvidia Shield'')
}}'
- action: remote.turn_on
target:
entity_id:
- remote.stue_shield
- alias: living_room_tv_off
id: 53c454fa-09d9-4b69-9862-a5de30a24ec1
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.living_room_video_out
to: 'off'
for:
seconds: 10
actions:
- action: switch.turn_off
target:
entity_id:
- switch.stue_tv_active
- alias: living_room_soundbar_night_mode
id: d603bbac-037c-48a2-97d3-89a594565dbd
initial_state: true
triggers:
- trigger: state
entity_id: media_player.stue
to: 'on'
- trigger: time
at: '23:00:00'
conditions:
condition: and
conditions:
- condition: state
entity_id: media_player.stue
state: 'on'
- condition: time
after: '22:59:59'
before: 08:59:58
weekday:
- sun
- mon
- tue
- wed
- thu
actions:
- action: switch.turn_on
data:
entity_id: switch.stue_night_sound
- condition: template
value_template: '{{ state_attr(''media_player.stue'', ''volume_level'')|float
> 0.40 }}'
- action: media_player.volume_set
data:
entity_id: media_player.stue
volume_level: 0.4
- alias: living_room_soundbar_day_mode
id: 13f5dd4a-ee3f-4839-bbe7-90350f00cf89
initial_state: true
triggers:
- trigger: state
entity_id: media_player.stue
to: 'on'
- trigger: time
at: 09:00:00
conditions:
condition: and
conditions:
- condition: state
entity_id: media_player.stue
state: 'on'
- condition: time
after: 08:59:59
before: '22:59:58'
actions:
- action: switch.turn_off
data:
entity_id: switch.stue_night_sound
- alias: Notify Night Sound toggled on Living Room TV
id: 30e2883f-068f-47a3-a8ff-efd4a6265a8c
initial_state: true
triggers:
- trigger: state
entity_id: switch.stue_night_sound
actions:
- action: notify.stue_tv
data:
message: Natlyd slået {{ 'til' if is_state('switch.stue_night_sound', 'on')
else 'fra' }}
- alias: living_room_media_unmute
id: 5812551d-5044-4e94-a6e9-b141b1773316
initial_state: true
triggers:
- trigger: state
entity_id: sensor.living_room_room_state
to: active
- trigger: state
entity_id: media_player.stue
to: 'on'
conditions:
- condition: state
entity_id: sensor.living_room_room_state
state: active
- condition: state
entity_id: media_player.stue
state: 'on'
actions:
- action: media_player.volume_mute
data:
entity_id: media_player.stue
is_volume_muted: false
- alias: living_room_media_mute
id: 053305bf-7d7f-4500-9d2d-d4ca67e738c9
initial_state: true
triggers:
- trigger: state
entity_id: sensor.living_room_room_state
to: 'off'
- trigger: state
entity_id: media_player.stue
to: 'on'
conditions:
- condition: state
entity_id: sensor.living_room_room_state
state: 'off'
- condition: state
entity_id: media_player.stue
state: 'on'
actions:
- action: media_player.volume_mute
data:
entity_id: media_player.stue
is_volume_muted: true
- alias: Room activity override on
id: room_activity_override_on
initial_state: true
mode: parallel
triggers:
trigger: state
entity_id:
- input_boolean.bathroom_activity_override
- input_boolean.bedroom_activity_override
- input_boolean.hallway_activity_override
- input_boolean.kitchen_activity_override
- input_boolean.living_room_activity_override
- input_boolean.office_activity_override
- input_boolean.workshop_activity_override
- input_boolean.balcony_activity_override
to: 'on'
actions:
- action: input_select.select_option
data:
entity_id: input_select.{{ trigger.entity_id.replace('input_boolean.', '').replace('_activity_override',
'') }}_room_state
option: active
- alias: sleep_state_bedtime
id: sleep_state_bedtime
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.rook_presence_delayed
to: 'on'
- trigger: state
entity_id: binary_sensor.bedtime
to: 'on'
conditions:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: state
entity_id: binary_sensor.bedtime
state: 'on'
- condition: state
entity_id: input_select.sleep_state
state: awake
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: bedtime
- alias: sleep_state_in_bed
id: sleep_state_in_bed
initial_state: true
triggers:
- trigger: state
entity_id: input_select.sleep_state
to: bedtime
- trigger: state
entity_id: binary_sensor.sovevarelse_gulv
to: 'off'
conditions:
condition: and
conditions:
- condition: state
entity_id: input_select.sleep_state
state: bedtime
- condition: state
entity_id: binary_sensor.sovevarelse_gulv
state: 'off'
- condition: state
entity_id: binary_sensor.sovevaerelse_motion
state: 'on'
- condition: state
entity_id: binary_sensor.sovevarelse_dor
state: 'off'
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: in bed
- alias: sleep_state_sleeping
id: sleep_state_sleeping
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_started
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_resumed
conditions:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: in bed
- condition: state
entity_id: input_select.sleep_state
state: paused
- condition: and
conditions:
- condition: state
entity_id: input_select.sleep_state
state: bedtime
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.sovevaerelse_motion
state: 'on'
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: sleeping
- alias: sleep_state_sleeping_cancelled
id: sleep_state_sleeping_cancelled
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_stopped
conditions:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: time
after: '20:00:00'
before: 04:00:00
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: sleeping
- condition: state
entity_id: input_select.sleep_state
state: paused
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: in bed
- alias: sleep_state_paused_event
id: sleep_state_paused_event
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_paused
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: state
entity_id: input_select.sleep_state
state: sleeping
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: paused
- alias: sleep_state_paused
id: sleep_state_paused
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.sovevarelse_gulv
to: 'on'
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: state
entity_id: input_select.sleep_state
state: sleeping
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: paused
- alias: sleep_state_unpause
id: sleep_state_unpause
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.sovevarelse_gulv
to: 'off'
conditions:
- condition: state
entity_id: input_select.sleep_state
state: paused
- condition: state
entity_id: binary_sensor.sovevaerelse_motion
state: 'on'
- condition: state
entity_id: binary_sensor.sovevarelse_dor
state: 'off'
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: sleeping
- alias: sleep_state_smart_wake
id: sleep_state_smart_wake
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: smart_period
conditions:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: in bed
- condition: state
entity_id: input_select.sleep_state
state: sleeping
- condition: state
entity_id: input_select.sleep_state
state: paused
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: smart wake
- alias: sleep_state_alarm
id: sleep_state_alarm
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: alarm_alert_start
conditions:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: in bed
- condition: state
entity_id: input_select.sleep_state
state: sleeping
- condition: state
entity_id: input_select.sleep_state
state: paused
- condition: state
entity_id: input_select.sleep_state
state: smart wake
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: alarm
- alias: sleep_state_snoozing
id: sleep_state_snoozing
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: alarm_snooze_clicked
actions:
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'on'
- condition: state
entity_id: input_select.sleep_state
state: alarm
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: snoozing
- alias: sleep_state_waking
id: sleep_state_waking
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: alarm_alert_dismiss
- trigger: event
event_type: sleep_as_android
event_data:
event: alarm_snooze_cancelled
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_stopped
conditions:
condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: alarm
- condition: state
entity_id: input_select.sleep_state
state: snoozing
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: waking
- alias: sleep_state_awake
id: sleep_state_awake
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.gang_entre_bevaegelse
- binary_sensor.gang_badevaerelse_bevaegelse
to: 'on'
- trigger: state
entity_id: binary_sensor.sovevarelse_dor
to: 'on'
conditions:
- condition: state
entity_id: binary_sensor.sovevarelse_dor
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.gang_entre_bevaegelse
state: 'on'
- condition: state
entity_id: binary_sensor.gang_badevaerelse_bevaegelse
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: alarm
- condition: state
entity_id: input_select.sleep_state
state: snoozing
- condition: state
entity_id: input_select.sleep_state
state: waking
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: awake
- alias: winddown_action
id: 32b08820-d50d-4a06-a0a6-7678e16a0112
initial_state: true
triggers:
trigger: numeric_state
entity_id: sensor.minutes_to_bedtime
below: 31
conditions:
- condition: state
entity_id: input_select.sleep_state
state: awake
actions:
- action: notify.telegram_darkfox
data:
message: Det er snart sengetid! Du har {{ states('sensor.minutes_to_bedtime')
}} minutter til at afslutte hvad du laver. Alarmen ringer kl. {{ states('sensor.wake_up_time_clock')
}}.
- alias: winddown_action_2
id: 27d962dd-56b7-4bc6-a857-c562a6eaca63
initial_state: true
triggers:
trigger: numeric_state
entity_id: sensor.minutes_to_bedtime
below: 16
conditions:
- condition: state
entity_id: input_select.sleep_state
state: awake
actions:
- parallel:
- action: script.notify_text
data:
message_title: Det er snart sengetid!
message: Du har kun {{ states('sensor.minutes_to_bedtime') }} minutter til
at afslutte hvad du laver. Alarmen ringer kl. {{ states('sensor.wake_up_time_clock')
}}.
- event: set_light_profile
event_data:
room: bedroom
profile: Ambient
transition_time: 900
- alias: bedtime_action
id: bedtime_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: bedtime
actions:
- action: script.notify_text
data:
message_title: Sengetid!
message: Tid til at gå i gang med sengetidsrutinen! Alarm kl. {{ states('sensor.wake_up_time_clock')
}}
- event: set_light_profile
event_data:
room: bedroom
profile: Ambient
transition_time: 300
- alias: past_bedtime_action
id: 4c56b511-63c9-4ee3-b1e9-3ceddebd6995
initial_state: true
triggers:
trigger: numeric_state
entity_id: sensor.minutes_to_bedtime
below: -15
conditions:
- condition: state
entity_id: input_select.sleep_state
state: bedtime
- condition: state
entity_id: binary_sensor.kitchen_active
state: 'off'
- condition: state
entity_id: binary_sensor.bathroom_active
state: 'off'
- condition: state
entity_id: binary_sensor.sovevarelse_active
state: 'off'
actions:
- action: script.notify_text
data:
message_title: Du er for sent i seng!
message: Du er for sent i seng, det er nu {{ states('sensor.minutes_to_bedtime')
}} minutter siden du skulle være gået i gang med sengetidsrutinen. Alarmen
ringer kl. {{ states('sensor.wake_up_time_clock') }}.
- event: set_light_profile
event_data:
room: bedroom
profile: Night
transition_time: 120
- action: script.pause_all_media
- condition: state
entity_id: input_boolean.strict_bedtime
state: 'on'
- action: script.notify_text
data:
message_title: Streng Sengetid
message: Streng sengetid er slået til, enheder slukkes automatisk om 15 minutter.
- alias: way_past_bedtime_action
id: 63924853-ef16-4329-9706-da461362527d
initial_state: true
triggers:
trigger: numeric_state
entity_id: sensor.minutes_to_bedtime
below: -30
conditions:
- condition: state
entity_id: input_select.sleep_state
state: bedtime
- condition: state
entity_id: binary_sensor.kitchen_active
state: 'off'
- condition: state
entity_id: binary_sensor.bathroom_active
state: 'off'
- condition: state
entity_id: binary_sensor.sovevarelse_active
state: 'off'
actions:
- parallel:
- action: script.notify_text
data:
message_title: Du er meget for sent i seng!
message: Du er meget for sent i seng, det er nu {{ states('sensor.minutes_to_bedtime')
}} minutter siden du skulle være gået i gang med sengetidsrutinen. Alarmen
ringer kl. {{ states('sensor.wake_up_time_clock') }}.
- event: set_light_profile
event_data:
room: bedroom
profile: Night
transition_time: 120
- action: script.pause_all_media
- condition: state
entity_id: input_boolean.strict_bedtime
state: 'on'
- action: script.notify_text
data:
message_title: Streng Sengetid
message: Streng sengetid er slået til, enheder slukkes automatisk.
- action: home_assistant.turn_off
target:
entity_id:
- switch.stue_tv
- switch.rook_pc
- alias: in_bed_action
id: in_bed_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: in bed
variables:
wake_up_time: '{{ states(''sensor.wake_up_time_clock'') }}'
actions:
- parallel:
- action: script.turn_on
continue_on_error: true
target:
entity_id: script.sleep_as_android_set_alarm
data:
variables:
message: HA
timehour: '{{ wake_up_time.split('':'')[0] }}'
timemin: '{{ wake_up_time.split('':'')[1] }}'
- action: script.voice_broadcast
continue_on_error: true
data:
entity_id: media_player.sovevaerelse
volume_level: 0.08
message: "{%- set events = state_attr((\n 'sensor.agenda' if now().strftime('%H')|int\
\ < 10\n else 'sensor.agenda_tomorrow'\n ), 'events') | selectattr('routine',\
\ 'false') |list -%}\nAlarm sat til klokken {{ wake_up_time }}.\n{% if events\
\ -%} På kalenderen i morgen har du følgende: {% for event in events -%}\n\
\ {%- set start = (event.start | as_datetime) -%}\n {%- set end =\
\ (event.end | as_datetime) -%}\n {%- set start_time = start.strftime('%H:%M')\
\ -%}\n {%- set end_time = end.strftime('%H:%M') -%}\n {%- set start_day\
\ = start.weekday() -%}\n {%- set end_day = end.weekday() -%}\n {%-\
\ if event.current -%}\n - Lige nu: {{ event.summary }} indtil {{ state_attr('sensor.day_name',\
\ 'weekday_names')[end_day] if end_day != start_day }} kl. {{ end_time }}\n\
\ {%- else -%}\n - {{ start_time }} - {{ end_time }}: {{ event.summary\
\ }}\n {%- endif -%}\n{% endfor %} {% else -%} Du har ingen aftaler i\
\ kalenderen i morgen. {% endif %}"
- event: set_light_profile
event_data:
room: bedroom
profile: Ambient
transition_time: 120.0
- alias: sleeping_action
id: sleeping_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: sleeping
from: in bed
actions:
- action: switch.turn_on
target:
entity_id: switch.dorklokke_forstyr_ikke
- choose:
- conditions:
- condition: state
entity_id: input_select.sleep_as_android_state
state: awake
sequence:
- action: script.turn_on
target:
entity_id: script.sleep_as_android_start_tracking
- event: set_light_profile
event_data:
room: bedroom
profile: 'Off'
transition_time: 10.0
- alias: sleep_paused_action
id: sleep_paused_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: paused
actions:
- action: script.turn_on
target:
entity_id: script.sleep_as_android_pause_tracking
- event: set_light_profile
event_data:
room: bedroom
profile: Night
- alias: resume_sleep_action
id: resume_sleep_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: sleeping
from: paused
actions:
- action: script.turn_on
target:
entity_id: script.sleep_as_android_start_tracking
- event: set_light_profile
event_data:
room: bedroom
profile: 'Off'
- alias: smart_wake_action
id: smart_wake_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: smart wake
actions:
- event: set_light_profile
event_data:
room: bedroom
profile: Night
transition_time: 300
- action: switch.turn_off
target:
entity_id: switch.dorklokke_forstyr_ikke
- alias: Smart Wake Media Action
id: 6fabaa3a-aac3-4b0d-b4aa-76890922f4f0
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: smart wake
actions:
- action: media_player.unjoin
target:
entity_id:
- media_player.sovevaerelse
- media_player.badevaerelse
- media_player.kokken
- media_player.kontor
- media_player.stue
- media_player.roam
- action: media_player.volume_set
data:
entity_id:
- media_player.sovevaerelse
volume_level: 0.01
- delay:
seconds: 1
- action: script.mass_playlist
data:
entity_id: media_player.sovevaerelse_mass
repeat_mode: all
playlist:
- I Love Chillhop
- alias: Smart Wake Action Delayed
id: 84d6b64e-0e23-4a77-baf9-dfc7cfe9d100
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: smart wake
for:
minutes: 30
actions:
- event: set_light_profile
event_data:
room: bedroom
profile: Ambient
transition_time: 300
- action: media_player.volume_set
data:
entity_id:
- media_player.sovevaerelse
volume_level: 0.02
- alias: alarm_action
id: alarm_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: alarm
actions:
- action: switch.turn_off
target:
entity_id: switch.dorklokke_forstyr_ikke
- event: set_light_profile
event_data:
room: bedroom
profile: Ambient
transition_time: 300
- delay:
minutes: 5
- condition: state
entity_id: input_select.sleep_state
state:
- alarm
- snoozing
- waking
- event: set_light_profile
event_data:
room: bedroom
profile: Dimmed
transition_time: 300
- condition: state
entity_id: sun.sun
state: above_horizon
- alias: snooze_action_media
id: f025618f-e3ae-428e-b22a-7df121b56a44
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: snooze
actions:
- action: media_player.unjoin
target:
entity_id:
- media_player.sovevaerelse
- media_player.badevaerelse
- media_player.kokken
- media_player.kontor
- media_player.stue
- media_player.roam
- action: media_player.volume_set
data:
entity_id:
- media_player.sovevaerelse
volume_level: 0.2
- delay:
seconds: 1
- action: script.mass_playlist
data:
entity_id: media_player.sovevaerelse_mass
repeat_mode: all
playlist:
- Chillhop Radio
- delay:
minutes: 10
- condition: state
entity_id: input_select.sleep_state
state:
- alarm
- snoozing
- action: media_player.volume_set
data:
entity_id: media_player.sovevaerelse
volume_level: 0.3
- alias: waking_action_media
id: waking_action_media
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: waking
actions:
- action: script.mass_playlist
data:
entity_id: media_player.sovevaerelse_mass
repeat_mode: all
playlist:
- '{{ states(''sensor.podcast_radioavisen'') }}'
- I Love Chillhop
- action: media_player.volume_set
data:
entity_id:
- media_player.sovevaerelse
volume_level: 0.3
- alias: waking_action
id: waking_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: waking
actions:
- parallel:
- action: input_text.set_value
target:
entity_id: input_text.last_wake_up_time
data:
value: '{{ now().isoformat() }}'
- event: set_light_profile
event_data:
room: bedroom
profile: Dimmed
transition_time: 120.0
- action: switch.turn_off
target:
entity_id: switch.dorklokke_forstyr_ikke
- alias: awake_action_media
id: awake_action_media
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: awake
from: waking
actions:
- action: media_player.join
target:
entity_id: media_player.badevaerelse
data:
group_members: "[\n \"media_player.sovevaerelse\"\n {{ ', \"media_player.kokken\"\
' if is_state('input_boolean.guests', 'off') }}\n {{ ', \"media_player.roam\"\
' if is_state('input_boolean.guests', 'off') and not is_state('media_player.roam',\
\ 'unavailable') }}\n]"
- action: script.mass_briefing_playlist
data:
entity_id: media_player.badevaerelse_mass
volume_level: 0.5
playlist:
- '{{ states(''sensor.podcast_radioavisen'') }}'
- '{{ states(''sensor.podcast_dw_news_brief'') }}'
- '{{ states(''sensor.podcast_daily_tech_headlines'') }}'
- '{{ states(''sensor.podcast_daily_tech_news_show'') }}'
- I Love Chillhop
- wait_template: '{{ is_state(''media_player.badevaerelse'', ''playing'') }}'
timeout: 00:00:30
- action: media_player.volume_set
data:
entity_id: '["media_player.badevaerelse", "media_player.sovevaerelse" {{ '',
"media_player.kokken"'' if is_state(''input_boolean.guests'', ''off'') }}]'
volume_level: 0.5
- delay:
minutes: 2
- action: media_player.volume_set
data:
entity_id: '["media_player.badevaerelse", "media_player.sovevaerelse" {{ '',
"media_player.kokken"'' if is_state(''input_boolean.guests'', ''off'') }}]'
volume_level: 0.6
- alias: awake_action
id: awake_action
initial_state: true
triggers:
trigger: state
entity_id: input_select.sleep_state
to: awake
from: waking
actions:
- parallel:
- action: switch.turn_off
target:
entity_id: switch.dorklokke_forstyr_ikke
- action: script.turn_on
target:
entity_id: script.sleep_as_android_stop_tracking
- action: script.turn_on
target:
entity_id: script.sleep_as_android_dismiss_alarm
- event: set_light_profile
event_data:
room:
- bedroom
- bathroom
profile: Dimmed
transition_time: 120.0
- delay:
minutes: 3
- event: set_light_profile
event_data:
room:
- bedroom
- bathroom
profile: Default
transition_time: 120.0
- id: pause_tablet_on_sleep
alias: Pause Tablet On Sleep
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: light_sleep
- trigger: event
event_type: sleep_as_android
event_data:
event: deep_sleep
- trigger: event
event_type: sleep_as_android
event_data:
event: rem
conditions:
- alias: Media is playing on tablet
condition: state
entity_id: binary_sensor.foxtablet_music_active
state: 'on'
actions:
- action: notify.mobile_app_foxtablet
data:
message: command_media
data:
ttl: 0
priority: high
media_command: pause
media_package_name: "{% set found = false %} {% for key, value in states.sensor.foxtablet_media_session.attributes.items()\
\ %}\n {% if not found and key.startswith('playback_state_') and value\
\ == 'Playing' %}\n {{ key | replace('playback_state_', '') }}\n\
\ {% set found = true %}\n {% endif %}\n{% endfor %}"
- alias: Turn on tablet extra dim on sleep
id: 10d61b0d-3f8e-40ea-8393-6058c79b189c
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_started
actions:
- action: script.trigger_tasker_task
data:
action: notify.mobile_app_foxtablet
task_id: SET_EXTRA_DIM
extra_data: state:true
- alias: Turn off tablet extra dim on waking
id: 1e67b4e2-cae9-4942-b465-41381052fc4b
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_stopped
actions:
- action: script.trigger_tasker_task
data:
action: notify.mobile_app_foxtablet
task_id: SET_EXTRA_DIM
extra_data: state:false
- id: turn_off_fan_on_sleep
alias: turn_off_fan_on_sleep
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: deep_sleep
- trigger: event
event_type: sleep_as_android
event_data:
event: rem
- trigger: state
entity_id: input_select.sleep_state
to: awake
actions:
- alias: turn off fans
action: fan.turn_off
target:
entity_id:
- fan.sovevaerelse_blaeser
- alias: Turn on fans in the morning if it's too warm
id: 27c977e6-9811-40dd-b11c-10d1447c2833
initial_state: true
mode: single
triggers:
- trigger: state
entity_id:
- input_select.sleep_state
- sensor.sovevaerelse_summer_simmer_perception
not_to:
- unavailable
- unknown
conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_select.sleep_state
state:
- smart wake
- alarm
- snoozing
- waking
- condition: state
entity_id: sensor.sovevaerelse_summer_simmer_perception
state:
- slightly_warm
- increasing_discomfort
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.sleep_state
state: awake
- condition: state
entity_id: sensor.sovevaerelse_summer_simmer_perception
state:
- extremely_warm
- danger_of_heatstroke
- extreme_danger_of_heatstroke
- circulatory_collapse_imminent
actions:
- action: fan.turn_on
data:
entity_id:
- fan.sovevaerelse_blaeser
- action: climate.set_temperature
data:
temperature: 20
hvac_mode: heat_cool
target:
entity_id: climate.aircondition
- id: notify_phone_not_charging_on_sleep
alias: Notify phone not charging on sleep
initial_state: true
mode: single
triggers:
- trigger: state
entity_id: input_select.sleep_state
to: sleeping
- trigger: state
entity_id: sensor.darkphone_charger_type
to: none
for:
seconds: 10
- trigger: state
entity_id: binary_sensor.darkphone_interactive
to: 'off'
for:
seconds: 10
conditions:
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_state
state: sleeping
- condition: state
entity_id: sensor.darkphone_charger_type
state: none
- condition: state
entity_id: binary_sensor.darkphone_interactive
state: 'off'
actions:
- action: script.darkphone_tts
data:
message: Din telefon lader ikke. Husk at sætte den i laderen.
severity: 3
- delay:
minutes: 5
- id: update_vacuum_last_clean
alias: Update Vacuum Last Clean
initial_state: true
triggers:
- trigger: state
entity_id: vacuum.valetudo_roborocks5
from: cleaning
actions:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.vacuum_last_clean
data:
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
- id: vacuum_show_menu_when_undocked
alias: Vacuum Show Menu When Undocked
initial_state: true
triggers:
- trigger: state
entity_id: vacuum.valetudo_roborocks5
to:
- cleaning
- paused
- idle
- returning
- error
actions:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.vacuum_show_card
- id: vacuum_hide_menu_when_docked
alias: Vacuum Hide Menu When Docked
initial_state: true
triggers:
- trigger: state
entity_id: vacuum.valetudo_roborocks5
to: docked
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.vacuum_show_card
- id: vacuum_while_away
alias: Vacuum While Away
initial_state: true
triggers:
- trigger: time_pattern
hours: '11'
minutes: /5
seconds: '0'
- trigger: time_pattern
hours: '15'
minutes: /5
seconds: '0'
conditions:
- condition: state
entity_id:
- calendar.helligdage
- input_boolean.guests
state: 'off'
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: binary_sensor.rook_presence_delayed
state: 'off'
- condition: template
alias: At least 8 hours since last clean
value_template: '{{ states(''input_datetime.vacuum_last_clean'')|as_timestamp
< now()|as_timestamp - 8*60*60 }}'
actions:
- action: vacuum.start
target:
entity_id: vacuum.valetudo_roborocks5
- id: vacuum_stop_before_coming_home
alias: Vacuum Stop Before Coming Home
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.rook_home_soon
from: 'off'
to: 'on'
for:
minutes: 5
- trigger: state
entity_id: binary_sensor.rook_presence
from: 'off'
to: 'on'
for:
minutes: 1
actions:
- alias: Go to empty position if more than 120m2 since last empty
choose:
- conditions:
- condition: template
value_template: '{{ states(''sensor.vacuum_area_cleaned_since_last_empty'')|int
> states(''input_number.vacuum_m2_before_empty'')|int }}'
sequence:
- action: script.send_vacuum_to_emptying_position
default:
- condition: template
value_template: '{{ not is_state(''vacuum.valetudo_roborocks5'', ''docked'')
}}'
- action: vacuum.return_to_base
- alias: Puzzel Robot
id: c3d79ebf-18c1-4e2a-8776-a7fdddf87de1
triggers:
- trigger: state
entity_id: binary_sensor.puzzel_state_incorrect
to: 'on'
for:
seconds: 10
- trigger: state
entity_id: binary_sensor.location_at_work
for:
minutes: 5
- trigger: time_pattern
minutes: /30
conditions:
- condition: state
entity_id: binary_sensor.puzzel_state_incorrect
state: 'on'
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.puzzel_expected_state
state: 'on'
- condition: state
entity_id: binary_sensor.location_at_work
state: 'on'
sequence:
- action: script.puzzel_log_on
data:
queue_id: "{% set current_profile_id = state_attr('sensor.puzzel_ko', 'profile_id')|int\
\ %} {% set expected_profiles = state_attr('binary_sensor.puzzel_expected_state',\
\ 'any') %} {% set current_queue_matched = expected_profiles | selectattr('id',\
\ 'eq', current_profile_id) | first %} {% if current_queue_matched %}\n\
\ {{ current_queue_matched.id }}\n{% else %}\n {{ (expected_profiles\
\ | first).id }}\n{% endif %}"
- conditions:
- condition: state
entity_id: binary_sensor.puzzel_expected_state
state: 'on'
- condition: state
entity_id: binary_sensor.location_at_work
state: 'off'
sequence:
- action: script.notify_darkphone
data:
message: Log på Puzzel?
data:
inline_keyboard: "{% set ns = namespace(ret=[]) %} {% for profile in state_attr('binary_sensor.puzzel_expected_state',\
\ 'any') | sort(attribute='name') %}\n {% set ns.ret = ns.ret + [profile.name\
\ + ':/puzzel_login '+(profile.id|string)] %}\n{% endfor %} {{ ns.ret\
\ + ['Ignorer:/puzzel_ignore_incorrect'] }}"
- conditions:
- condition: state
entity_id: binary_sensor.puzzel_status
state: 'on'
- condition: state
entity_id: binary_sensor.location_at_work
state: 'on'
sequence:
- action: script.notify_darkphone
data:
message: Du er stadig logget på Puzzel
data:
inline_keyboard: '{{ [''Log af:/puzzel_log_off'', ''Ignorer:/puzzel_ignore_incorrect'']
}}'
- conditions:
- condition: state
entity_id: binary_sensor.puzzel_status
state: 'on'
- condition: state
entity_id: binary_sensor.location_at_work
state: 'off'
sequence:
- action: script.puzzel_log_off
- alias: Ignore Incorrect Puzzel State
id: 9b773b63-18d4-4c98-b743-683bc9d5cad9
initial_state: true
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /puzzel_ignore_incorrect
- trigger: event
event_type: telegram_command
event_data:
command: /puzzel_ignore_incorrect
actions:
- action: script.ignore_incorrect_puzzel_state
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: Ignorerer forkert Puzzel status indtil næste skift
- alias: Reset Ignore Incorrect Puzzel State
id: efca9026-7293-4d95-8ae9-7cc084b3e244
triggers:
- trigger: state
entity_id: binary_sensor.puzzel_state_incorrect
not_from:
- unknown
- unavailable
actions:
- action: script.reset_ignore_incorrect_puzzel_state
- id: set_work_phone_modes
initial_state: true
alias: Set Work Phone Modes
mode: queued
triggers:
- trigger: state
entity_id: sensor.arbejdstelefon_phone_state
to:
- ringing
- offhook
- trigger: state
entity_id:
- binary_sensor.working
- sensor.arbejdstelefon_do_not_disturb_sensor
- sensor.arbejdstelefon_ringer_mode
actions:
- choose:
- conditions:
- alias: Prevent silencing phone when on call or at work
condition: template
value_template: "{{\n is_state('binary_sensor.working', 'on')\n}}"
sequence:
- action: notify.mobile_app_arbejdstelefon
data:
message: command_ringer_mode
data:
command: normal
ttl: 0
priority: high
- action: notify.mobile_app_arbejdstelefon
data:
message: command_dnd
data:
command: 'off'
ttl: 0
priority: high
- conditions:
- alias: Silence phone when going off call/work
condition: template
value_template: "{{\n is_state('binary_sensor.working', 'off')\n}}"
sequence:
- action: notify.mobile_app_arbejdstelefon
data:
message: command_ringer_mode
data:
command: vibrate
ttl: 0
priority: high
- action: notify.mobile_app_arbejdstelefon
data:
message: command_dnd
data:
command: priority_only
ttl: 0
priority: high
- id: update_3d_printer_model_image_on_file_change
alias: Update 3D Printer Model Image On File Change
triggers:
- trigger: state
entity_id: sensor.octoprint_print_file
actions:
- action: script.turn_on
target:
entity_id: script.update_model_image
- id: set_3d_printer_last_started
alias: Set 3D Printer Last Started
triggers:
- trigger: state
entity_id: sensor.octoprint_start_time
not_to:
- unavailable
- unknown
actions:
- action: input_text.set_value
data:
entity_id: input_text.3d_printer_last_started
value: '{{ states(''sensor.octoprint_start_time'') }}'
- action: input_text.set_value
data:
entity_id: input_text.3d_printer_last_ended
value: ''
- id: set_3d_printer_last_ended
alias: Set 3D Printer Last Ended
triggers:
- trigger: state
entity_id: sensor.octoprint_start_time
to: unknown
actions:
- action: input_text.set_value
data:
entity_id: input_text.3d_printer_last_ended
value: '{{ now() }}'
- alias: Update Personal Calendar
id: 16e9122a-c1c4-4966-9040-1dc133e2e009
initial_state: true
mode: restart
triggers:
- trigger: time_pattern
hours: '*'
minutes: /15
seconds: '0'
- trigger: state
entity_id: calendar.calendar
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
for:
seconds: 10
- trigger: state
entity_id: sensor.calendar_regexes
conditions:
- condition: state
entity_id: sensor.calendar_regexes
state: OK
variables:
calendar_entity: calendar.calendar
calendar_name: Personlig Kalender
regexes: '{{ states.sensor.calendar_regexes.attributes }}'
bool_attrs:
travel: '{{ [regexes.transit, regexes.bil] }}'
bil: '{{ [regexes.bil] }}'
transit: '{{ [regexes.transit] }}'
guests: '{{ [regexes.guests] }}'
wake: '{{ [{''negate'': true, ''regex'': ''.*(#nowake).*''}] }}'
routine: '{{ [regexes.routine] }}'
actions:
- action: calendar.get_events
data:
start_date_time: '{{ now().strftime(''%Y-%m-%d'') }} 00:00:00'
end_date_time: '{{ (now() + timedelta(days=7)).strftime(''%Y-%m-%d'') }} 23:59:59'
target:
entity_id: '{{ calendar_entity }}'
response_variable: all_events
- variables:
agenda_events: '{%- from ''agenda.jinja'' import agenda_events -%}
{{ agenda_events(all_events, calendar_entity, calendar_name, regexes, bool_attrs)
}}
'
- event: calendar_updated
event_data:
calendar: '{{ calendar_name }}'
time: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
events: '{{ agenda_events }}'
- alias: Update Work Calendar
id: ada86b2e-be99-4b82-b53f-da58547a0b3c
initial_state: true
mode: restart
triggers:
- trigger: time_pattern
hours: '*'
minutes: /15
seconds: '0'
- trigger: state
entity_id: calendar.arbejdskalender
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
for:
seconds: 10
- trigger: state
entity_id: sensor.calendar_regexes
variables:
calendar_entity: calendar.arbejdskalender
calendar_name: Arbejdskalender
regexes: '{{ states.sensor.calendar_regexes.attributes }}'
bool_attrs:
travel: '{{ [regexes.transit, regexes.work_bil, regexes.bil] }}'
bil: '{{ [regexes.work_bil, regexes.bil] }}'
wake: '{{ [regexes.work_bil, regexes.bil, regexes.wfh] }}'
routine: '{{ [regexes.routine] }}'
vagtskema: '{{ [regexes.vagtskema] }}'
vagt: '{{ [regexes.vagt] }}'
on_site: '{{ [regexes.on_site] }}'
off_site: '{{ [regexes.off_site] }}'
rsr: '{{ [regexes.rsr] }}'
rsh: '{{ [regexes.rsh] }}'
wfh: '{{ [regexes.wfh] }}'
ferie: '{{ [regexes.ferie] }}'
actions:
- action: calendar.get_events
data:
start_date_time: '{{ now().strftime(''%Y-%m-%d'') }} 00:00:00'
end_date_time: '{{ (now() + timedelta(days=7)).strftime(''%Y-%m-%d'') }} 23:59:59'
target:
entity_id: '{{ calendar_entity}}'
response_variable: all_events
- variables:
agenda_events: '{%- from ''agenda.jinja'' import agenda_events -%}
{{ agenda_events(all_events, calendar_entity, calendar_name, regexes, bool_attrs)
}}
'
- event: calendar_updated
event_data:
calendar: '{{ calendar_name }}'
time: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
events: '{{ agenda_events }}'
- alias: Update Work Schedule
id: e565f087-c440-4619-ab51-b18d535dbfac
initial_state: true
mode: restart
triggers:
- trigger: time_pattern
hours: '*'
minutes: /15
seconds: '0'
- trigger: state
entity_id: calendar.vagtplan
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
for:
seconds: 10
- trigger: state
entity_id: sensor.calendar_regexes
variables:
calendar_entity: calendar.vagtplan
calendar_name: Vagtplan
regexes: '{{ states.sensor.calendar_regexes.attributes }}'
actions:
- action: calendar.get_events
data:
start_date_time: '{{ now().strftime(''%Y-%m-%d'') }} 00:00:00'
end_date_time: '{{ (now() + timedelta(days=15)).strftime(''%Y-%m-%d'') }} 23:59:59'
target:
entity_id: '{{ calendar_entity }}'
response_variable: all_events
- variables:
agenda_events: '{%- from ''agenda.jinja'' import agenda_events -%}
{%- from ''work_schedule.jinja'' import parse_work_schedule_event -%}
{{ agenda_events(all_events, calendar_entity, calendar_name, regexes, preprocessor=parse_work_schedule_event)
}}
'
- event: calendar_updated
event_data:
calendar: '{{ calendar_name }}'
time: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
events: '{{ agenda_events }}'
- alias: Update Tripit Calendar
id: fdab31ae-dbd7-4808-a671-6fa05e331a59
initial_state: true
triggers:
- trigger: time_pattern
hours: '*'
minutes: /15
seconds: '0'
- trigger: state
entity_id: calendar.tripit
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
for:
seconds: 10
- trigger: state
entity_id: sensor.calendar_regexes
variables:
calendar_entity: calendar.tripit
calendar_name: Tripit Kalender
regexes: '{{ states.sensor.calendar_regexes.attributes }}'
bool_attrs:
travel: '{{ [regexes.transit, regexes.bil] }}'
bil: '{{ [regexes.bil] }}'
transit: '{{ [regexes.transit] }}'
wake: '{{ [{''negate'': true, ''regex'': ''.*( Eberhardt is in ).*''}] }}'
routine: '{{ [regexes.routine] }}'
attrs:
type: '\[(.+)\](?: (?:.+) -)* (?:.+) to (?:.+)'
carrier: '\[(?:.+)\](?: (.+) -)* (?:.+) to (?:.+)'
from: '\[(?:.+)\](?: (?:.+) -)* (.+) to (?:.+)'
to: '\[(?:.+)\](?: (?:.+) -)* (?:.+) to (.+)'
actions:
- action: calendar.get_events
data:
start_date_time: '{{ now().strftime(''%Y-%m-%d'') }} 00:00:00'
end_date_time: '{{ (now() + timedelta(days=7)).strftime(''%Y-%m-%d'') }} 23:59:59'
target:
entity_id: '{{ calendar_entity}}'
response_variable: all_events
- variables:
agenda_events: '{%- from ''agenda.jinja'' import agenda_events -%}
{{ agenda_events(all_events, calendar_entity, calendar_name, regexes, bool_attrs,
attrs) }}
'
- event: calendar_updated
event_data:
calendar: '{{ calendar_name }}'
time: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
events: '{{ agenda_events }}'
- alias: get_dmi_weather_report
id: 55586488-6ce5-429b-84c5-ce84f17f5c8b
initial_state: true
mode: restart
triggers:
- trigger: time_pattern
minutes: /15
actions:
- action: script.run_pyscript
data:
action: pyscript.get_dmi_weather_report
data:
location_id: secret dmi_location_id
- alias: get_dmi_severe_weather_warnings
id: 4db44655-fc7d-4808-b8fd-90ada6708c54
initial_state: true
mode: restart
triggers:
- trigger: time_pattern
minutes: /15
actions:
- action: script.run_pyscript
data:
action: pyscript.get_dmi_severe_weather_warnings
data:
location_id: secret dmi_location_id
- alias: download_dmi_warning_icon
id: 6f7e8d9a-0b1c-2d3e-4f5g-6h7i8j9k0l1m
initial_state: true
mode: single
triggers:
- trigger: state
entity_id: sensor.dmi_aktuel_varsel
attribute: icon_file
not_to: ''
actions:
- action: downloader.download_file
data:
url: https://www.dmi.dk/fileadmin/assets/Varselsikoner/{{ state_attr('sensor.dmi_aktuel_varsel',
'icon_file') }}
subdir: dmi_warning_icons
overwrite: true
- alias: Broadcast Weather Forecast
id: c220f137-3ea0-4a9e-9531-5db7e025168c
initial_state: true
mode: single
triggers:
trigger: state
entity_id: weather.forecast_home
actions:
- action: weather.get_forecasts
response_variable: forecast
target:
entity_id: weather.forecast_home
data:
type: hourly
- event: weather_forecast
event_data:
entity_id: weather.forecast_home
forecast: '{{ forecast.get(''weather.forecast_home'', {}).get(''forecast'',
[]) }}'
- alias: lightning_warning
id: 7abec12c-5464-4934-93aa-6decdc94186a
initial_state: true
mode: single
triggers:
trigger: template
value_template: "{{\n not is_state('sensor.blitzortung_lightning_distance', 'unknown')\n\
\ and not is_state('sensor.blitzortung_lightning_distance', 'unavailable')\n\
\ and (states('sensor.blitzortung_lightning_distance') | int) < 10\n}}"
actions:
- action: script.notify_darkphone
data:
message_title: 'Vejr Varsel: Torden'
message: Lynnedslag {{ states('sensor.blitzortung_lightning_distance') }} {{
state_attr('sensor.blitzortung_lightning_distance', 'unit_of_measurement')
}} væk.
- delay:
minutes: 10
- alias: Kettle Set Keep Warm
id: e463a349-ae3b-41be-8d29-3fbc75d4e5ed
initial_state: true
triggers:
- trigger: state
entity_id: number.elkedel_varmholdningstid
- trigger: state
entity_id: binary_sensor.elkedel_brygger
to: 'on'
condition:
- condition: numeric_state
entity_id: number.elkedel_varmholdningstid
above: 0
- condition: state
entity_id: binary_sensor.elkedel_brygger
state: 'on'
action:
- action: switch.turn_on
target:
entity_id: switch.elkedel_varmholdning
- alias: Kettle Reset Keep Warm Time
id: b85c1cdb-f8dd-4680-8101-cdc9919a60f2
initial_state: true
triggers:
- trigger: state
entity_id: switch.elkedel
to: 'off'
action:
- action: number.set_value
target:
entity_id: number.elkedel_varmholdningstid
data:
value: 0
- id: kettle_brewing_notification
alias: Elkedel Brygger Notifikation
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.elkedel_brygger
from: 'off'
to: 'on'
actions:
- action: notify.telegram_darkfox
data:
message: Elkedel brygger
- id: kettle_done_notification
alias: Elkedel Færdig Notifikation
initial_state: true
triggers:
trigger: state
entity_id: binary_sensor.elkedel_brygger
from: 'on'
to: 'off'
actions:
- action: script.notify_everywhere
data:
message: Elkedel færdig{{ ' og holder varm i ' + (states('number.elkedel_varmholdningstid')
| int) + ' minutter' if states('sensor.elkedel_status') == 'Holder varm' else
'' }}.
- alias: Pause Media On Phone Call
id: pause_media_on_phone_call
initial_state: true
triggers:
- trigger: state
entity_id:
- sensor.arbejdstelefon_phone_state
- sensor.darkphone_phone_state
to:
- ringing
- offhook
from: idle
conditions:
- condition: state
entity_id: binary_sensor.rook_presence
state: 'on'
- condition: template
value_template: "{{\n trigger.to_state.entity_id == 'sensor.darkphone_phone_state'\n\
\ or is_state('binary_sensor.working', 'on')\n}}"
actions:
- action: script.turn_on
entity_id: script.pause_all_media
- alias: Unpause On Phone Call Finished
id: unpause_media_on_phone_call_finished
initial_state: true
triggers:
- trigger: state
entity_id:
- sensor.arbejdstelefon_phone_state
- sensor.darkphone_phone_state
to: idle
conditions:
- condition: state
entity_id: binary_sensor.rook_presence
state: 'on'
actions:
- action: script.turn_on
entity_id: script.resume_all_media
- alias: On Call Ringing While Sleeping
id: on_call_ringing_while_sleeping
initial_state: true
triggers:
- trigger: state
entity_id: sensor.arbejdstelefon_phone_state
to: ringing
conditions:
- condition: state
entity_id: binary_sensor.rook_presence
state: 'on'
- condition: state
entity_id: binary_sensor.on_call
state: 'on'
actions:
- choose:
- conditions:
- condition: state
entity_id: input_select.sleep_state
state:
- sleeping
- smart wake
sequence:
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: paused
- event: set_light_profile
event_data:
room: bedroom
profile: Night
- alias: On Call Picked Up
id: on_call_picked_up
initial_state: true
triggers:
- trigger: state
entity_id: sensor.arbejdstelefon_phone_state
to: offhook
conditions:
- condition: state
entity_id: binary_sensor.rook_presence
state: 'on'
- condition: state
entity_id: binary_sensor.on_call
state: 'on'
- condition: state
entity_id: input_select.sleep_state
state:
- sleeping
- smart wake
- paused
actions:
- event: set_light_profile
event_data:
room: bedroom
profile: Ambient
- delay:
seconds: 30
- condition: state
entity_id: sensor.arbejdstelefon_phone_state
state: offhook
- event: set_light_profile
event_data:
room: bedroom
profile: Dimmed
- alias: On Call Done
id: on_call_done
initial_state: true
triggers:
- trigger: state
entity_id: sensor.arbejdstelefon_phone_state
from: offhook
to: idle
for:
minutes: 2
- trigger: state
entity_id: device_tracker.pc074805
to: not_home
for:
seconds: 30
conditions:
- condition: state
entity_id: binary_sensor.rook_presence
state: 'on'
- condition: state
entity_id: binary_sensor.on_call
state: 'on'
- condition: state
entity_id: device_tracker.pc074805
state: not_home
- condition: state
entity_id: sensor.arbejdstelefon_phone_state
state: idle
actions:
- choose:
- conditions:
- condition: state
entity_id: input_select.sleep_state
state:
- paused
sequence:
- event: set_light_profile
event_data:
room: bedroom
profile: 'Off'
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: sleeping
- alias: On Call Not Picked Up
id: on_call_not_picked_up
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.work_phone_ringing
to: 'off'
for:
seconds: 5
conditions:
- condition: state
entity_id: sensor.arbejdstelefon_phone_state
state: idle
- condition: state
entity_id: binary_sensor.rook_presence
state: 'on'
- condition: state
entity_id: binary_sensor.on_call
state: 'on'
actions:
- choose:
- conditions:
- condition: state
entity_id: input_select.sleep_state
state:
- paused
sequence:
- event: set_light_profile
event_data:
room: bedroom
profile: 'Off'
- action: input_select.select_option
data:
entity_id: input_select.sleep_state
option: sleeping
- alias: Work phone caller lookup
id: work_phone_caller_lookup
initial_state: true
triggers:
- trigger: state
entity_id: input_text.work_phone_caller
conditions:
- condition: template
value_template: '{{ trigger.to_state.state not in ['''', ''unavailable'', ''unknown'']
}}'
- condition: state
entity_id: sensor.arbejdstelefon_phone_state
state:
- ringing
- offhook
actions:
- variables:
phone_number: '{{ states(''input_text.work_phone_caller'')[-8:] }}'
- action: script.puzzel_lookup_caller
response_variable: caller
data:
phone_number: '{{ phone_number }}'
- action: script.puzzel_get_current_request
response_variable: puzzel_request
- variables:
current_request: '{{ puzzel_request or {} }}'
actual_phone_number: '{{ current_request.get(''phone_number'', '''') or phone_number
}}'
actual_caller: '{{ current_request.get(''caller'', {}) or caller }}'
line: '{{ caller.get(''caller'', {}).get(''name'', '''') if current_request.get(''phone_number'')
else ''''}}'
- event: work_call_received
event_data:
phone_number: '{{ actual_phone_number }}'
caller_info: '{{ actual_caller }}'
line: '{{ line }}'
- alias: Work call picked up
id: work_call_picked_up
initial_state: true
triggers:
- trigger: state
entity_id: sensor.arbejdstelefon_phone_state
to: offhook
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.work_phone_picked_up
- alias: Work call ended
id: work_call_ended
initial_state: true
triggers:
- trigger: state
entity_id: sensor.arbejdstelefon_phone_state
to: idle
from:
- ringing
- offhook
actions:
- event: work_call_ended
event_data:
call_info:
phone_number: '{{ states(''sensor.current_work_call'') }}'
formatted_phone: '{{ state_attr(''sensor.current_work_call'', ''formatted_phone'')
}}'
caller_info: '{{ state_attr(''sensor.current_work_call'', ''caller_info'')
}}'
line: '{{ state_attr(''sensor.current_work_call'', ''line'') }}'
start: '{{ state_attr(''sensor.current_work_call'', ''start'') }}'
picked_up: '{{ is_state(''input_boolean.work_phone_picked_up'', ''on'') }}'
- action: input_text.set_value
data:
entity_id: input_text.work_phone_caller
value: ''
- action: input_boolean.turn_off
data:
entity_id: input_boolean.work_phone_picked_up
- alias: Notify Work Call
id: notify_work_call
initial_state: true
triggers:
- trigger: state
entity_id: sensor.current_work_call
conditions:
- condition: template
value_template: "{{\n trigger is defined\n and trigger\n and trigger.to_state\n\
\ and trigger.to_state.state\n and trigger.to_state.attributes\n and trigger.to_state.state\
\ not in ['unknown', 'unavailable', '']\n}}"
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.attributes.caller_info is not none and
trigger.to_state.attributes.caller_info != {} }}'
sequence:
- variables:
caller: '{{ trigger.to_state.attributes.caller_info }}'
name: '{{ caller.name }}'
title: '{{ caller.title }}'
email: '{{ caller.email }}'
organization: '{{ caller.organization }}'
formatted_phone: '{{ trigger.to_state.attributes.formatted_phone }}'
line: '{{ trigger.to_state.attributes.line }}'
- action: notify.mobile_app_arbejdstelefon
data:
title: '{{ name }}'
message: '{{ title }} hos {{ organization }}.
Tlf: {{ formatted_phone }}
Email: {{ email }}
{{ ''Linje: '' + line if line != '''' }}
'
data:
tag: puzzel_caller
channel: Puzzel Caller
importance: high
ttl: 0
priority: high
persistent: false
clickAction: noAction
notification_icon: mdi:phone-classic
- action: notify.telegram_darkfox
data:
message: 'Arbejdspkald fra {{ name }}
{{ title }} hos {{ organization }}.
Tlf: {{ formatted_phone }}
Email: {{ email }}
{{ ''Linje: '' + line if line != '''' }}
'
default:
- action: notify.telegram_darkfox
data:
message: 'Arbejdsopkald fra ukendt nummer: {{ trigger.to_state.attributes.formatted_phone
}}'
- alias: presence notification
id: 88f231b1-3ece-4832-89da-698a699887ce
triggers:
- trigger: state
entity_id: binary_sensor.rook_presence
from: 'on'
to: 'off'
- trigger: state
entity_id: binary_sensor.rook_presence
from: 'off'
to: 'on'
actions:
- action: script.debug_notification
data:
message: 'Presence: {{ states(''binary_sensor.rook_presence'') }}'
title: Presence
- alias: home soon notification
id: 86c36bf4-87dd-4a33-8f71-19ae84b98426
triggers:
- trigger: state
entity_id: binary_sensor.rook_home_soon
from: 'on'
to: 'off'
- trigger: state
entity_id: binary_sensor.rook_home_soon
from: 'off'
to: 'on'
actions:
- action: script.debug_notification
data:
message: 'Home Soon: {{ states(''binary_sensor.rook_home_soon'') }}'
title: Home Soon
- alias: Turn off away power saving devices
id: 533afc86-936c-45bc-92eb-dbb2e2a3a66e
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.rook_presence_delayed
to: 'off'
conditions:
- condition: state
entity_id: input_boolean.guests
state: 'off'
actions:
- repeat:
for_each: '{{ state_attr(''group.away_power_saving_devices'', ''entity_id'')
| list }}'
sequence:
- action: homeassistant.turn_off
continue_on_error: true
target:
entity_id: '{{ repeat.item }}'
- alias: Turn on home power saving devices
id: bfa2d56c-21c2-4d9f-9dfb-abe37e55e8d1
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.rook_presence
to: 'on'
actions:
- repeat:
for_each: '{{ state_attr(''group.home_power_saving_devices'', ''entity_id'')
| list }}'
sequence:
- action: homeassistant.turn_on
continue_on_error: true
target:
entity_id: '{{ repeat.item }}'
- alias: Rook State Machine
id: rook_state_machine
initial_state: true
mode: queued
triggers:
- trigger: event
event_type: rook_state_change
variables:
current_state: '{{ states(''input_select.rook_state'') }}'
new_state: '{{ trigger.event.data.state }}'
allowed_transitions:
home_soon:
- home
- away
- away_long
just_arrived:
- home
- leaving
- just_left
home:
- leaving
- just_left
leaving:
- just_left
- home
just_left:
- home
- away
away:
- away_long
- home_soon
- just_arrived
away_long:
- home_soon
- just_arrived
transition_allowed: '{{ new_state in allowed_transitions[current_state] }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ transition_allowed }}'
sequence:
- action: input_datetime.set_datetime
target:
entity_id: input_datetime.rook_state_changed
data:
timestamp: '{{ now().isoformat() }}'
- action: input_select.select_option
target:
entity_id: input_select.rook_state
data:
option: '{{ new_state }}'
- conditions:
- condition: template
value_template: '{{ not transition_allowed }}'
sequence:
- action: script.debug_notification
data:
message: Invalid state transition from {{ current_state }} to {{ new_state
}}
title: 'Rook State: Invalid State Transition'
- alias: Rook State Machine - Trigger Home
id: c2e74123-6fe3-43c6-bf7c-e0af3fab0ed7
triggers:
- trigger: numeric_state
entity_id: sensor.rook_state_changed_minutes_ago
above: 5
conditions:
- condition: state
entity_id: input_select.rook_state
state: just_arrived
actions:
- event: rook_state_change
event_data:
state: home
- alias: Rook State Machine - Trigger Just Left
id: 44ae4efa-54f0-439e-9b68-fa2caaaf3294
triggers:
- trigger: numeric_state
entity_id: sensor.rook_state_changed_minutes_ago
above: 5
conditions:
- condition: state
entity_id: input_select.rook_state
state: leaving
actions:
- event: rook_state_change
event_data:
state: just_left
- alias: Rook State Machine - Trigger Away
id: ca164f86-7ee5-4001-b705-c0c1585472cf
triggers:
- trigger: numeric_state
entity_id: sensor.rook_state_changed_minutes_ago
above: 30
conditions:
- condition: state
entity_id: input_select.rook_state
state: just_left
actions:
- event: rook_state_change
event_data:
state: away
- alias: Rook State Machine - Trigger Away Long
id: 64d9c2af-8404-404c-ae18-b86cd3d98a94
triggers:
- trigger: numeric_state
entity_id: sensor.rook_state_changed_minutes_ago
above: 1080
conditions:
- condition: state
entity_id: input_select.rook_state
state: away
actions:
- event: rook_state_change
event_data:
state: away_long
- id: update_puzzel_user_info
alias: Update Puzzel user info
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: sensor.puzzel_login
- trigger: homeassistant
event: start
actions:
- delay:
seconds: 1
- action: homeassistant.update_entity
target:
entity_id: sensor.puzzel_user
- delay:
seconds: 1
- action: homeassistant.update_entity
target:
entity_id: sensor.puzzel_user_details
- alias: Puzzel faster scan interval when logged on
id: 0a2b75b8-58d4-4dce-8894-fb09bd8aba6b
initial_state: true
mode: single
triggers:
- trigger: time_pattern
seconds: /5
conditions:
- condition: state
entity_id: binary_sensor.puzzel_status
state: 'on'
actions:
- action: homeassistant.update_entity
target:
entity_id:
- sensor.puzzel_user_status
- sensor.puzzel_user_details
- alias: Update Puzzel Requests
id: 7194575a-e2c6-4c54-b081-847fdf8056d2
initial_state: true
mode: single
triggers:
- trigger: state
entity_id: sensor.puzzel_user_status
not_from: null
actions:
- action: homeassistant.update_entity
target:
entity_id: sensor.puzzel_user_requests
- id: puzzel_state_confirmation
alias: Puzzel state confirmation
initial_state: true
mode: restart
triggers:
- trigger: state
entity_id: sensor.puzzel_profil
not_from:
- unknown
- unavailable
not_to:
- unknown
- unavailable
- trigger: state
entity_id: binary_sensor.puzzel_status
attribute: state
not_from:
- unknown
- unavailable
not_to:
- unknown
- unavailable
conditions:
- condition: template
alias: Not to or from unknown or unavailable state
value_template: "{{ \n has_value('sensor.puzzel_state')\n and has_value('sensor.puzzel_profil')\n\
}}"
actions:
- delay:
seconds: 5
- action: script.notify_darkphone
data:
message: "{% if is_state('binary_sensor.puzzel_status', 'on') %}\n Logget på\
\ Puzzel - {{ states('sensor.puzzel_ko') }}. Status: {{ states('sensor.puzzel_state')\
\ }}\n{% else %}\n Logget af Puzzel\n{% endif %}"
- id: puzzel_state_notification
alias: Puzzel State Notification
initial_state: true
mode: queued
triggers:
- trigger: state
entity_id: sensor.puzzel_profil
- trigger: state
entity_id: sensor.puzzel_state
attribute: state
actions:
- action: notify.mobile_app_arbejdstelefon
data:
title: 'Puzzel Status: {{ ''Logget af'' if is_state(''sensor.puzzel_profil'',
''Logget af'') else ''Logget på'' }}'
message: 'Profil: {{ states(''sensor.puzzel_profil'') }}. Status: {{ states(''sensor.puzzel_state'')
}}'
data:
tag: puzzel_status
channel: Puzzel Status
importance: low
ttl: 0
priority: high
persistent: true
clickAction: noAction
notification_icon: "{%- if is_state('sensor.puzzel_state', 'Logget af') -%}\n\
\ mdi:phone-classic-off\n{%- elif is_state('sensor.puzzel_state', 'Pause')\
\ -%}\n mdi:pause-circle-outline\n{%- elif is_state('sensor.puzzel_state',\
\ 'Ledig') -%}\n mdi:phone-classic\n{%- else -%}\n mdi:help\n{%- endif\
\ -%}"
actions:
- action: puzzel_switch
title: '{{ ''Log på'' if is_state(''sensor.puzzel_profil'', ''Logget af'')
else ''log_af'' }}'
- action: puzzel_pause
title: '{{ ''Ledig'' if is_state(''sensor.puzzel_state'', ''Pause'') else
''Pause'' }}'
- action: URI
title: Menu
uri: /lovelace-work/work
- id: notification_action_puzzel_switch
alias: Notification Action Puzzel Switch
initial_state: true
triggers:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: puzzel_switch
actions:
- action: switch.toggle
target:
entity_id: switch.puzzel
- id: notification_action_puzzel_pause
alias: Notification Action Puzzel Pause
initial_state: true
triggers:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: puzzel_pause
actions:
- action: switch.toggle
target:
entity_id: switch.puzzel_pause
- id: telegram_bot_puzzel_menu
initial_state: true
alias: Puzzel menu
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /puzzel
- trigger: event
event_type: telegram_command
event_data:
command: /puzzel
actions:
- action: notify.telegram_darkfox
data:
message: "{% if is_state('sensor.puzzel_profil', 'Logget af') %}\n Logget af\
\ Puzzel\n{% else %}\n Logget på Puzzel - {{ states('sensor.puzzel_profil')\
\ }}. Status: {{ states('sensor.puzzel_state') }}\n{% endif %} Menu:"
data:
inline_keyboard: "{% if is_state('sensor.puzzel_profil', 'Logget af') %}\n\
\ {{ (\n state_attr('sensor.puzzel_ko', 'available_profiles')\n |\
\ map(attribute='name')\n | map('regex_replace', '\\A(.*)\\Z', '\\\\\
1:/puzzel_login \\\\1')\n | list\n ) }}\n{% else %}\n {{ ['Log af:/puzzel_log_off']\n\
\ + ['Skift kø:/puzzel_login']\n + ['Ledig:/puzzel_pause off']\n + ['Pause:/puzzel_pause\
\ on'] }}\n{% endif %}"
- id: telegram_bot_log_off_puzzel
alias: Telegram bot log off puzzel
initial_state: true
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /puzzel_log_off
- trigger: event
event_type: telegram_command
event_data:
command: /puzzel_log_off
actions:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: Logger af Puzzel...
- action: script.puzzel_log_off
- id: telegram_bot_log_on_puzzel
alias: Telegram bot log on Puzzel
initial_state: true
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /puzzel_login
- trigger: event
event_type: telegram_command
event_data:
command: /puzzel_login
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ not trigger.event.data[''args''] }}'
sequence:
- action: notify.telegram_darkfox
data:
message: Log på Puzzel?
data:
inline_keyboard: "{% set ns = namespace(ret=[]) %} {% for profile in state_attr('sensor.puzzel_ko',\
\ 'available_profiles') | sort(attribute='name') %}\n {% set ns.ret\
\ = ns.ret + [profile.name + ':/puzzel_login '+(profile.id|string)]\
\ %}\n{% endfor %} {{ ns.ret }}"
default:
- variables:
queue_id: '{{ trigger.event.data[''args''][0]|int }}'
profile: '{{ state_attr(''sensor.puzzel_ko'', ''available_profiles'') | selectattr(''id'',
''eq'', queue_id) | list | first }}'
- choose:
- conditions:
- condition: template
value_template: '{{ profile is not none }}'
sequence:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: Logger på {{ profile.name }}...
- action: script.puzzel_log_on
data:
queue_id: '{{ queue_id }}'
default:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: Kø ikke fundet
- action: automation.trigger
target:
entity_id: automation.telegram_bot_log_on_puzzel
- id: telegram_bot_pause_puzzel
alias: Telegram bot pause Puzzel
initial_state: true
triggers:
- trigger: event
event_type: telegram_callback
event_data:
command: /puzzel_pause
- trigger: event
event_type: telegram_command
event_data:
command: /puzzel_pause
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ not trigger.event.data[''args''] }}'
sequence:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: Sætter på pause...
- action: script.puzzel_pause_on
- conditions:
- condition: template
value_template: '{{ trigger.event.data[''args''][0] == ''off'' }}'
sequence:
- action: telegram_bot.answer_callback_query
data:
callback_query_id: '{{ trigger.event.data.id }}'
message: Sætter ledig...
- action: script.puzzel_pause_off
- alias: Switch PC sound to VR
id: switch_pc_sound_to_vr
mode: single
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.quest_in_use
to: 'on'
actions:
- action: button.press
target:
entity_id: button.rook_pc_vr_sound
- alias: Sleep as Android MQTT event
id: 5cb9a551-a39e-462b-9a7f-ebc36711173d
initial_state: true
triggers:
- trigger: mqtt
topic: SleepAsAndroid
actions:
- event: sleep_as_android
event_data:
event: '{{ trigger.payload_json.event }}'
value1: '{{ trigger.payload_json.value1 if ''value1'' in trigger.payload_json
}}'
value2: '{{ trigger.payload_json.value2 if ''value2'' in trigger.payload_json
}}'
value3: '{{ trigger.payload_json.value3 if ''value3'' in trigger.payload_json
}}'
- alias: Sleep as Android Webhook event
id: 7984e11c-2846-4faa-aed7-ee439127b9fd
initial_state: true
triggers:
- trigger: webhook
webhook_id: secret sleep_as_android_webhook
local_only: false
allowed_methods:
- GET
- POST
actions:
- event: sleep_as_android
event_data:
event: '{{ trigger.json.event }}'
value1: '{{ trigger.json.value1 if ''value1'' in trigger.json }}'
value2: '{{ trigger.json.value2 if ''value2'' in trigger.json }}'
value3: '{{ trigger.json.value3 if ''value3'' in trigger.json }}'
- alias: sleep_as_android_state_bedtime
id: 101fbdda-3b78-42ea-aa9d-9e8e41200e07
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: time_to_bed_alarm_alert
conditions:
- condition: state
entity_id: input_select.sleep_as_android_state
state: awake
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: bedtime
- alias: sleep_as_android_state_sleeping
id: fc21b034-8ae6-4492-bd54-049929dcb983
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_started
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_resumed
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: sleeping
- alias: sleep_as_android_state_sleeping_cancelled
id: 39894ea0-3b35-4ba8-8f0a-1e4cf745d525
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_stopped
actions:
- choose:
- conditions:
condition: and
conditions:
- condition: time
after: '20:00:00'
before: 04:00:00
- condition: or
conditions:
- condition: state
entity_id: input_select.sleep_as_android_state
state: sleeping
- condition: state
entity_id: input_select.sleep_as_android_state
state: paused
sequence:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: bedtime
default:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: awake
- alias: sleep_as_android_state_paused
id: c26bb668-9674-4a71-9936-08689fd67fb1
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_paused
actions:
action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: paused
- alias: sleep_as_android_state_smart_wake
id: 83b0f739-65dc-4750-95ec-65b17f0b867c
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: smart_period
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: smart wake
- alias: sleep_as_android_state_alarm
id: 89bc0e9f-aea6-4f3b-a356-03053b387578
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: alarm_alert_start
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: alarm
- alias: sleep_as_android_state_snoozing
id: ca190425-e85b-4f14-b4ec-8bb7d0063f55
initial_state: true
triggers:
trigger: event
event_type: sleep_as_android
event_data:
event: alarm_snooze_clicked
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: snoozing
- alias: sleep_as_android_state_awake
id: 2777f4fa-1631-46d6-9755-a0515e33da0f
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: alarm_alert_dismiss
- trigger: event
event_type: sleep_as_android
event_data:
event: alarm_skip_next
- trigger: event
event_type: sleep_as_android
event_data:
event: alarm_snooze_cancelled
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_stopped
actions:
- action: input_select.select_option
data:
entity_id: input_select.sleep_as_android_state
option: awake
- alias: sleep_as_android_reset_snooze_counter
id: 899e638d-4471-4168-94ee-8a9e51885a1e
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: alarm_snooze_clicked
actions:
- action: counter.reset
data:
entity_id: counter.snooze_counter
- alias: sleep_as_android_snoozing
id: 247c8b50-72be-467b-95bf-73ebebaaa4ab
initial_state: true
triggers:
- trigger: event
event_type: sleep_as_android
event_data:
event: sleep_tracking_started
actions:
- action: counter.increment
data:
entity_id: counter.snooze_counter
- alias: Ensure AC power on when ac climate started
id: 2a88ce77-de4b-4454-9e57-b69ac7deba33
initial_state: true
mode: single
triggers:
- trigger: state
entity_id: climate.aircondition
not_to: 'off'
conditions:
- condition: state
entity_id: switch.aircondition_afbryder
state: 'off'
actions:
- action: switch.turn_on
entity_id: switch.aircondition_afbryder
- delay:
seconds: 5
- action: climate.turn_on
entity_id: climate.aircondition
- id: adjust_speaker_group_volume
alias: Adjust Speaker Group Volume
mode: parallel
initial_state: true
triggers:
- trigger: state
entity_id:
- input_number.stue_group_volume
- input_number.kokken_group_volume
- input_number.kontor_group_volume
- input_number.sovevaerelse_group_volume
- input_number.badevaerelse_group_volume
- input_number.roam_group_volume
actions:
repeat:
for_each: '{{ state_attr((trigger.entity_id|replace(''input_number'',''media_player'')|replace(''_group_volume'',
'''')), ''group_members'') }}'
sequence:
- action: media_player.volume_set
target:
entity_id: '{{ repeat.item }}'
data:
volume_level: '{{ trigger.to_state.state|int/100 }}'
- alias: charge_kitchen_tablet
id: 790eb451-80a1-4e6d-a02e-27bd51e3687f
triggers:
- trigger: numeric_state
entity_id: sensor.kokken_tablet_battery_level
below: 60
- trigger: state
entity_id: sensor.kokken_tablet_battery_level
to:
- unknown
- unavailable
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
conditions:
- condition: numeric_state
entity_id: sensor.kokken_tablet_battery_level
below: 60
actions:
- action: switch.turn_on
data:
entity_id: switch.kokken_tablet_lader
- alias: discharge_kokken_tablet
id: a4b4cf41-183f-4071-bd8a-00569dc76c16
triggers:
- trigger: numeric_state
entity_id: sensor.kokken_tablet_battery_level
above: 80
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
conditions:
- condition: numeric_state
entity_id: sensor.kokken_tablet_battery_level
above: 80
actions:
- action: switch.turn_off
data:
entity_id: switch.kokken_tablet_lader
- alias: charge_hallway_tablet
id: b74dbe2a-670d-41ef-9b20-25c070f4325b
triggers:
- trigger: numeric_state
entity_id: sensor.gang_tablet_battery_level
below: 60
- trigger: state
entity_id: sensor.gang_tablet_battery_level
to:
- unknown
- unavailable
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
conditions:
- condition: numeric_state
entity_id: sensor.gang_tablet_battery_level
below: 60
actions:
- action: switch.turn_on
data:
entity_id: switch.gang_tablet_lader
- alias: discharge_gang_tablet
id: 9b1665fb-5a02-4489-8a9d-ff49d8afcb14
triggers:
- trigger: numeric_state
entity_id: sensor.gang_tablet_battery_level
above: 80
- trigger: state
entity_id: binary_sensor.home_assistant_loaded
to: 'on'
conditions:
- condition: numeric_state
entity_id: sensor.gang_tablet_battery_level
above: 80
actions:
- action: switch.turn_off
data:
entity_id: switch.gang_tablet_lader
- id: restart_tado
alias: Restart Tado
mode: single
triggers:
- trigger: time_pattern
minutes: /5
seconds: '0'
conditions:
- condition: state
entity_id: binary_sensor.tado_hub_crashed
state: 'on'
for:
minutes: 15
actions:
- action: switch.turn_off
data:
entity_id: switch.tado
- delay:
seconds: 60
- action: switch.turn_on
data:
entity_id: switch.tado
- wait_template: '{{ is_state(''device_tracker.tado'', ''home'') }}'
- event: set_climate
- id: update_telegram_keyboard
alias: Update Telegram Keyboard
initial_state: true
triggers:
trigger: homeassistant
event: start
actions:
- action: notify.telegram_darkfox
data:
message: Home Assistant er genstartet
data:
keyboard:
- /puzzel
- /bil
- /destination
- alias: Handle Telegram Message
id: handle_telegram_message
initial_state: true
triggers:
- trigger: event
event_type: telegram_text
event_data:
chat_id: secret telegram_darkfox_id
actions:
- action: conversation.process
data:
text: '{{ trigger.event.data.text }}'
language: da
agent_id: 4e0a875b09f8a19a405e1bf3e5c4adac
response_variable: agent
- action: telegram_bot.send_message
data:
target: '{{ trigger.event.data.chat_id }}'
message: '{{ agent.response.speech.plain.speech }}'
- alias: Telegram yt-dlp
id: fedddc04-a5ac-4412-811d-b54d5f03cb0e
triggers:
trigger: event
event_type: telegram_command
event_data:
command: /yt-dlp
actions:
- action: shell_command.yt_dlp
response_variable: file_path
data:
url: '{{ trigger.event.data.text }}'
- action: telegram_bot.send_document
data:
target: '{{ trigger.event.data.chat_id }}'
document: '{{ file_path }}'
- alias: Light Profile Frontend Theme Setter
id: light_profile_frontend_theme_setter
initial_state: true
triggers:
- trigger: homeassistant
event: start
- trigger: state
entity_id: input_select.light_profile
- trigger: template
alias: Set current mode when a browser becomes available
value_template: "[\n {%- for entity in states.binary_sensor | rejectattr('state',\
\ 'eq', 'unavailable') | selectattr('entity_id', 'match', '.+_browser_dark_mode')\
\ | list -%}\n \"{{ entity.attributes.get('browserID') }}\",\n {% endfor\
\ -%}\n]"
variables:
browser_id: '{{ [trigger.to_state.attributes.browserID] if trigger.platform ==
''template'' and trigger.to_state.state != ''unavailable'' else [] }}'
actions:
- choose:
- conditions:
- condition: state
entity_id: input_select.light_profile
state:
- Bright
sequence:
action: browser_mod.set_theme
data:
dark: light
browser_id: '{{ browser_id }}'
- conditions:
- condition: state
entity_id: input_select.light_profile
state:
- Dimmed
- Ambient
- Night
- 'Off'
sequence:
action: browser_mod.set_theme
data:
dark: dark
browser_id: '{{ browser_id }}'
default:
action: browser_mod.set_theme
data:
dark: auto
browser_id: '{{ browser_id }}'
- alias: Get upcoming travel destionation coordinates
id: 29f91918-2f1c-4968-a147-2de8df7555f4
initial_state: true
triggers:
- trigger: state
entity_id: sensor.next_travel_event
for:
seconds: 10
actions:
- action: script.osm_geocoding_lookup
response_variable: geocoded_data
data:
query: '{{ state_attr(''sensor.next_travel_event'', ''location'') }}'
- variables:
destination: '{%- from ''osm.jinja'' import geocodejson_to_vw -%} {{ geocodejson_to_vw(geocoded_data.location,
name) if geocoded_data.get(''location'', None) else {} }}'
- event: upcoming_travel_destination_coordinates
event_data:
destination: '{{ destination }}'
- alias: Next destination - Update sensors with high frequency when close to leave
time
id: e342768f-0119-453a-8301-201282f58103
initial_state: true
triggers:
- trigger: time_pattern
minutes: /5
conditions:
- condition: state
entity_id: binary_sensor.rook_next_scheduled_destination_leave_soon
state: 'on'
actions:
- choose:
- conditions: '{{ is_state_attr(''sensor.upcoming_travel_location'', ''mode'',
''driving'') }}'
sequence:
- action: homeassistant.update_entity
target:
entity_id: sensor.rook_destination_duration_in_traffic
- conditions: '{{ is_state_attr(''sensor.upcoming_travel_location'', ''mode'',
''transit'') }}'
sequence:
- action: homeassistant.update_entity
target:
entity_id: sensor.rook_destination_transit_duration
- alias: Next destination - Update sensors slowly 12 hours before or when destination
changes
id: f4eb3d8f-daf0-487b-91d0-d0f8d89d6fa7
initial_state: true
triggers:
- trigger: time_pattern
minutes: /45
- trigger: state
entity_id:
- sensor.upcoming_travel_location
- binary_sensor.rook_next_scheduled_destination_active
conditions:
- condition: state
entity_id: binary_sensor.rook_next_scheduled_destination_active
state: 'on'
actions:
- choose:
- conditions: '{{ is_state_attr(''sensor.upcoming_travel_location'', ''mode'',
''driving'') }}'
sequence:
- action: homeassistant.update_entity
target:
entity_id: sensor.rook_destination_duration_in_traffic
- conditions: '{{ is_state_attr(''sensor.upcoming_travel_location'', ''mode'',
''transit'') }}'
sequence:
- action: homeassistant.update_entity
target:
entity_id: sensor.rook_destination_transit_duration
- id: time_to_leave_notification
alias: time_to_leave_notification
initial_state: true
mode: single
triggers:
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 61
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 46
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 31
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 21
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 16
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 11
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 6
- trigger: numeric_state
entity_id: sensor.next_scheduled_leave_in
below: 1
conditions:
- alias: Not from unavailable/unknown
condition: template
value_template: '{{ not trigger.from_state.state in [''unavailable'', ''unknown'']
}}'
actions:
- action: script.notify_everywhere
data:
message: "{% if trigger.to_state.state|int(0) < 1 %}\n Tid til at tage afsted.\n\
{% else %}\n Tag afsted om {{ trigger.to_state.state|int(0) }} minutter.\n\
{% endif %}"
- alias: Set notification sounds options
id: c5dab2fa-93df-488e-ad02-5da4c458d497
initial_state: true
triggers:
- trigger: state
entity_id:
- sensor.chime_tts_sounds
- sensor.notification_sounds
- trigger: homeassistant
event: start
actions:
- variables:
saved_option: '{{ states(''input_text.notification_sound'') }}'
- action: input_select.set_options
data_template:
entity_id: input_select.notification_sound
options: "{% set ns = namespace(ret=[]) %} {%- for file in state_attr('sensor.chime_tts_sounds',\
\ 'files') -%}\n {% set title = (file.replace('/config/custom_components/chime_tts/mp3s/','').replace('.mp3',\
\ '').replace('_', ' ')|title) %}\n {% set ns.ret = ns.ret + [title+': '+file]\
\ %}\n{%- endfor -%} {%- for file in state_attr('sensor.notification_sounds',\
\ 'files') -%}\n {% set title = file.replace('/media/Notifications/','').replace('.mp3',\
\ '').replace('/', ' - ') %}\n {% set ns.ret = ns.ret + [title+': '+file]\
\ %}\n{%- endfor -%} {{ ns.ret }}\n"
- action: input_select.select_option
data_template:
entity_id: input_select.notification_sound
option: '{{ saved_option }}'
- alias: Save new notification sound
id: 554dfdef-5e6d-4abd-9cf3-791cd1329f03
initial_state: true
triggers:
trigger: state
entity_id: input_select.notification_sound
for:
seconds: 1
conditions:
- condition: state
entity_id: binary_sensor.home_assistant_loaded
state: 'on'
actions:
- action: input_text.set_value
data_template:
entity_id: input_text.notification_sound
value: '{{ states(''input_select.notification_sound'') }}'
- alias: Announce notification sound changed
id: 09c0059c-52b2-42d1-9650-a46a22e97aae
initial_state: true
triggers:
trigger: state
entity_id: sensor.chime_path
not_from:
- unknown
- unavailable
actions:
- action: script.voice_broadcast
data:
message: Notifikationslyd ændret
- alias: Vacation Mode Off
id: 16796890-7e97-4e23-96da-0617c70d1c1d
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.vacation_mode
to: 'off'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.vacation_mode_lights_active
- delay:
seconds: 2
- event: refresh_light_profile
- alias: Vacation Lights On
id: 6498613d-e172-4b9c-8ea1-b02f095f8e8a
initial_state: true
triggers:
trigger: time_pattern
minutes: /5
conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: or
conditions:
- condition: time
after: '17:00:00'
before: '23:00:00'
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: time
after: '10:00:00'
before: '23:00:00'
weekday:
- sat
- sun
- condition: or
conditions:
- condition: template
value_template: '{{ states.sun.sun.attributes.elevation < 4 }}'
- condition: numeric_state
entity_id: sensor.kokken_illuminance
below: 10
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.vacation_mode_lights_active
- alias: Vacation Lights Off
id: 98223344-098b-4299-a45b-96e837be919c
initial_state: true
triggers:
- trigger: time
at: '23:00:00'
conditions:
condition: state
entity_id: input_boolean.vacation_mode_lights_active
state: 'on'
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.vacation_mode_lights_active
- alias: Vacation Office on
id: f6b6f7e1-6bfb-4d34-8ab9-37324f8da9d8
initial_state: true
triggers:
trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'on'
actions:
- condition: state
entity_id: binary_sensor.vacation_mode_random_boolean
state: 'on'
- delay:
hours: 1
minutes: '{{ states(''sensor.vacation_mode_random_minutes'') }}'
- action: light.turn_on
data:
entity_id: light.kontor_loftlampe
brightness: 200
- alias: Vacation Living Room on
id: 704d680d-9c4d-4864-b7a5-9e0eb4f34997
initial_state: true
triggers:
trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'on'
actions:
- delay:
minutes: '{{ states(''sensor.vacation_mode_random_minutes'') }}'
- action: light.turn_on
data:
entity_id: light.stue_spot_3
brightness: 200
color_temp_kelvin: 3333
- alias: Vacation Kitchen on
id: 3b27e55d-b343-46bc-9b2e-1c42002a29d0
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'on'
- trigger: event
event_type: vacation_kitchen_loop
actions:
- delay:
minutes: '{{ states(''sensor.vacation_mode_random_minutes'') }}'
- action: light.turn_on
data:
entity_id: light.kokken_loftlampe
color_temp_kelvin: 3333
brightness: 200
- delay:
minutes: '{{ (states(''sensor.vacation_mode_random_minutes'')) | int }}'
- action: light.turn_off
data:
entity_id: light.kokken_loftlampe
- delay:
hours: 2
- event: vacation_kitchen_loop
- alias: Vacation Bathroom on
id: 60374093-f70e-40df-a664-dcc4421b17d2
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'on'
- trigger: event
event_type: vacation_bathroom_loop
conditions:
condition: state
entity_id: input_boolean.vacation_mode_lights_active
state: 'on'
actions:
- delay:
minutes: '{{ states(''sensor.vacation_mode_random_minutes'') }}'
- action: light.turn_on
data:
entity_id: light.badevaerelse_lampe
brightness: 200
color_temp_kelvin: 3333
- delay:
minutes: '{{ (states(''sensor.vacation_mode_random_minutes'')/2) | int }}'
- action: light.turn_off
data:
entity_id: light.badevaerelse_lampe
- delay:
hours: 2
- event: vacation_bathroom_loop
- alias: Vacation Office Off
id: 3f66aea8-43db-476a-8f5d-d38d0bfb7086
initial_state: true
triggers:
trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'off'
actions:
- delay:
minutes: '{% if is_state(''input_boolean.vacation_mode_lights_active'', ''on'')
%}{{ states(''sensor.vacation_mode_random_minutes'') }}{% else %}0{% endif
%}'
- action: light.turn_off
data:
entity_id: light.kontor_loftlampe
- alias: Vacation Living Room Off
id: d4e31627-05b8-40f3-b4bc-bcb5e51fbd1a
initial_state: true
triggers:
trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'off'
actions:
- delay:
minutes: '{% if is_state(''input_boolean.vacation_mode_lights_active'', ''on'')
%}{{ states(''sensor.vacation_mode_random_minutes'') }}{% else %}0{% endif
%}'
- action: light.turn_off
data:
entity_id: light.stue_spot_3
- alias: Vacation Kitchen Off
id: 81cb653f-741c-45cf-af42-7d6dad7007cd
initial_state: true
triggers:
trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'off'
actions:
- delay:
minutes: '{% if is_state(''input_boolean.vacation_mode_lights_active'', ''on'')
%}{{ states(''sensor.vacation_mode_random_minutes'') }}{% else %}0{% endif
%}'
- action: light.turn_off
data:
entity_id: light.kokken_loftlampe
- alias: Vacation Bathroom Off
id: 99259e0c-cff0-411c-83b3-1392fa88a00e
initial_state: true
triggers:
trigger: state
entity_id: input_boolean.vacation_mode_lights_active
to: 'off'
actions:
- delay:
minutes: '{% if is_state(''input_boolean.vacation_mode_lights_active'', ''on'')
%}{{ states(''sensor.vacation_mode_random_minutes'') }}{% else %}0{% endif
%}'
- action: light.turn_off
data:
entity_id: light.badevaerelse_lampe
- alias: Force VW data update on phone notification
id: 748368fc-75e1-4931-b0a4-63bb9f0e15e5
initial_state: true
mode: single
triggers:
- trigger: state
entity_id: sensor.darkphone_last_notification_post_time
conditions:
- condition: state
entity_id: sensor.darkphone_last_notification
state: com.volkswagen.weconnect
actions:
- action: button.press
target:
entity_id: button.id_3_pro_wakeup
- alias: ID.3 Force Update During Climatisation Request
id: 6045309c-38ec-4bd9-828b-c812ff88b32e
initial_state: false
mode: single
triggers:
- trigger: state
entity_id:
- binary_sensor.id_3_pro_climatisation_change_requested
- binary_sensor.id_3_pro_charging_change_requested
to: 'on'
conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.id_3_pro_climatisation_change_requested
state: 'on'
- condition: state
entity_id: binary_sensor.id_3_pro_charging_change_requested
state: 'on'
action:
- delay:
seconds: 10
- action: button.press
target:
entity_id: button.id_3_pro_wakeup
- alias: ID.3 Pro Notify destinations sent
id: 5b33950a-780e-4708-94b5-9276239e4a80
initial_state: true
triggers:
- trigger: event
event_type: id_3_pro_destinations_sent
variables:
destinations: '{{ trigger.event.data.get(''destinations'', []) }}'
parts: '{{ destinations|length }}'
final: '{{ destinations|last }}'
actions:
- action: notify.telegram_darkfox
data:
message: "{{ parts }} destination{{ 'er' if parts > 1 }} sendt til bilen:\n\
{% for d in destinations %}\n {%- set address = d.get('address') -%}\n -\
\ {{ d.get('name', 'Destination') }}{{ ': '~address.values()|reverse|list|join(',\
\ ') if address }}\n{% endfor %}\n"
- delay: 0.5
- action: notify.telegram_darkfox
data:
message: Destination
data:
location:
latitude: '{{ final.get(''geoCoordinate'', {}).get(''latitude'') }}'
longitude: '{{ final.get(''geoCoordinate'', {}).get(''longitude'')}}'
- alias: workshop_door_activity_on
id: 2569ea62-ac9f-4ba8-9e18-13a914f9e180
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.varksted_dor
to:
- 'on'
- 'off'
not_from:
- unavailable
- unknown
actions:
- action: input_boolean.turn_on
data:
entity_id: input_boolean.workshop_door_activity
- alias: workshop_door_activity_off
id: 0af8945b-8abc-4cca-88fd-a168c64bcc37
initial_state: true
triggers:
- trigger: state
entity_id: input_boolean.workshop_door_activity
to: 'on'
for:
seconds: 5
actions:
- action: input_boolean.turn_off
data:
entity_id: input_boolean.workshop_door_activity
- alias: workshop_desk_power_reminder
id: b51a8636-e588-400d-b894-1be7ed7bf265
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.workshop_activity
to: 'off'
for:
minutes: 15
conditions:
- condition: numeric_state
entity_id: sensor.hobbybord_afbryder_forbrug
above: 0.05
actions:
- action: script.notify_everywhere
data:
message: Loddekolben eller andet er muligvis tændt på hobbybordet. Husk at slukke
for strømmen.
- alias: workshop_desk_power_off
id: cbb52f2f-38f4-4131-b561-79b269a8dfe4
initial_state: true
triggers:
- trigger: state
entity_id: binary_sensor.workshop_activity
to: 'off'
for:
minutes: 30
actions:
- action: switch.turn_off
data:
entity_id: switch.hobbybord_afbryder
- alias: activate_light_profile_workshop
id: b95904b0-7a60-4c6e-bdaf-1c6fe7a98df2
mode: restart
initial_state: true
triggers:
- trigger: state
entity_id: sensor.workshop_active_light_profile
- trigger: event
event_type: refresh_light_profile
variables:
profile: '{{ states(''sensor.workshop_active_light_profile'') }}'
actions:
- choose:
- conditions:
- condition: template
value_template: '{{ profile == ''Bright'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.vaerksted_loftlampe:
state: true
brightness: 255
color_temp_kelvin: 4000
light.hobbybord_bord:
state: true
brightness: 255
effect: None
light.hobbybord_vaerktojsskab:
state: true
brightness: 255
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Default'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.vaerksted_loftlampe:
state: true
brightness: 255
color_temp_kelvin: 4000
light.hobbybord_bord:
state: true
brightness: 255
effect: None
light.hobbybord_vaerktojsskab:
state: true
brightness: 255
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Dimmed'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.vaerksted_loftlampe:
state: true
brightness: 72
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.hobbybord_bord:
state: true
brightness: 48
effect: None
light.hobbybord_vaerktojsskab:
state: true
brightness: 48
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Ambient'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.vaerksted_loftlampe:
state: true
brightness: 48
hs_color: '{{ state_attr(''sensor.theme'', ''primary_color_hue'') }}'
light.hobbybord_bord:
state: true
brightness: 36
effect: None
light.hobbybord_vaerktojsskab:
state: true
brightness: 36
effect: None
- conditions:
- condition: template
value_template: '{{ profile == ''Night'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.vaerksted_loftlampe:
state: true
brightness: 2
rgb_color:
- 255
- 0
- 0
light.hobbybord_bord:
state: true
brightness: 8
effect: None
light.hobbybord_vaerktojsskab:
state: false
- conditions:
- condition: template
value_template: '{{ profile == ''Off'' }}'
sequence:
- action: scene.apply
data:
transition: '{{ (states(''input_number.scene_transition_time'') | float
or 0.5) }}'
entities:
light.vaerksted_lys:
state: false
- alias: Set Workshop Latest Motion
id: ccf9375e-f45f-4845-927a-7dc0743e7c0c
initial_state: true
triggers:
- trigger: state
entity_id:
- binary_sensor.vaerksted_motion
- binary_sensor.varktojsskab
to: 'on'
conditions:
- condition: state
entity_id: vacuum.valetudo_roborocks5
state: docked
- condition: state
entity_id: person.rook
state: home
actions:
action: input_select.select_option
data:
entity_id: input_select.latest_motion
option: Workshop