AutomationDataset/gribber/gribber_automations.yaml

4783 lines
126 KiB
YAML

- alias: 'Bedroom: AC watertank'
id: 7267672f-0076-4d66-aa19-637bbb23275a
trigger:
- platform: state
id: sensor
entity_id:
- binary_sensor.water_bedroom_ac_water_leak
from: 'off'
to: 'on'
action:
- service: homeassistant.turn_off
target:
entity_id: climate.air_conditioner
- service: notify.castle_log
data:
title: AC Sovrum
message: Slog av AC pga full vattentank
- alias: 'Bedroom: Turn on AC if warm'
id: 1b84349e-0c7c-4984-8561-6b3e7a4c80a1
trigger:
- platform: time
id: time
at: input_datetime.ac_turn_on
condition:
- condition: state
entity_id:
- input_boolean.house_mode_away
state: 'off'
- condition: state
entity_id:
- input_boolean.house_mode_summer
state: 'on'
- condition: state
entity_id:
- binary_sensor.water_bedroom_ac_water_leak
state: 'off'
- condition: numeric_state
entity_id:
- sensor.bedroom_temperature
above: 21
action:
- service: homeassistant.turn_on
target:
entity_id: climate.air_conditioner
- service: notify.castle_log
data:
title: AC Sovrum
message: Slog på AC:n
- alias: 'Bedroom: AC plug'
id: 33837bc5-0c32-42a0-be69-cd35810213f9
trigger:
- platform: state
entity_id: switch.bedroom_ac_plug
to: 'off'
action:
- service: notify.castle
data:
title: Plug AC Sovrum
message: Strömmen stängdes av till AC:n
- alias: 'House: ambience lights'
id: 8d47c436-0dd0-4db2-a25c-9c020717e11a
mode: queued
triggers:
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_bright_inside
- input_boolean.house_mode_bright_hallway
- trigger: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
variables:
labels_on: "{% set l = [] %} {% if today_at(states('input_datetime.time_goodmorning'))\
\ < now() and today_at(states('input_datetime.time_goodnight')) > now() %}\n\
\ {% if states('input_boolean.house_mode_bright_inside') == \"off\" %}\n \
\ {% set l = l + ['ambience', 'ambience_night'] %}\n {% endif %}\n {% if\
\ states('input_boolean.house_mode_bright_hallway') == \"off\" %}\n {% set\
\ l = l + ['ambience_extra'] %}\n {% endif %}\n{% else %}\n {% if states('input_boolean.house_mode_bright_inside')\
\ == \"off\" %}\n {% set l = l + ['ambience_night'] %}\n {% endif %}\n{%\
\ endif %} {{l}}\n"
labels_off: '{% set all_labels = [''ambience'', ''ambience_extra'', ''ambience_night'']%}
{{ set(all_labels).difference(labels_on)|list }}
'
actions:
- variables:
labels: '{{ labels_on }}'
to_state: 'on'
from_state: 'off'
- &id001
action: light.turn_{{to_state}}
data:
transition: 5
target:
entity_id: "{% set floors = ['nere', 'uppe'] %} {% set ns = namespace(e=[],\
\ l=[]) %} {% for l in labels %}\n {% set ns.l = ns.l + label_entities(l)\
\ %}\n{% endfor %} {% for floor in floors %}\n {% for area in floor_areas(floor)\
\ %}\n {%- if states('input_boolean.noauto_'+area) == 'unknown' or states('input_boolean.noauto_'+area)\
\ == \"off\" %}\n {% for entity in set(area_entities(area)).intersection(ns.l\n\
\ | select('match', 'light.'))\n | select('is_state', from_state)\
\ %}\n {% set ns.e = ns.e + [entity] -%}\n {% endfor %}\n {%-\
\ endif -%}\n {% endfor %}\n{% endfor %} {{ns.e}}\n"
- variables:
labels: '{{ labels_off }}'
to_state: 'off'
from_state: 'on'
- *id001
- alias: 'Annie: error'
id: b3c00dc3-b327-498e-9076-8ab6ed4fb3b7
mode: queued
trace:
stored_traces: 10
trigger:
- platform: state
entity_id:
- sensor.am430x_status_id
to:
- '7'
not_from:
- unknown
- unavailable
- '0'
action:
- delay:
seconds: 1
- service: notify.castle_log
data:
title: 'Annie: {{states(''sensor.am430x_status'')}}'
message: '{{ states(''input_text.annie_last_substatus'') if states(''sensor.am430x_substatus'')
== '''' else states(''sensor.am430x_substatus'') }}'
data:
location:
latitude: '{{state_attr(''device_tracker.am430x_gps'', ''latitude'')}}'
longitude: '{{state_attr(''device_tracker.am430x_gps'', ''longitude'')}}'
- alias: 'Annie: set last substatus'
id: 0819562f-9de5-4c95-990f-f44f88e0e381
mode: queued
trace:
stored_traces: 10
trigger:
- platform: state
entity_id:
- sensor.am430x_substatus
action:
service: input_text.set_value
target:
entity_id: input_text.annie_last_substatus
data:
value: '{{ trigger.from_state.state }}'
- alias: 'Annie: park when wet'
id: 00520d65-1bb5-425b-8743-ee58d488653e
trace:
stored_traces: 10
triggers:
- trigger: state
entity_id:
- binary_sensor.gw3000a_rain_state_piezo
from: 'off'
to: 'on'
actions:
- action: button.press
data: {}
target:
entity_id: button.am430x_eod
- alias: 'Annie: resume mowing when dry'
id: f248b77a-854a-4099-9485-b816045b90fa
trace:
stored_traces: 10
triggers:
- trigger: state
entity_id:
- binary_sensor.gw3000a_rain_state_piezo
from: 'on'
to: 'off'
for:
minutes: 60
actions:
- action: button.press
data: {}
target:
entity_id: button.am430x_auto
- alias: 'AutoBackup: Daily Backup'
id: 96256f87-9a45-4f2c-bb83-23b983a93afc
trigger:
platform: time
at: 02:30:00
condition:
condition: time
weekday:
- tue
- wed
- thu
- fri
- sat
- sun
action:
service: auto_backup.backup_full
data:
name: 'DailyBackup: {{ now().strftime(''%a, %Y-%m-%d'') }}'
keep_days: 7
location: backup
- alias: 'AutoBackup: Weekly Backup'
id: a3f0c772-b3c1-4a71-a7ca-0e246c1b5df7
trigger:
platform: time
at: 02:30:00
condition:
condition: time
weekday:
- mon
action:
service: auto_backup.backup_full
data:
name: 'WeeklyBackup: {{ now().strftime(''%a, %Y-%m-%d'') }}'
keep_days: 28
location: backup
- alias: 'Bedroom: lights'
id: 48d8b685-cc44-4b54-bf1b-bbaf4a088413
trace:
stored_traces: 25
triggers:
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
entity_id:
- event.bedroom_remote_right_action
- event.bedroom_remote_left_action
- event.bedroom_remote_wall_action
not_from: unavailable
id: remote
- trigger: state
entity_id:
- input_boolean.house_mode_away
- input_boolean.house_mode_sleep
- input_boolean.house_mode_bright_inside
- input_boolean.bedroom_nightlight
- trigger: state
id: auto_off
entity_id:
- binary_sensor.presence_bedroom_occupancy
to: 'off'
for:
minutes: 10
- trigger: time
id: reset
at:
- input_datetime.house_reset_settings
- input_datetime.house_reset_settings_day
- trigger: time
id: wakeup
at: input_datetime.wakeup_time
- trigger: time
id: goodnight
at:
- input_datetime.time_goodnight
actions:
- choose:
- conditions:
- condition: trigger
id: auto_off
sequence:
- choose:
- conditions:
- condition: state
entity_id:
- light.bedroom_ceiling
state: 'on'
sequence:
- action: light.turn_off
target:
entity_id: light.bedroom_ceiling
data:
transition: 5
- conditions:
- condition: trigger
id: remote
sequence:
- variables:
action: '{{ trigger.to_state.attributes.event_type }}'
- alias: Remote buttons
choose:
- alias: Big bulb pressed
conditions: '{{ action in [''big-press'', ''on'', ''brightness_up_click'']
}}'
sequence:
- choose:
- conditions:
- alias: if ceiling light is off
condition: state
entity_id:
- light.bedroom_ceiling
state: 'off'
sequence:
- alias: turn on ceiling light
action: light.turn_on
target:
entity_id: light.bedroom_ceiling
data:
brightness: 255
default:
- alias: turn off ceiling light
action: light.turn_off
target:
entity_id: light.bedroom_ceiling
- alias: Small bulb pressed
conditions: '{{ action in [''small-press'', ''off'', ''brightness_down_click'']
}}'
sequence:
- alias: toggle ambience lights
action: light.toggle
target:
entity_id: "{{ \n expand(area_entities(\"bedroom\") \n | select('match',\
\ 'light')) \n | selectattr('entity_id', 'in', label_entities('ambience'))\
\ \n | map(attribute='entity_id')\n | list \n}}\n"
- alias: Left pressed
conditions: '{{ action in [''left-press'', ''arrow_left_click''] }}'
sequence:
- alias: toggle left bed lamp
action: light.toggle
target:
entity_id: light.bedroom_left
- alias: Right pressed
conditions: '{{ action in [''right-press'', ''arrow_right_click''] }}'
sequence:
- alias: toggle right bed lamp
action: light.toggle
target:
entity_id: light.bedroom_right
- alias: Small bulb press hold
conditions: '{{ action in [''small-hold'', ''brightness_move_down''] }}'
sequence:
- alias: turn off ambience
action: light.turn_off
target:
entity_id: "{{ \n expand(area_entities(\"bedroom\") \n | select('match',\
\ 'light')) \n | selectattr('entity_id', 'in', label_entities('ambience'))\
\ \n | map(attribute='entity_id')\n | list \n}}\n"
- conditions:
- condition: trigger
id: goodnight
sequence:
- alias: if night light mode is off
choose:
conditions: '{{ states(''input_boolean.bedroom_nightlight'') == ''off''
}}'
sequence:
- action: light.turn_off
target:
area_id: bedroom
label_id: ambience
data:
transition: 5
- alias: 'Conservatory: lights'
id: eaf0b151-07e3-4af2-9a95-e493122a915e
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- scene_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_bright_inside
- platform: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
action:
choose:
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_bright_inside
state: 'on'
sequence:
- &id002
service: light.turn_off
target:
entity_id:
- light.conservatory_ceiling
data:
transition: 5
- conditions:
- condition: time
after: input_datetime.time_goodmorning
before: input_datetime.time_goodnight
- condition: state
entity_id: light.conservatory_ceiling
state: 'off'
sequence:
- service: light.turn_on
target:
entity_id:
- light.conservatory_ceiling
data:
transition: 5
brightness: 120
default:
- *id002
- alias: 'Entre: lights'
id: 2467611a-12d7-4a8d-8650-e18e25e5082b
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_daylight
- input_boolean.house_mode_outside_work
- trigger: state
id: movement
entity_id: input_boolean.front_movement
from: 'off'
to: 'on'
- trigger: state
id: movement_off
entity_id: input_boolean.front_movement
from: 'on'
to: 'off'
actions:
choose:
- alias: activate outdoor work mode
conditions:
- alias: when outside work mode is on
condition: state
entity_id:
- input_boolean.house_mode_outside_work
state: 'on'
sequence:
- alias: activate outside work scene
action: scene.turn_on
target:
entity_id: scene.outdoor_work_entre
data:
transition: 2
- conditions:
- condition: trigger
id: movement
- condition: state
entity_id:
- light.entre
state: 'on'
sequence:
- action: scene.turn_on
target:
entity_id: scene.outdoor_entre_movement
data:
transition: 2
- conditions:
condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'off'
sequence:
- action: scene.turn_on
target:
entity_id: scene.outdoor_entre_lights_default
data:
transition: 5
default:
- action: light.turn_off
target:
entity_id: light.entre
data:
transition: 5
- alias: 'Family room: lights'
id: 8b53f10d-df56-421e-9e89-08cb39f16c7d
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_bright_inside
- trigger: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
- trigger: state
entity_id: event.family_room_remote_action
not_from: unavailable
id: remote
- trigger: state
id: senile
entity_id:
- binary_sensor.motion_familyroom_occupancy
from: 'on'
to: 'off'
for:
minutes: '{{ states(''input_number.family_room_timeout'')|int }}'
actions:
choose:
- conditions:
- condition: trigger
id: remote
sequence:
- variables:
action: '{{ trigger.to_state.attributes.event_type }}'
- choose:
- conditions: '{{ action in [''on''] }}'
sequence:
- choose:
- conditions: '{{ states(''light.family_room_ceiling'') == ''off'' }}'
sequence:
- action: light.turn_on
target:
entity_id:
- light.family_room_ceiling
data:
brightness: 255
default:
- action: light.turn_off
target:
entity_id:
- light.family_room_ceiling
- conditions: '{{ action in [''brightness_move_up''] }}'
sequence:
- choose:
- conditions: '{{ state_attr(''light.family_room_ceiling'', ''brightness'')
in [none, 255] }}'
sequence:
- action: light.turn_on
target:
entity_id:
- light.family_room_ceiling
data:
brightness: 120
transition: 1
default:
- action: light.turn_on
target:
entity_id:
- light.family_room_ceiling
data:
brightness: 255
transition: 1
- conditions: '{{ action in [''off''] }}'
sequence:
- choose:
- conditions: '{{ states(''light.julgranen'') == ''off'' }}'
sequence:
- action: light.turn_on
target:
entity_id:
- light.julgranen
default:
- action: light.turn_off
target:
entity_id:
- light.julgranen
- conditions:
- condition: trigger
id: senile
sequence:
- action: light.turn_off
entity_id:
- light.family_room_ceiling
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_bright_inside
state: 'on'
sequence:
- &id003
action: light.turn_off
target:
entity_id:
- light.family_room_window_1
- light.mushroom_lamp
data:
transition: 5
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: input_datetime.time_goodmorning
before: input_datetime.time_goodnight
sequence:
- action: scene.turn_on
target:
entity_id:
- scene.family_room_ambience_lights_cozy
- scene.family_room_window_lights_cozy
data:
transition: 5
default:
- *id003
- alias: 'garage: lights'
id: b10a0b7d-74bb-48f7-aee5-6233c82149ab
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- binary_sensor.motion_garage_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_garage_occupancy
from: 'on'
to: 'off'
for:
seconds: 120
action:
- choose:
- alias: when triggered
conditions:
- alias: and motion is detected
condition: state
entity_id:
- binary_sensor.motion_garage_occupancy
state: 'on'
- alias: and we are home (intruder alert?!)
condition: state
entity_id:
- input_boolean.house_mode_away
state: 'off'
sequence:
- alias: doom
service: script.turn_on
target:
entity_id: script.garage_doom
- alias: 'Green house: door'
id: 7f5de8d7-4089-4876-9779-ef756fb850f2
triggers:
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- binary_sensor.greenhouse_door_contact
for: 00:05:00
- trigger: numeric_state
entity_id:
- sensor.gw3000a_wh31_ch1_temperature
below: 15
for: 00:05:00
actions:
choose:
- alias: when triggered
conditions:
- alias: and the door has been open for a while
condition: state
entity_id:
- binary_sensor.greenhouse_door_contact
state: 'on'
for: 00:05:00
- alias: and whenever the temperature is too low
condition: numeric_state
entity_id:
- sensor.gw3000a_wh31_ch1_temperature
below: 15
sequence:
- action: notify.castle
data:
title: Växthuset
message: 'Dags att stänga dörren (temperatur: {{ states("sensor.gw3000a_wh31_ch1_temperature")|float(1)
}}C)'
- alias: 'greenhouse: lights'
id: 7216dadf-1188-4654-b46d-065efd0ad292
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- scene_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_daylight
action:
choose:
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'off'
sequence:
- service: homeassistant.turn_on
target:
entity_id:
- light.greenhouse_plug
default:
- service: homeassistant.turn_off
target:
entity_id:
- light.greenhouse_plug
- alias: 'Guestroom: lights'
id: 16c47581-b4c4-4e37-8063-212582316df1
triggers:
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id: event.guestroom_remote_action
not_from: unavailable
id: remote
conditions: []
actions:
choose:
- conditions:
- condition: trigger
id: remote
sequence:
- variables:
action: '{{ trigger.to_state.attributes.event_type }}'
- choose:
- conditions: '{{ action == ''toggle'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.guestroom_ceiling
- conditions: '{{ action == ''brightness_up_click'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.guestroom_plug
- conditions: '{{ action == ''brightness_down_click'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.rabbit_lamp
- conditions: '{{ action == ''hold'' }}'
sequence:
- action: light.turn_on
target:
entity_id: light.guestroom_ceiling
data:
brightness: 255
rgb_color:
- 255
- 227
- 165
- conditions: '{{ action == ''arrow_left_click'' }}'
sequence:
- action: input_select.select_previous
target:
entity_id: input_select.rgb_lo
data:
cycle: true
- action: light.turn_on
target:
entity_id: light.guestroom_ceiling
data:
rgb_color: '{{ states(''input_select.rgb_lo'').split('':'')[1] }}'
- conditions: '{{ action == ''arrow_right_click'' }}'
sequence:
- action: input_select.select_next
target:
entity_id: input_select.rgb_lo
data:
cycle: true
- action: light.turn_on
target:
entity_id: light.guestroom_ceiling
data:
rgb_color: '{{ states(''input_select.rgb_lo'').split('':'')[1] }}'
- alias: 'Hallway downstairs: lights'
id: 55d4084a-e61b-4e2e-acaf-edc15146b8c8
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_bright_hallway
- trigger: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
- trigger: state
id: movement
entity_id:
- input_boolean.hallway_downstairs_movement
- trigger: state
id: media
entity_id:
- media_player.shield_cinema
to: playing
actions:
choose:
- conditions:
- condition: state
entity_id:
- input_boolean.hallway_downstairs_manual_mode
state: 'on'
sequence: []
- conditions:
- condition: trigger
id:
- movement
- media
sequence:
- choose:
- conditions:
- condition: state
entity_id:
- input_boolean.hallway_downstairs_movement
state: 'on'
- condition: state
entity_id:
- input_boolean.house_mode_bright_hallway
state: 'off'
sequence:
- choose:
- conditions:
- or:
- and:
- condition: state
entity_id:
- media_player.shield_cinema
state: playing
- condition: time
after: '20:00'
before: 06:00
- condition: time
after: '23:00'
before: 06:00
sequence:
- action: light.turn_on
target:
entity_id: light.hallen
data:
brightness: 60
transition: 1
default:
- action: light.turn_on
target:
entity_id: light.hallen
data:
brightness: 255
transition: 1
default:
- action: light.turn_off
target:
entity_id: light.hallen
data:
transition: 5
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_bright_hallway
state: 'on'
sequence:
- &id004
action: light.turn_off
target:
entity_id:
- light.hallway_downstairs_bench
data:
transition: 5
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: input_datetime.time_goodmorning
before: input_datetime.time_goodnight
- condition: state
entity_id:
- input_boolean.house_mode_bright_hallway
state: 'off'
sequence:
- action: scene.turn_on
target:
entity_id:
- scene.hallway_downstairs_ambience_lights_cozy
default:
- *id004
- alias: 'Hallway upstairs: lights'
id: 009d2374-2031-4d2d-b19d-349a5ac5c52f
mode: queued
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_bright_inside
- trigger: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
- trigger: state
id: no_movement
entity_id:
- binary_sensor.motion_hallway_upstairs_occupancy
from: 'on'
to: 'off'
for:
minutes: '{{ states(''input_number.hallway_upstairs_timeout'')|int }}'
- trigger: state
id: night_or_away
entity_id:
- input_boolean.house_mode_sleep
- input_boolean.house_mode_away
from: 'off'
to: 'on'
- trigger: state
entity_id: event.remote_hallway_upstairs_1_action
not_from: unavailable
id: remote
actions:
choose:
- conditions:
- condition: trigger
id: remote
sequence:
- variables:
action: '{{ trigger.to_state.attributes.event_type }}'
- choose:
- alias: on pressed
conditions: '{{ action in [''on''] }}'
sequence:
- choose:
- conditions: '{{ states(''light.hallway_upstairs_2'') == ''off'' }}'
sequence:
- action: light.turn_on
target:
entity_id:
- light.hallway_upstairs_2
data:
brightness: 255
default:
- action: light.turn_off
target:
entity_id:
- light.hallway_upstairs_2
- alias: off pressed
conditions: '{{ action in [''off''] }}'
sequence:
- choose:
- conditions: '{{ states(''light.hallway_upstairs_1'') == ''off'' }}'
sequence:
- action: light.turn_on
target:
entity_id:
- light.hallway_upstairs_1
data:
brightness: 255
default:
- action: light.turn_off
target:
entity_id:
- light.hallway_upstairs_1
- conditions:
- condition: trigger
id:
- no_movement
- night_or_away
sequence:
- action: light.turn_off
target:
entity_id:
- light.hallway_upstairs_1
- light.hallway_upstairs_2
data:
transition: 5
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_bright_inside
state: 'on'
sequence:
- &id005
action: light.turn_off
target:
entity_id:
- light.hallway_upstairs_window
data:
transition: 5
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: input_datetime.time_goodmorning
before: input_datetime.time_goodnight
sequence:
- action: scene.turn_on
target:
entity_id:
- scene.hallway_upstairs_window_lights_cozy
default:
- *id005
- alias: 'House: door update trigger'
id: 3daa6225-7b3d-4c85-9353-5cf4a482e9f7
trigger:
- platform: state
id: away
entity_id:
- input_boolean.house_mode_away
from: 'off'
to: 'on'
- platform: time_pattern
id: schedule
minutes: '1'
action:
- choose:
- conditions:
- condition: trigger
id: away
sequence:
- service: button.press
target:
entity_id: button.front_door_wake
- conditions:
- condition: trigger
id: schedule
- condition: state
entity_id:
- input_boolean.house_mode_away
state: 'off'
sequence:
- service: button.press
target:
entity_id: button.front_door_wake
- alias: 'House: door'
id: a0dd5741-07ea-4c5c-99ee-b94fe07b755e
trace:
stored_traces: 25
mode: restart
trigger:
- platform: state
entity_id:
- input_boolean.house_mode_away
from: 'off'
to: 'on'
for:
minutes: 1
variables:
action_lock: '{{ ''LOCK_'' ~ trigger.context_id }}'
action:
- choose:
conditions:
- condition: state
entity_id:
- lock.front_door
state: unlocked
sequence:
- alias: notify everyone
service: notify.family
data:
title: Ytterdörren
message: Dörren är olåst!
data:
tag: frontdoor
actions:
- action: '{{ action_lock }}'
title: Lås dörren
- alias: wait for respons
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: '{{ action_lock }}'
- alias: perform actions
choose:
- conditions: '{{ wait.trigger.event.data.action == action_lock }}'
sequence:
- service: lock.lock
target:
entity_id: lock.front_door
- alias: 'Kitchen: lights'
id: 12efc75c-0603-4bd2-91d9-3cffa6159a82
triggers:
- trigger: state
id: movement
entity_id:
- input_boolean.kitchen_movement
- trigger: state
id: nightaway
entity_id:
- input_boolean.house_mode_away
- input_boolean.house_mode_sleep
from: 'off'
to: 'on'
- trigger: state
entity_id:
- event.kitchen_remote_action
- event.kitchen_remote_2_action
not_from: unavailable
id: remote
- trigger: state
id: senile
entity_id:
- input_boolean.kitchen_movement
from: 'on'
to: 'off'
for:
minutes: '{{ states(''input_number.kitchen_timeout'')|int }}'
actions:
choose:
- conditions:
- condition: trigger
id: movement
sequence:
- choose:
- conditions: '{{ states("input_boolean.kitchen_movement") == "on" }}'
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_sink
data:
brightness: 255
default:
- action: light.turn_off
target:
entity_id: light.kitchen_sink
data:
transition: 5
- conditions:
- condition: trigger
id: senile
sequence:
- action: light.turn_off
entity_id:
- light.kitchen_island
- light.kitchen_table
- conditions:
- condition: trigger
id: remote
sequence:
- variables:
action: '{{ trigger.to_state.attributes.event_type }}'
- choose:
- alias: big pressed
conditions: '{{ action in [''big-press'', ''on'', ''brightness_up_click'']
}}'
sequence:
- choose:
- conditions: '{{ states(''light.kitchen_table'') == ''off'' }}'
sequence:
- action: light.turn_on
target:
entity_id:
- light.kitchen_table
data:
brightness: 255
default:
- action: light.turn_off
target:
entity_id:
- light.kitchen_table
- alias: small pressed
conditions: '{{ action in [''small-press'', ''off'', ''brightness_down_click'']
}}'
sequence:
- action: light.toggle
target:
entity_id: light.kitchen_island
- alias: left pressed
conditions: '{{ action in [''left-press'', ''arrow_left_click''] }}'
sequence:
- action: light.toggle
target:
entity_id: light.kitchen_bench
- alias: right pressed
conditions: '{{ action in [''right-press'', ''arrow_right_click''] }}'
sequence:
- action: light.toggle
target:
entity_id: light.conservatory_ceiling
- conditions:
- condition: trigger
id: nightaway
sequence:
- action: light.turn_off
target:
entity_id:
- light.kitchen_sink
- light.kitchen_table
- light.kitchen_island
default:
- action: light.turn_off
target:
entity_id:
- light.kitchen_table
- light.kitchen_island
data:
transition: 5
- alias: 'Movement: kitchen'
id: 7600e21e-5142-4dd0-8439-2fe4416ad473
trace:
stored_traces: 10
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
id: movement
entity_id:
- binary_sensor.motion_kitchen_occupancy
- binary_sensor.presence_kitchen_occupancy
from: 'off'
to: 'on'
- trigger: state
entity_id:
- binary_sensor.motion_kitchen_occupancy
- binary_sensor.presence_kitchen_occupancy
from: 'on'
to: 'off'
for:
minutes: 1
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected
condition: trigger
id: movement
sequence:
- alias: turn on helper
action: input_boolean.turn_on
target:
entity_id: input_boolean.kitchen_movement
default:
- choose:
conditions:
- condition: state
entity_id:
- binary_sensor.presence_kitchen_occupancy
- binary_sensor.motion_kitchen_occupancy
state: 'off'
sequence:
- alias: turn off helper
action: input_boolean.turn_off
target:
entity_id: input_boolean.kitchen_movement
- alias: 'Laundry room: lights'
id: ca853bcb-c701-4090-af6b-0aa888c17562
trace:
stored_traces: 25
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
id: movement
entity_id:
- input_boolean.laundryroom_movement
conditions: []
actions:
choose:
- conditions:
- condition: trigger
id: button
sequence:
- choose:
- conditions:
- alias: if ceiling light is off
condition: state
entity_id:
- switch.laundry_room_channel_1
state: 'off'
sequence:
- &id006
alias: turn on the lights
action: switch.turn_on
target:
entity_id: switch.laundry_room_channel_1
- &id007
alias: turn on bench light
action: light.turn_on
target:
entity_id: light.laundry_room_bench
data:
brightness: 120
transition: 1
default:
- &id008
alias: turn off the lights
action: homeassistant.turn_off
target:
entity_id:
- switch.laundry_room_channel_1
- light.laundry_room_bench
- conditions:
- alias: turn on lights when entering the room
condition: and
conditions:
- alias: if movement detected
condition: state
entity_id:
- input_boolean.laundryroom_movement
state: 'on'
sequence:
- choose:
- conditions:
- alias: if time is between
condition: time
after: 07:30:00
before: '22:00:00'
sequence:
- *id006
- *id007
default:
- *id007
default:
- *id008
- alias: 'Movement: laundryroom'
id: bc7852b3-a205-4a37-a2d3-946e33baee6f
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: movement
entity_id:
- binary_sensor.motion_laundry_room_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_laundry_room_occupancy
from: 'on'
to: 'off'
for:
minutes: 3
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected
condition: trigger
id: movement
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.laundryroom_movement
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.laundryroom_movement
- alias: 'Livingroom: lights'
id: 426174fb-2fc8-41e3-8e92-62f37ef26c54
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- scene_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_bright_inside
- trigger: state
entity_id: event.livingroom_remote_action
not_from: unavailable
id: remote
- trigger: state
id: night_or_away
entity_id:
- input_boolean.house_mode_sleep
- input_boolean.house_mode_away
from: 'off'
to: 'on'
- trigger: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
actions:
choose:
- conditions:
- condition: trigger
id: remote
sequence:
- variables:
action: '{{ trigger.to_state.attributes.event_type }}'
- choose:
- conditions: '{{ action == ''on'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.livingroom_front_1
- conditions: '{{ action == ''off'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.livingroom_back_3
- conditions: '{{ action == ''brightness_move_up'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.vardagsrum_framre
- conditions: '{{ action == ''brightness_move_down'' }}'
sequence:
- action: light.toggle
target:
entity_id: light.vardagsrum_bakre
default:
- delay:
milliseconds: 1
- conditions:
- condition: trigger
id: night_or_away
sequence:
- action: light.turn_off
target:
entity_id:
- light.vardagsrum_framre
- light.vardagsrum_bakre
- light.floor_lamp
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: input_datetime.time_goodmorning
before: input_datetime.time_goodnight
- condition: state
entity_id:
- input_boolean.house_mode_bright_inside
state: 'off'
sequence:
- action: scene.turn_on
target:
entity_id:
- scene.livingroom_ambience_lights_cozy
- scene.livingroom_window_lights_cozy
data:
transition: 5
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_bright_inside
state: 'on'
sequence:
- &id009
action: light.turn_off
target:
entity_id:
- light.floor_lamp
- light.livingroom_window_1
data:
transition: 5
default:
- *id009
- alias: 'livingroom: air cleaner'
id: 61dc9746-9143-4d5e-8bc5-d282cad4391b
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_away
- input_boolean.house_mode_sleep
action:
choose:
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_guests
state: 'off'
- condition: state
entity_id:
- input_boolean.house_mode_sleep
state: 'on'
sequence:
- service: fan.set_percentage
target:
entity_id: fan.livingroom_starkvind
data:
percentage: 55
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_away
state: 'on'
sequence:
- service: fan.set_percentage
target:
entity_id: fan.livingroom_starkvind
data:
percentage: 55
default:
- service: fan.set_percentage
target:
entity_id: fan.livingroom_starkvind
data:
percentage: 11
- alias: 'staircase: lights'
id: b735976f-ca85-42bb-a5eb-6cd714297d7b
triggers:
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- binary_sensor.motion_staircase_occupancy
from: 'off'
to: 'on'
- trigger: state
id: nomotion
entity_id:
- binary_sensor.motion_staircase_occupancy
from: 'on'
to: 'off'
for:
seconds: 180
action:
- choose:
- conditions:
- condition: state
entity_id:
- binary_sensor.motion_staircase_occupancy
state: 'on'
- condition: state
entity_id:
- input_boolean.house_mode_away
state: 'off'
- condition: time
before: input_datetime.time_goodmorning
after: input_datetime.time_goodnight
sequence:
- action: light.turn_on
target:
entity_id: light.staircase
data:
brightness: 20
- conditions:
- condition: trigger
id: nomotion
- condition: time
before: input_datetime.time_goodmorning
after: input_datetime.time_goodnight
sequence:
- action: light.turn_off
target:
entity_id: light.staircase
- alias: 'Movement: techroom'
id: 4a346b19-87e7-4d09-99ec-019d7ec05237
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: movement
entity_id:
- binary_sensor.motion_techroom_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_techroom_occupancy
from: 'on'
to: 'off'
for:
minutes: 10
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected
condition: trigger
id: movement
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.techroom_movement
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.techroom_movement
- alias: 'Terrace: lights'
id: 3b25b5a0-8281-4d08-b624-aa37eaa7db56
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- scene_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_daylight
action:
choose:
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'off'
sequence:
- service: light.turn_on
target:
entity_id:
- light.terrace
data:
transition: 5
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'on'
sequence:
- &id010
service: light.turn_off
target:
entity_id:
- light.terrace
data:
transition: 5
default:
- *id010
- alias: 'toilet: lights'
id: d4e1013c-70e8-432c-a3fc-7923bd3f0639
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- binary_sensor.motion_toilet_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_toilet_occupancy
from: 'on'
to: 'off'
for:
seconds: 180
action:
- choose:
- alias: when triggered
conditions:
- alias: and motion is detected
condition: state
entity_id:
- binary_sensor.motion_toilet_occupancy
state: 'on'
- alias: and we are home (cat's can poop in the dark)
condition: state
entity_id:
- input_boolean.house_mode_away
state: 'off'
sequence:
- choose:
- conditions:
- alias: if it's night
condition: time
after: input_datetime.time_goodnight
before: input_datetime.time_goodmorning
sequence:
- alias: turn on the lights at low level
service: light.turn_on
target:
entity_id: light.upper_toilet
data:
brightness: 70
default:
- alias: turn on the lights
service: light.turn_on
target:
entity_id: light.upper_toilet
data:
brightness: 250
default:
- alias: turn off the lights
service: light.turn_off
target:
entity_id: light.upper_toilet
- alias: Notify when Bahnhof changes the price
id: 3383e3b4-bbfe-4542-94f8-879e188762f3
triggers:
trigger: state
entity_id: sensor.servanet_bahnhof_price
not_from:
- none
- unknown
- unavailable
- 'null'
not_to:
- none
- unknown
- unavailable
- 'null'
action:
- choose:
- conditions: '{% set ignore = [''unknown'', ''unavailable'', ''none'', '''',
null] %} {{ trigger.from_state.state not in ignore and trigger.to_state.state
not in ignore and trigger.to_state.state != trigger.from_state.state }}
'
sequence:
- action: notify.castle_log
data:
title: Bahnhof
message: 'Priset har ändrats från {{trigger.from_state.state}}kr till {{trigger.to_state.state}}kr
'
- alias: 'livingroom: turn off cinema if we leave the house'
id: 9dd4d185-e6d1-4cb7-80ba-bb32fc3968ca
mode: queued
trigger:
- platform: state
entity_id:
- input_boolean.house_mode_away
to: 'on'
action:
choose:
- conditions:
- condition: state
entity_id:
- media_player.home_theater
state:
- 'on'
- playing
sequence:
- service: homeassistant.turn_off
target:
entity_id: media_player.home_theater
- service: notify.castle_log
data:
title: Hemmabion
message: Stängde av då ingen är hemma
default: []
- alias: 'livingroom: turn off window lights when watching tv'
id: f70a86c9-a93f-41c0-96c7-d89108586cf0
mode: queued
triggers:
- trigger: state
entity_id:
- media_player.home_theater
- input_boolean.house_mode_bright_inside
- trigger: state
entity_id: media_player.android_tv_10_5_50_73
actions:
choose:
- conditions:
- condition: state
entity_id: media_player.home_theater
state: 'on'
- condition: state
entity_id: media_player.android_tv_10_5_50_73
state: playing
- condition: state
entity_id: input_boolean.house_mode_bright_inside
state: 'off'
sequence:
- action: light.turn_off
target:
entity_id: light.livingroom_window_1
data:
transition: 5
- conditions:
- condition: state
entity_id: input_boolean.house_mode_bright_inside
state: 'off'
- condition: time
before: input_datetime.time_goodnight
after: input_datetime.time_goodmorning_weekend
sequence:
- action: light.turn_on
target:
entity_id: light.livingroom_window_1
data:
transition: 5
default: []
- alias: 'Kitchen: Coffee water level meter'
id: 20fa1fcc-eae1-4428-9e2b-cfea2619e154
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id: sensor.coffee_maker_state
condition: []
action:
- choose:
conditions:
- condition: state
entity_id: sensor.coffee_maker_state
state: 'off'
sequence:
- action: light.turn_off
target:
entity_id: light.coffeemaker_water_level_light
default:
- action: light.turn_on
target:
entity_id: light.coffeemaker_water_level_light
- choose:
- conditions:
- condition: state
entity_id: light.kitchen_bench
state: 'off'
- condition: state
entity_id: input_boolean.house_mode_bright_hallway
state: 'off'
sequence:
action: light.turn_on
target:
entity_id: light.kitchen_bench
- alias: 'Kitchen: conservatory door'
id: cc0a71fe-be26-4d54-b926-f146380f4487
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- binary_sensor.conservatory_door_contact
for: 00:10:00
- platform: state
entity_id:
- sensor.conservatory_temperature
- sensor.kitchen_temperature
action:
choose:
- alias: when triggered
conditions:
- alias: and the door has been open for a while
condition: state
entity_id:
- binary_sensor.conservatory_door_contact
state: 'on'
for: 00:10:00
- alias: and the temperature difference is above the limit
condition: template
value_template: '{{ ((states("sensor.kitchen_temperature")|float(0) - states("sensor.conservatory_temperature")|float(0))
> 4) and states("sensor.kitchen_temperature")|float(0) < 20 }}'
sequence:
- service: notify.family
data:
title: Uterummet
message: Dags att stänga dörren ({{ (states("sensor.kitchen_temperature")|float(0)
- states("sensor.conservatory_temperature")|float(0))|round(1) }}C kallare
än inne)
- alias: Notify when CTC releases new software
id: 4729a25a-8eef-421d-8460-b932bc27d4ce
triggers:
trigger: state
entity_id: sensor.ctc_software_version
not_from:
- none
- unknown
- unavailable
- 'null'
not_to:
- none
- unknown
- unavailable
- 'null'
actions:
- choose:
- conditions: '{% set ignore = [''unknown'', ''unavailable'', ''none'', '''',
null] %} {{ trigger.from_state.state not in ignore and trigger.to_state.state
not in ignore and trigger.to_state.state != trigger.from_state.state }}
'
sequence:
- action: notify.castle_log
data:
title: CTC
message: 'CTC har släppt en ny mjukvaruversion: {{trigger.to_state.state}}
(gamla: {{trigger.from_state.state}})
'
- alias: 'Dishwasher: reminder'
id: 6c309c9c-d7d0-440a-a49f-fc4e97dcfa76
trace:
stored_traces: 20
trigger:
- platform: state
id: start
entity_id:
- sensor.012050386564014027_bsh_common_status_operationstate
from:
- BSH.Common.EnumType.OperationState.Ready
- BSH.Common.EnumType.OperationState.DelayedStart
to: BSH.Common.EnumType.OperationState.Run
- platform: state
id: finished
entity_id:
- sensor.012050386564014027_bsh_common_status_operationstate
from: BSH.Common.EnumType.OperationState.Run
to: BSH.Common.EnumType.OperationState.Finished
action:
choose:
- conditions:
- condition: trigger
id: start
sequence:
- service: input_number.set_value
target:
entity_id: input_number.dishwasher_start
data:
value: '{{ states(''sensor.shelly_dishwasher_energy'')|float(0) }}'
- conditions:
- condition: trigger
id: finished
sequence:
- variables:
consumption: '{{ (states(''sensor.shelly_dishwasher_energy'')|float(0) -
states(''input_number.dishwasher_start'')|float(0))|round(2) }}'
- service: notify.castle
data:
title: Diskmaskinen
message: 'Disken klar! (förbrukning: {{consumption}}kWh)'
- alias: 'Dishwasher: intelligent start'
id: c2d665a4-53ca-4456-ae99-be0a6a37dc8e
trace:
stored_traces: 20
trigger:
- platform: state
entity_id:
- binary_sensor.012050386564014027_bsh_common_status_remotecontrolstartallowed
from: 'off'
to: 'on'
action:
choose:
- conditions:
and:
- condition: state
entity_id:
- binary_sensor.012050386564014027_bsh_common_status_remotecontrolstartallowed
state: 'on'
sequence:
- service: notify.castle
data:
title: Diskmaskinen
message: 'Kommer starta diskmaskinen {{ as_timestamp(states(''sensor.el_next_cheapest_hour''))|timestamp_custom(''%d/%m
%H:%M'') }}
'
- service: tts.google_translate_say
data:
entity_id: media_player.kitchen_display
language: sv
message: "{% set add = '' %} {% if (as_datetime(states('sensor.el_next_cheapest_hour')).day\
\ == now().day) %}\n {% if (as_datetime(states('sensor.el_next_cheapest_hour')).hour\
\ > 18) %}\n {% set add = 'ikväll' %}\n {% endif %}\n{% else %}\n\
\ {% set add = 'i morgon' %}\n {% if (as_datetime(states('sensor.el_next_cheapest_hour')).hour\
\ < 6) %}\n {% set add = 'inatt' %}\n {% endif %}\n{% endif %} \"\
Kommer starta diskmaskinen klockan {{ as_datetime(states('sensor.el_next_cheapest_hour')).hour\
\ }} {{add}}\"\n"
- service: home_connect_alt.start_program
data:
device_id: 7b6022c5a26eda9e5f48679e4274a490
program_key: Dishcare.Dishwasher.Program.Kurz60
options:
- key: BSH.Common.Option.StartInRelative
value: '{{ (as_datetime(states(''sensor.el_next_cheapest_hour''))-now()).seconds
}}'
- alias: 'Boiler room: door'
id: c17f73fe-8285-494b-b502-e7d42c39c832
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- binary_sensor.boiler_room_door_contact
from: 'off'
to: 'on'
for:
minutes: 10
- platform: state
entity_id:
- binary_sensor.boiler_room_door_contact
from: 'on'
to: 'off'
- platform: time
at: '21:00:00'
condition: []
variables:
anchors:
- &id012
service: notify.family
data:
title: Pannrumet
message: Dörren är öppen!
data:
tag: boilerroom
- service: notify.family
data:
title: Pannrummet
message: Tack!
data:
tag: boilerroom
timeout: 900
- &id014
service: notify.family
data:
message: clear_notification
data:
tag: boilerroom
- &id011
service: persistent_notification.create
data:
title: Pannrummet
message: Pannrumsdörren är öppen!
notification_id: feed_boilerroom
- &id013
service: persistent_notification.dismiss
data:
notification_id: feed_boilerroom
action:
- choose:
- conditions:
condition: state
entity_id:
- binary_sensor.boiler_room_door_contact
state: 'on'
sequence:
- *id011
- *id012
default:
- *id013
- *id014
- alias: 'House: door bell'
id: 54036205-5324-4d60-aa95-e24f9ff99a34
trace:
stored_traces: 25
mode: single
trigger:
- platform: state
entity_id:
- binary_sensor.wardrobe_terrace_bt_proxy_door_bell
- binary_sensor.front_door_doorbell_ding
from: 'off'
to: 'on'
variables:
anchors:
- &id015
service: notify.family
data:
title: Dörrklockan
message: Det ringer på dörrklockan!
data:
tag: door_bell
timeout: 900
action:
choose:
conditions:
- condition: state
entity_id: input_boolean.house_mode_away
state: 'off'
sequence:
- *id015
default:
- *id015
- alias: 'eHub: system state'
id: e0e5220c-f753-4adb-9a48-d574928ada9c
mode: queued
trace:
stored_traces: 10
trigger:
- platform: state
entity_id:
- sensor.ferroamp_xl28_system_state
not_from:
- none
- unknown
- unavailable
not_to:
- none
- unknown
- unavailable
action:
choose:
- conditions: '{{ trigger.to_state.state|int > 0 }}'
sequence:
- service: notify.castle_log
data:
title: Ferroamp ehub
message: "{% set e = trigger.to_state.state|string %} {% set x = ('0x'+e)|int(base=16,\
\ default=0) %} {% set v = 1 %} {% set f = namespace(ecodes=[])%} {% for\
\ i in range(0,100) %}\n {% set v = (2**i) %}\n {% if x|bitwise_and(v)\
\ == v %}\n {% set f.ecodes = f.ecodes + [i+1] %}\n {% endif %}\n\
{% endfor %} {{trigger.to_state.name}}: {{trigger.to_state.state}} (codes:\
\ {{f.ecodes}})\n"
default:
- service: notify.castle_log
data:
title: Ferroamp ehub
message: '{{trigger.to_state.name}} rapporterar state ''0''
'
- alias: Spot price change
id: 0fc03d6f-62ca-4a0f-b8a6-52873e84d2d5
trace:
stored_traces: 25
mode: single
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- sensor.nordpool_se2
actions:
- action: input_number.set_value
target:
entity_id: input_number.electricity_price_level
data:
value: "{% set s = states('sensor.nordpool_se2')|float %}\n{% if s > 2.5 %}\
\ {% set p = 5 %} {% elif s > 1.5 %} {% set p = 4 %} {% elif s > 0.5 %} {%\
\ set p = 3 %} {% elif s >= 0 %} {% set p = 2 %} {% elif s < 0 %} {% set p\
\ = 1 %} {% endif %} {% if states('sensor.momentary_active_export')|float\
\ > 1 and p <= 2 %}\n {% set p = p - 1 %}\n{% endif %} {{p}}\n"
- alias: 'boiler: bottom reminder'
id: a8a350a1-44dc-4a92-b272-7336812df8e4
trigger:
- platform: numeric_state
entity_id: sensor.boiler_climate_acc_tank_bottom
below: 40
for:
minutes: 15
action:
- service: notify.family
data:
title: Vedpannan
message: 'Dags att elda! (Acktank botten: {{ states(''sensor.boiler_climate_acc_tank_bottom'')
}}C)'
data:
tag: boiler
sticky: true
push:
badge: 1
- alias: 'boiler: middle reminder'
id: db5a1105-9962-4ed3-8959-aa2f97e37b31
trigger:
- platform: numeric_state
entity_id: sensor.boiler_climate_acc_tank_mid
below: 60
for:
minutes: 15
action:
- service: notify.family
data:
title: Vedpannan
message: 'Hög till att elda! (Acktank mitten: {{ states(''sensor.boiler_climate_acc_tank_mid'')
}}C)'
data:
tag: boiler
sticky: true
push:
badge: 2
- alias: 'boiler: reset'
id: e2b1fa65-55e5-47a1-8420-1b0e4cda14e4
trigger:
- platform: numeric_state
entity_id: sensor.boiler_climate_acc_tank_bottom
above: 40
for:
minutes: 15
action:
- service: notify.family
data:
message: clear_notification
data:
tag: boiler
- alias: 'boiler: add wood'
id: b810302f-435f-4c2e-a69b-fbc1321d56f8
trigger:
- platform: numeric_state
entity_id:
- sensor.boiler_climate_wood_boiler_supply
below: 80
condition:
- condition: numeric_state
entity_id:
- sensor.boiler_climate_acc_tank_bottom
below: 70
action:
- service: notify.family
data:
title: Vedpannan
message: 'Dags att lägga i mera ved! (Acktank botten: {{ states(''sensor.boiler_climate_acc_tank_bottom'')
}}C)'
data:
tag: boiler
sticky: true
push:
badge: 3
- alias: 'Shower: start floor heating when shower starts'
id: 818c0f02-8d9c-4859-bfc2-ecf54897bace
trigger:
- platform: numeric_state
entity_id:
- sensor.shower_derivative
above: 50
action:
- choose:
- conditions:
- alias: when spot price is too high
condition: numeric_state
entity_id: input_number.electricity_price_level
above: 3
sequence:
- service: notify.castle_log
data:
title: Duschen
message: Någon har duschat, men för dyr el för att starta golvvärmen!
- service: switch.turn_off
target:
entity_id: switch.laundry_room_channel_2
- conditions:
condition: state
entity_id:
- switch.laundry_room_channel_2
state: 'off'
sequence:
- service: notify.castle_log
data:
title: Duschen
message: 'Någon har duschat, startar golvvärmen (derivat: {{trigger.to_state.state}})'
- service: switch.turn_on
target:
entity_id: switch.laundry_room_channel_2
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.shower_last_detected
data:
timestamp: '{{ now().timestamp() }}'
- alias: 'Shower: turn off floor heating'
id: decdc5d9-5bd0-41ab-bf91-7e77a38e49b3
mode: queued
trace:
stored_traces: 25
trigger:
- platform: template
id: endtime
value_template: '{{ now().timestamp() - states.input_datetime.shower_last_detected.attributes.timestamp
> 7200 }}'
- platform: numeric_state
id: endder
entity_id:
- sensor.shower_derivative
below: 50
for:
minutes: 120
- platform: state
id: motion
entity_id:
- binary_sensor.motion_bathroom_upstairs_occupancy
- platform: time_pattern
id: time
minutes: '5'
action:
choose:
- conditions:
condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id:
- motion
- time
- condition: state
entity_id:
- switch.laundry_room_channel_2
state: 'on'
for:
minutes: 240
- condition: and
conditions:
- condition: trigger
id:
- endtime
- endder
- condition: state
entity_id:
- switch.laundry_room_channel_2
state: 'on'
sequence:
- service: notify.castle_log
data:
title: Duschen
message: 'Stängde av golvvärmen nu efter {{ (now().timestamp() - states.switch.laundry_room_channel_2.last_changed.timestamp())|timestamp_custom(''%-Ht%-Mm'',
false) }} (trigger: {{trigger.id}})'
- service: switch.turn_off
target:
entity_id: switch.laundry_room_channel_2
- alias: Freezer temperature alarm
id: e473c7d9-772e-4084-a3aa-9ad6b20781d7
triggers:
- trigger: numeric_state
entity_id:
- sensor.laundry_freezer_temperature
- sensor.garage_freezer_temperature
above: -15
for:
minutes: 1
actions:
- action: notify.family
data_template:
title: Frysen
message: "{% set mapper = {\n 'sensor.freezer_kitchen_temperature' : 'frysen\
\ i köket',\n 'sensor.laundry_freezer_temperature' : 'frysen i tvättstugan',\n\
\ 'sensor.garage_freezer_temperature' : 'frysen i garaget'\n} %} \"För hög\
\ temperatur i {{ mapper[trigger.entity_id] }}! ({{ trigger.to_state.state\
\ }}C)\"\n"
data:
tag: freezer
sticky: true
- alias: Freezer critical temperature alarm
id: 434a2b9a-4da7-4bd2-9229-b755ce7d3379
triggers:
- trigger: numeric_state
entity_id:
- sensor.laundry_freezer_temperature
- sensor.garage_freezer_temperature
above: -10
for:
minutes: 1
actions:
- repeat:
while:
- condition: template
value_template: '{{ trigger.to_state.state > -10 }}'
sequence:
- action: notify.family
data_template:
title: Frysen kritisk!
message: "{% set mapper = {\n 'sensor.freezer_kitchen_temperature' : 'frysen\
\ i köket',\n 'sensor.laundry_freezer_temperature' : 'frysen i tvättstugan',\n\
\ 'sensor.garage_freezer_temperature' : 'frysen i garaget'\n} %} \"Kritisk\
\ temperatur i {{ mapper[trigger.entity_id] }}! ({{ trigger.to_state.state\
\ }}C)\"\n"
data:
tag: freezer
sticky: true
ttl: 0
priority: high
channel: alarm_stream
- delay:
minutes: 15
- alias: 'Driveway: objects'
id: 694696c1-1ef4-49a4-a340-9edfe3e84652
trace:
stored_traces: 10
trigger:
- platform: state
entity_id:
- sensor.driveway_bus_count
- sensor.driveway_car_count
- sensor.driveway_cat_count
- sensor.driveway_horse_count
- sensor.driveway_bike_count
- sensor.driveway_person_count
not_from:
- unknown
- unavailable
- none
action:
- choose:
- conditions: '{{ trigger.to_state.state > trigger.from_state.state }}'
sequence:
- variables:
object: '{{ trigger.entity_id.split(''_'')[1] }}'
- service: counter.increment
target:
entity_id: counter.driveway_{{object}}
- alias: 'frigate: improve contrast'
id: 01e2891c-1639-4188-9b6e-6f85a5fe3ef8
trace:
stored_traces: 10
triggers:
trigger: time
at:
- 02:35
actions:
- action: mqtt.publish
data:
topic: frigate/restart
payload: justdoit
- alias: 'frigate: improve contrast'
id: 1ceb3ae2-9210-4eb2-8006-be665ee1bcad
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id: input_boolean.house_mode_daylight
action:
choose:
conditions:
condition: state
entity_id: input_boolean.house_mode_daylight
state: 'on'
sequence:
repeat:
for_each: &id016
- barn
- driveway
- parking
- parking_barn
- parking_house
sequence:
- service: mqtt.publish
data:
qos: 0
topic: frigate/{{repeat.item}}/improve_contrast/set
payload: 'OFF'
default:
repeat:
for_each: *id016
sequence:
- service: mqtt.publish
data:
qos: 0
topic: frigate/{{repeat.item}}/improve_contrast/set
payload: 'ON'
- alias: 'grid: voltage'
id: 5bc946bf-8ab1-4791-bb9b-dbcebf2282dd
triggers:
- trigger: numeric_state
entity_id:
- sensor.voltage_phase_1
- sensor.voltage_phase_2
- sensor.voltage_phase_3
below: 200
id: low_voltage
variables:
data: &id017
importance: high
ttl: 0
tag: grid
sticky: true
visibility: public
actions:
- choose:
- conditions:
- condition: trigger
id: low_voltage
sequence:
- action: notify.family
data_template:
title: Nätanslutning!
message: Spänningen på {{ trigger.entity_id }} är {{ trigger.to_state.state
}}V
data: *id017
- action: notify.castle
data:
title: Nätanslutning!
message: Spänningen på {{ trigger.entity_id }} är {{ trigger.to_state.state
}}V
- alias: Report version on startup
id: 1faad88f-0758-4ef9-820e-d31df12a46b2
trigger:
- platform: homeassistant
event: start
action:
- service: rest_command.report_ha_version
data:
user: secret ha_report_user
- alias: Notify on new HA version
id: f98ff89c-0513-4993-a404-8e72f01da65a
trigger:
platform: state
id: version
entity_id: sensor.latest_ha_version
not_from:
- none
- unknown
- unavailable
- 'null'
not_to:
- none
- unknown
- unavailable
- 'null'
action:
- choose:
- conditions: '{% set ignore = [''unknown'', ''unavailable'', ''none'', '''',
null] %} {{ trigger.from_state.state not in ignore and trigger.to_state.state
not in ignore and trigger.to_state.state != trigger.from_state.state }}
'
sequence:
- service: notify.mobile_app_kb2003
data:
title: New HA release
message: 'version: {{ states(''sensor.latest_ha_version'') }}'
- alias: 'House: floor heat circulation pump'
id: 30e75135-6044-4d14-bc8c-75ba60c7fe0e
trace:
stored_traces: 25
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- sensor.ctc_hs1_status
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id:
- sensor.ctc_hs1_status
state: '0'
sequence:
- service: switch.turn_off
target:
entity_id: switch.floor_heating_circulation_pump
default:
- service: switch.turn_on
target:
entity_id:
- switch.floor_heating_circulation_pump
- alias: 'House: vvc'
id: 9108277c-4a52-47f6-8481-32813b096a0f
mode: queued
trace:
stored_traces: 25
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_away
- input_boolean.house_mode_sleep
- zone.home
- input_number.electricity_price_level
- input_boolean.house_vvc_preheat
- trigger: time
at:
- 06:00:00
- '21:00:00'
- 06:30:00
- 08:00:00
- '10:45:00'
- '11:30:00'
- '16:00:00'
- '18:00:00'
condition: []
actions:
choose:
- conditions:
- alias: when house mode is set to
condition: or
conditions:
- alias: away
condition: state
entity_id: input_boolean.house_mode_away
state: 'on'
- alias: sleeping
condition: state
entity_id: input_boolean.house_mode_sleep
state: 'on'
sequence:
- &id018
alias: turn off vvc
action: input_boolean.turn_off
target:
entity_id: input_boolean.house_vvc
- conditions:
- alias: when preheat is active
condition: state
entity_id: input_boolean.house_vvc_preheat
state: 'on'
sequence:
- &id019
alias: turn on vvc
action: input_boolean.turn_on
target:
entity_id: input_boolean.house_vvc
- conditions:
- alias: when spot price is too high
condition: numeric_state
entity_id: input_number.electricity_price_level
above: 3
sequence:
- *id018
- conditions: '{{ (states(''zone.home'')|int(0) == 1 and state_attr(''zone.home'',
''persons'')[0] == ''person.linus'' and states(''input_boolean.workday_linus'')
== ''on'') and states(''input_number.electricity_price_level'')|float(3) >
2 }}'
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: time
after: 06:30:00
before: 08:00:00
- condition: time
after: '10:45:00'
before: '11:30:00'
- condition: time
after: '16:00:00'
before: '18:00:00'
sequence:
- *id019
default:
- *id018
- conditions:
- condition: time
after: 06:00:00
before: '21:00:00'
sequence:
- *id019
default:
- *id018
- alias: 'House: vvc switch'
id: b755328d-ad0c-4f7f-94e4-50d583e06639
mode: queued
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- input_boolean.house_vvc
- input_boolean.house_vvc_block
- input_boolean.boilerroom_manual_mode
- input_number.vvc_stop
- input_number.vvc_diff
- trigger: numeric_state
id: vvc_start
entity_id:
- sensor.wardrobe_house_hot_water_supply
below: 0
value_template: '{% set offset = states(''input_number.vvc_stop'')|float(0) -
states(''input_number.vvc_diff'')|float(0) %} {{ states(''sensor.wardrobe_house_hot_water_supply'')|float(0)
- offset }}
'
- trigger: numeric_state
id: vvc_stop
entity_id:
- sensor.wardrobe_house_hot_water_supply
above: input_number.vvc_stop
conditions: []
actions:
choose:
- conditions:
- alias: if block switch is active
condition: state
entity_id:
- input_boolean.house_vvc_block
state: 'on'
sequence:
alias: always turn off vvc
action: switch.turn_off
target:
entity_id: switch.vvc_pump
- conditions:
condition: and
conditions:
- alias: if vvc should be on
condition: state
entity_id:
- input_boolean.house_vvc
state: 'on'
- alias: and manual mode is off
condition: state
entity_id:
- input_boolean.boilerroom_manual_mode
state: 'off'
sequence:
- choose:
- conditions:
- condition: numeric_state
entity_id:
- sensor.wardrobe_house_hot_water_supply
below: input_number.vvc_stop
sequence:
action: switch.turn_on
target:
entity_id: switch.vvc_pump
default:
- &id020
action: switch.turn_off
target:
entity_id: switch.vvc_pump
default:
- *id020
- alias: 'House: vvc preheat'
id: d7bb04cd-922f-4515-8eba-90c59f2e37c8
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- input_boolean.house_vvc_preheat
from: 'off'
to: 'on'
for: 00:10:00
actions:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.house_vvc_preheat
- alias: 'Boiler room: heatpump add heater active'
id: 2bafd69e-6ba4-47b6-a2cb-e11aa6585759
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: numeric_state
id: heater
entity_id:
- sensor.ctc_power_immersion_heater_upper
- sensor.ctc_power_immersion_heater_lower
above: 0
condition: []
variables:
anchors:
- &id022
service: notify.family
data:
title: Pannrummet
message: Värmepumpen går på tillsatsvärme!
data:
tag: ctc
- service: notify.family
data:
title: Pannrummet
message: Tack!
data:
tag: ctc
timeout: 900
- &id024
service: notify.family
data:
message: clear_notification
data:
tag: ctc
- &id021
service: persistent_notification.create
data:
title: Pannrummet
message: Värmepumpen går på tillsatsvärme!
notification_id: feed_ctc
- &id023
service: persistent_notification.dismiss
data:
notification_id: feed_ctc
action:
- choose:
- alias: if consumption goes above 0
conditions:
condition: trigger
id: heater
sequence:
- *id021
- *id022
- alias: if current consumption alredy above 0
conditions:
condition: numeric_state
entity_id:
- sensor.ctc_power_immersion_heater_upper
- sensor.ctc_power_immersion_heater_lower
above: 0
sequence:
- *id021
- *id022
default:
- *id023
- *id024
- alias: 'Boiler room: heatpump select circuit for utility meters'
id: 20a9b1ed-82fb-4207-9e38-47e5483bb15a
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
id: hotwater
entity_id:
- sensor.ctc_status
condition: []
action:
- service: select.select_option
target:
entity_id:
- select.heatpump_circuit_daily_energy
- select.heatpump_circuit_weekly_energy
- select.heatpump_circuit_monthly_energy
- select.heatpump_circuit_yearly_energy
- select.heatpump_circuit_energy
data:
option: '{{ ''for_hw'' if is_state(''sensor.ctc_status'', ''5'') else ''for_hs''
}}'
- alias: 'E2013: press identify to keep alive'
id: 47f449a4-9745-4d9f-b9ca-80b681f42fad
trace:
stored_traces: 10
triggers:
- trigger: time_pattern
minutes: /10
conditions: []
actions:
- action: button.press
target:
entity_id:
- button.conservatory_slidewindow_1_identify
- button.conservatory_slidewindow_2_identify
- button.conservatory_slidewindow_3_identify
- button.conservatory_ext_door_identify
- button.terrace_slidewindows_identify
- alias: 'krisinformation: notify'
id: 867a2339-c168-4721-8dff-627547df2e02
triggers:
- trigger: state
entity_id:
- sensor.krisinformation_vasternorrlands_lan
id: kris
not_to: '0'
variables:
data:
importance: high
ttl: 0
tag: kris
sticky: true
visibility: public
actions:
- choose:
- conditions:
- condition: trigger
id: kris
sequence:
- action: notify.castle
data:
title: '{{ state_attr(''sensor.krisinformation_vasternorrlands_lan'', ''alerts'')[0][''alerts'']
}}'
message: '[{{ state_attr(''sensor.krisinformation_vasternorrlands_lan'',
''alerts'')[0][''severity''] }}] {{ state_attr(''sensor.krisinformation_vasternorrlands_lan'',
''alerts'')[0][''description''] }}'
- alias: 'lightning: notify'
id: 2d6264bb-66c5-45c5-9749-ad22b6eec0f5
triggers:
- trigger: state
entity_id:
- sensor.blitzortung_lightning_counter
id: lightning
not_to: '0'
variables:
data:
importance: high
ttl: 0
tag: lightning
sticky: true
visibility: public
actions:
- choose:
- conditions:
- condition: trigger
id: lightning
- condition: numeric_state
entity_id: sensor.blitzortung_lightning_distance
below: 3
sequence:
- action: notify.castle
data:
title: Blixtnedslag
message: '{% set direction = [''N'',''NNE'',''NE'',''ENE'',''E'',''ESE'',''SE'',''SSE'',''S'',''SSW'',''SW'',''WSW'',''W'',''WNW'',''NW'',''NNW'',''N'']
%} {% set degree = states(''sensor.blitzortung_lightning_azimuth'')|float
%} {% set dir = direction[((degree+11.25)/22.5)|int] %} "Blixtnerslag
{{ states(''sensor.blitzortung_lightning_distance'')}}km åt {{dir}}"
'
- alias: 'bathroom downstairs: lights'
id: 2f16522d-300d-4c7f-8a5c-d00d283b9438
mode: queued
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- binary_sensor.motion_bathroom_downstairs_occupancy
from: 'off'
to: 'on'
- trigger: state
entity_id:
- binary_sensor.motion_bathroom_downstairs_occupancy
from: 'on'
to: 'off'
for:
seconds: 120
actions:
- choose:
- alias: when triggered
conditions:
- alias: and motion is detected
condition: state
entity_id:
- binary_sensor.motion_bathroom_downstairs_occupancy
state: 'on'
- alias: and we are home (cat's can poop in the dark)
condition: state
entity_id:
- input_boolean.house_mode_away
state: 'off'
sequence:
- alias: turn on the lights
action: light.turn_on
target:
entity_id: light.bathroom_downstairs_mirror
data:
brightness: 255
default:
- action: light.turn_off
target:
entity_id: light.bathroom_downstairs_mirror
- alias: 'Laundry room: Update washer state'
id: 498fd292-2419-447b-9dec-36d9cbf81a65
triggers:
- trigger: state
id: centrifugate
entity_id: sensor.washer_state
to: centrifugate
for:
seconds: 10
- trigger: state
id: rinsing
entity_id: sensor.washer_state
from:
- 'off'
- idle
- centrifugate
- washing
to: rinsing
for:
seconds: 10
- trigger: state
id: 'off'
entity_id: sensor.washer_state
to: 'off'
for:
seconds: 60
- trigger: state
id: washing
entity_id: sensor.washer_state
to: washing
for:
seconds: 10
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: washing
sequence:
- action: input_select.select_option
target:
entity_id: input_select.washer_state
data:
option: washing
- conditions:
- condition: trigger
id: centrifugate
sequence:
- action: input_select.select_option
target:
entity_id: input_select.washer_state
data:
option: centrifugate
- conditions:
- condition: trigger
id: 'off'
- condition: state
entity_id: input_select.washer_state
state:
- rinsing
- centrifugate
sequence:
- action: input_select.select_option
target:
entity_id: input_select.washer_state
data:
option: 'off'
- conditions:
- condition: trigger
id: rinsing
sequence:
- action: input_select.select_option
target:
entity_id: input_select.washer_state
data:
option: rinsing
- conditions:
- condition: state
entity_id: sensor.washer_state
state: washing
sequence:
- action: input_select.select_option
target:
entity_id: input_select.washer_state
data:
option: washing
- alias: 'Laundry room: Washer notification'
id: 72a747af-989c-4843-9a35-10793047c0fe
triggers:
- trigger: state
entity_id: input_select.washer_state
to: 'off'
from:
- centrifugate
- washing
- rinsing
conditions: []
actions:
- action: notify.family
data:
title: Tvättmaskinen
message: Tvätten är klar
data:
tag: laundry
- alias: 'Laundry room: Dryer'
id: ed556d71-7706-408f-9223-fda6f14d3768
triggers:
- trigger: state
entity_id: sensor.dryer_state
to: 'off'
from: drying
for:
seconds: 30
conditions: []
actions:
- action: notify.family
data:
title: Torktumlaren
message: Tvätten är torr
data:
tag: laundry
- alias: 'House: mailbox'
id: ae403d31-d120-47cb-ba66-ac401b08d8e2
mode: queued
trigger:
- platform: state
id: flap
entity_id:
- binary_sensor.mailbox_flap_contact
from: 'off'
to: 'on'
- platform: state
id: door
entity_id:
- binary_sensor.mailbox_door_contact
from: 'off'
to: 'on'
action:
- choose:
- conditions:
condition: trigger
id: flap
sequence:
- service: input_number.increment
target:
entity_id:
- input_number.mailbox_deliveries
- choose:
- conditions:
condition: numeric_state
entity_id:
- input_number.mailbox_deliveries
above: 1
sequence:
- service: notify.family
data:
title: Postlådan
message: 'Mera post, töm postlådan! (lev: {{states(''input_number.mailbox_deliveries'')|int}})'
data:
tag: mailbox
- service: persistent_notification.create
data:
message: 'Mera post, töm postlådan! (lev: {{states(''input_number.mailbox_deliveries'')|int}})'
title: Postlådan
notification_id: feed_mail
default:
- service: notify.family
data:
title: Postlådan
message: Kom och töm mig på post!
data:
tag: mailbox
- service: persistent_notification.create
data:
message: Töm postlådan
title: Postlådan
notification_id: feed_mail
- conditions:
- condition: trigger
id: door
sequence:
- service: input_number.set_value
target:
entity_id:
- input_number.mailbox_deliveries
data:
value: 0
- service: notify.family
data:
title: Postlådan
message: Tack!
data:
tag: mailbox
timeout: 900
- service: persistent_notification.dismiss
data:
notification_id: feed_mail
- alias: 'House: away mode'
id: 100921f5-d234-470f-903a-e27a5e51f169
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- group.family
action:
- alias: Should we active away mode or not
choose:
- alias: Turn on
conditions:
- not:
- or:
- alias: when we are detected as away
condition: state
entity_id:
- group.family
state: home
- alias: when guests are detected as away
condition: state
entity_id:
- group.guests
state: home
sequence:
- alias: Turn on away mode
service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_away
default:
- alias: Turn off away mode
service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_away
- alias: 'House: bright hallway mode'
id: d5b4e5d2-06db-456d-baef-32a8942e8deb
mode: queued
trigger:
- platform: event
event_type: automation_reloaded
- platform: numeric_state
id: lightlevel_day
entity_id:
- sensor.motion_hallway_downstairs_illuminance
above: input_number.lightlevel_limit_hallway
for:
minutes: 5
- platform: numeric_state
id: lightlevel_night
entity_id:
- sensor.motion_hallway_downstairs_illuminance
below: input_number.lightlevel_limit_hallway
for:
minutes: 5
- platform: state
entity_id:
- input_number.lightlevel_limit_hallway
condition: []
action:
choose:
- conditions:
- condition: numeric_state
entity_id:
- sensor.motion_hallway_downstairs_illuminance
above: input_number.lightlevel_limit_hallway
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_bright_hallway
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_bright_hallway
- alias: 'House: bright inside mode'
id: 44bed364-c081-4720-b8f5-60aaae177d4f
mode: queued
trigger:
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- input_number.sun_elevation_limit
- platform: numeric_state
id: sun
entity_id:
- sun.sun
attribute: elevation
above: input_number.sun_elevation_limit
- platform: numeric_state
id: lightlevel_day
entity_id:
- sensor.outdoor_illuminance_min
above: input_number.lightlevel_limit_indoor
for:
minutes: 5
- platform: numeric_state
id: lightlevel_night
entity_id:
- sensor.outdoor_illuminance_min
below: input_number.lightlevel_limit_indoor
for:
minutes: 5
condition: []
action:
choose:
- conditions:
- condition: numeric_state
entity_id:
- sensor.sun_elevation
above: input_number.sun_elevation_limit
- condition: numeric_state
entity_id:
- sensor.outdoor_illuminance_min
above: input_number.lightlevel_limit_indoor
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_bright_inside
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_bright_inside
- alias: 'House: daylight mode'
id: 076988f1-1e78-4cdd-96fd-83ff83431e1c
mode: queued
trace:
stored_traces: 25
trigger:
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- input_number.sun_elevation_limit
- platform: numeric_state
id: sun_up
entity_id:
- sun.sun
attribute: elevation
above: input_number.sun_elevation_limit
- platform: numeric_state
id: lightlevel_day
entity_id:
- sensor.outdoor_illuminance_min
above: input_number.lightlevel_limit_outdoor
for:
minutes: 5
- platform: numeric_state
id: lightlevel_night
entity_id:
- sensor.outdoor_illuminance_min
below: input_number.lightlevel_limit_outdoor
for:
minutes: 5
condition: []
action:
choose:
- conditions:
- condition: numeric_state
entity_id:
- sensor.sun_elevation
above: input_number.sun_elevation_limit
- condition: numeric_state
entity_id:
- sensor.outdoor_illuminance_min
above: input_number.lightlevel_limit_outdoor
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_daylight
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_daylight
- alias: 'House: guest mode'
id: b480b798-c2f5-4ec9-ab4e-da96fe5590f9
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
id: tracker
entity_id:
- group.guests
action:
- choose:
- conditions:
condition: state
entity_id:
- group.guests
state: home
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_guests
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_guests
- alias: 'Manual mode: turn off at defined time'
id: 624c2596-32a1-44f7-864b-f56728145498
trigger:
- platform: time
id: reset
at:
- input_datetime.house_reset_settings
- input_datetime.house_reset_settings_day
action:
choose:
- conditions:
- condition: trigger
id: reset
sequence:
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.parking_manual_mode
- input_boolean.kitchen_manual_mode
- input_boolean.livingroom_manual_mode
- input_boolean.hallway_downstairs_manual_mode
- alias: 'Manual mode: turn off after active for X minutes'
id: ee354ef8-d169-4b44-ac27-83a19e418111
trigger:
- platform: state
entity_id: input_boolean.hallway_downstairs_manual_mode
to: 'on'
for:
minutes: 60
action:
choose:
- conditions:
- condition: state
entity_id: input_boolean.hallway_downstairs_manual_mode
state: 'on'
sequence:
- service: input_boolean.turn_off
target:
entity_id:
- input_boolean.hallway_downstairs_manual_mode
- alias: 'House: sleep mode'
id: 2c24e58c-fb5f-4b5d-bcf1-6598c26125a1
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: time
id: time
at: input_datetime.house_reset_settings
- platform: state
id: manual
entity_id:
- input_boolean.bedroom_manual_mode
- input_boolean.kitchen_manual_mode
- input_boolean.livingroom_manual_mode
from: 'off'
to: 'on'
- platform: state
entity_id:
- lock.front_door
from: locked
to: unlocked
- platform: state
id: phone
entity_id:
- sensor.kb2003_charger_type
from:
- ac
- usb
to: none
variables:
anchors:
- &id025
service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_sleep
- &id026
service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_sleep
action:
- choose:
- conditions:
condition: trigger
id: time
sequence:
- *id025
- conditions:
- condition: and
conditions:
- condition: trigger
id: phone
- condition: time
after: 05:00:00
before: 09:00:00
sequence:
- *id026
- conditions:
condition: trigger
id: manual
sequence:
- *id026
default:
- *id026
- alias: 'House: workday mode'
id: b54de7c4-ee5f-497f-8dbc-af5c953bea46
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- binary_sensor.workday_today
action:
choose:
- conditions:
- condition: state
entity_id: binary_sensor.workday_today
state: 'on'
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.house_mode_workday
default:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.house_mode_workday
- alias: 'Movement: hallway downstairs'
id: aa2a22c1-e965-4222-9068-f136ac898dd4
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: movement
entity_id:
- binary_sensor.motion_hallway_downstairs_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_hallway_downstairs_occupancy
from: 'on'
to: 'off'
for:
minutes: '{{ states(''input_number.hallway_downstairs_timeout'')|int }}'
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected
condition: trigger
id: movement
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.hallway_downstairs_movement
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.hallway_downstairs_movement
- alias: 'Nordpool: reload when hung'
id: a7d69bb8-8f5b-46d2-860e-3bcfb9c2cc2d
trace:
stored_traces: 10
trigger:
- platform: time_pattern
hours: '*'
variables:
np_update: "{% set np_list = ['sensor.nordpool_se1', 'sensor.nordpool_se2', 'sensor.nordpool_se3',\
\ 'sensor.nordpool_se4'] %} {% set np_data = namespace(entities=[]) %} {% for\
\ s in np_list %}\n {% if (as_timestamp(now()) - as_timestamp(states[s].last_updated)\
\ > 7200) %}\n {% set np_data.entities = np_data.entities + [s] %}\n {%\
\ endif %}\n{% endfor %} {{ np_data.entities }}\n"
condition: []
action:
- choose:
- conditions: '{{ np_update is defined and np_update|length>0 }}'
sequence:
- service: homeassistant.reload_config_entry
target:
entity_id: '{{ np_update }}'
- service: notify.castle_log
data:
title: nordpool
message: Laddar om {{np_update|map('regex_replace', '^.+_')|join(', ')}}
- alias: Reload Nordpool after midnight if tomorrow_valid is true
trigger:
platform: time
at: 00:05:00
variables:
np_update: "{% set np_list = ['sensor.nordpool_se1', 'sensor.nordpool_se2', 'sensor.nordpool_se3',\
\ 'sensor.nordpool_se4'] %} {% set np_data = namespace(entities=[]) %} {% for\
\ s in np_list %}\n {% if (states[s].attributes.tomorrow_valid == true ) %}\n\
\ {% set np_data.entities = np_data.entities + [s] %}\n {% endif %}\n{%\
\ endfor %} {{ np_data.entities }}\n"
action:
- choose:
- conditions: '{{ np_update is defined and np_update|length>0 }}'
sequence:
- service: homeassistant.reload_config_entry
target:
entity_id: '{{ np_update }}'
- service: notify.castle_log
data:
title: nordpool
message: tomorrow_valid=true, laddar om {{np_update|map('regex_replace',
'^.+_')|join(', ')}}
- alias: Flash some lights on driveway motion
id: 63fe107f-06f0-44ad-b430-e2ff493272f7
trigger:
- platform: state
entity_id: binary_sensor.motion_driveway_occupancy
from: 'off'
to: 'on'
action:
- alias: when motion detected
choose:
- conditions:
condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'on'
sequence:
- service: light.turn_on
target:
entity_id: light.floor_lamp
- delay:
seconds: 2
- service: light.turn_off
target:
entity_id: light.floor_lamp
- conditions:
condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'off'
sequence:
- service: light.turn_off
target:
entity_id: light.floor_lamp
- delay:
seconds: 2
- service: scene.turn_on
target:
entity_id: scene.livingroom_ambience_lights_cozy
data:
transition: 1
- alias: 'House: outdoor lights'
id: 628f6bc0-9b4a-461f-878f-92b8de65fa7d
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- scene_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_outside_work
- platform: state
id: daylight
entity_id:
- input_boolean.house_mode_daylight
- platform: state
id: movement
entity_id: group.motion_parking
from:
- 'on'
- 'off'
to:
- 'on'
- 'off'
action:
choose:
- alias: activate outdoor work mode
conditions:
- alias: when outside work mode is on
condition: state
entity_id:
- input_boolean.house_mode_outside_work
state: 'on'
sequence:
- alias: activate outside work scene
service: scene.turn_on
target:
entity_id: scene.outdoor_work
data:
transition: 2
- alias: activate outdoor lights
conditions:
- alias: when triggered
condition: trigger
id: daylight
- alias: and it turned off
condition: state
entity_id: input_boolean.house_mode_daylight
state: 'off'
sequence:
- alias: turn on lights
service: scene.turn_on
target:
entity_id: scene.outdoor_lights_default
data:
transition: 5
- conditions:
- alias: if daylight is off
condition: state
entity_id:
- input_boolean.house_mode_daylight
state: 'off'
sequence:
- choose:
- conditions:
- alias: movement is on
condition: state
entity_id:
- group.motion_parking
state: 'on'
sequence:
- alias: turn on movement mode
service: scene.turn_on
target:
entity_id: scene.outdoor_parking_movement
data:
transition: 2
default:
- alias: turn on default mode
service: scene.turn_on
target:
entity_id: scene.outdoor_parking_default
data:
transition: 5
default:
- service: light.turn_off
target:
entity_id: light.utomhuslampor
data:
transition: 5
- alias: 'Movement: driveway'
id: c5479364-0da7-4fb2-82ac-53c2e7c5be5c
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: movement
entity_id:
- binary_sensor.motion_driveway_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_driveway_occupancy
from: 'on'
to: 'off'
for:
minutes: 1
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected at driveway
condition: trigger
id: movement
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.driveway_movement
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.driveway_movement
- alias: 'Movement: barn'
id: eca6bdb4-acd6-4238-a307-3edaa4ac3bd4
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: movement
entity_id:
- binary_sensor.motion_barn_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_barn_occupancy
from: 'on'
to: 'off'
for:
minutes: 1
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected at driveway
condition: trigger
id: movement
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.barn_movement
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.barn_movement
- alias: 'Movement: front'
id: 6a3641d9-0135-407a-8e06-66c3d8115d9e
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: movement
entity_id:
- binary_sensor.motion_front_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.motion_front_occupancy
from: 'on'
to: 'off'
for:
minutes: 1
condition: []
action:
choose:
- alias: activate movement mode
conditions:
- alias: when movement is detected at entrence
condition: trigger
id: movement
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.front_movement
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.front_movement
- alias: 'Garage: port'
id: a7711621-6c74-47f5-b04c-b6cd382f673f
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- binary_sensor.garage_port_contact
from: 'on'
to: 'off'
- platform: time
at: '21:00:00'
condition: []
variables:
anchors:
- &id028
service: notify.family
data:
title: Garaget
message: Garageporten är öppen!
data:
tag: garage
- service: notify.family
data:
title: Garaget
message: Tack!
data:
tag: garage
timeout: 900
- &id030
service: notify.family
data:
message: clear_notification
data:
tag: garage
- &id027
service: persistent_notification.create
data:
title: Garaget
message: Garageporten är öppen!
notification_id: feed_garage
- &id029
service: persistent_notification.dismiss
data:
notification_id: feed_garage
action:
- choose:
- conditions:
- condition: state
entity_id:
- binary_sensor.garage_port_contact
state: 'on'
- condition: time
after: '21:00:00'
sequence:
- *id027
- *id028
default:
- *id029
- *id030
- alias: 'techroom: presence'
id: 7981014b-9e4b-4e0b-ba5b-a32147cf0e2a
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: engage
entity_id:
- input_boolean.techroom_movement
from: 'off'
to: 'on'
- platform: state
entity_id:
- input_boolean.techroom_movement
from: 'on'
to: 'off'
action:
choose:
conditions:
- condition: or
conditions:
- condition: trigger
id: engage
- condition: state
entity_id: input_boolean.techroom_movement
state: 'on'
sequence:
choose:
conditions:
condition: state
entity_id: binary_sensor.tech_monitors
state: 'off'
sequence:
- service: shell_command.monitor_on
- service: command_line.reload
- service: shell_command.borg_ambience
default:
choose:
conditions:
condition: state
entity_id: binary_sensor.tech_monitors
state: 'on'
sequence:
- service: shell_command.monitor_off
- service: command_line.reload
- alias: 'Human: parking'
id: 99f7a23a-2164-44f5-b021-71405162ed5e
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: person
entity_id:
- binary_sensor.parking_person_occupancy
from: 'off'
to: 'on'
- platform: state
entity_id:
- binary_sensor.parking_person_occupancy
from: 'on'
to: 'off'
for:
minutes: 1
condition: []
action:
choose:
- alias: activate detect mode
conditions:
- alias: when person is detected on parking
condition: trigger
id: person
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.parking_human
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.parking_human
- alias: 'Human: propery'
id: 0c09b67d-0cf4-4f6f-9ce2-7338d0171090
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: person
entity_id:
- group.property_humans
from: 'off'
to: 'on'
- platform: state
entity_id:
- group.property_humans
from: 'on'
to: 'off'
for:
minutes: 1
condition: []
action:
choose:
- alias: activate detect mode
conditions:
- alias: when person is detected somewhere
condition: trigger
id: person
sequence:
- alias: turn on helper
service: input_boolean.turn_on
target:
entity_id: input_boolean.property_human
default:
- alias: turn off helper
service: input_boolean.turn_off
target:
entity_id: input_boolean.property_human
- alias: Rat trap
id: 6fb0de3f-e185-4a95-ab77-ca3215f6dac1
triggers:
trigger: state
entity_id:
- binary_sensor.rat_trap_2_contact
- binary_sensor.rat_trap_3_contact
from: 'off'
to: 'on'
conditions:
condition: template
value_template: '{% set trap = trigger.entity_id.split(''.'')[1].replace(''_contact'',
'''') %} {{ is_state(''input_boolean.''+trap+''_armed'', ''on'') }}
'
actions:
- action: counter.increment
entity_id:
- counter.rat_trap
- action: input_boolean.turn_off
data_template:
entity_id: input_boolean.{{ trigger.entity_id.split('.')[1].replace('_contact',
'') }}_armed
- action: notify.family
data_template:
title: Råttfångarn
message: "{% set mapper = {\n 'binary_sensor.rat_trap_1' : 'krypgrunden',\n\
\ 'binary_sensor.rat_trap_2_contact' : 'garderoben nere',\n 'binary_sensor.rat_trap_3_contact'\
\ : 'väggen uppe'\n} %} Råttjävul fångad i {{ mapper[trigger.entity_id] }}!\
\ (Fångade hittills: {{ states('counter.rat_trap') }})\n"
data:
tag: rat_trap
sticky: true
- alias: 'SSO: faultcode'
id: 46d44938-1a8c-43df-9ef5-9d36d424bb95
mode: queued
trace:
stored_traces: 10
trigger:
- platform: state
entity_id:
- sensor.ferroamp_xl28_sso_east_32_faultcode
- sensor.ferroamp_xl28_sso_22010644_faultcode
- sensor.ferroamp_xl28_sso_21090039_faultcode
- sensor.ferroamp_xl28_sso_21090135_faultcode
- sensor.ferroamp_xl28_sso_21090071_faultcode
- sensor.ferroamp_xl28_sso_west_32_faultcode
not_from:
- none
- unknown
- unavailable
- '400'
not_to:
- none
- unknown
- unavailable
- '400'
action:
choose:
- conditions: '{{ trigger.to_state.state|int > 0 }}'
sequence:
- service: notify.castle_log
data:
title: Ferroamp SSO
message: "{% set f = namespace(errors=[]) %} {% for a in trigger.to_state.attributes|reject('in',\
\ ['icon', 'friendly_name']) %}\n {% set f.errors = f.errors + [trigger.to_state.attributes[a]]\
\ %}\n{% endfor %} {{trigger.to_state.name}} rapporterar felkod: {{trigger.to_state.state}}\
\ ({{f.errors|join('| ')}})\n"
default:
- service: notify.castle_log
data:
title: Ferroamp SSO
message: '{{trigger.to_state.name}} rapporterar normalt läge igen
'
- alias: 'Garage: handle stereo'
id: 7edf8e18-0ec4-44cb-9d03-dc49c0fd7a0c
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- binary_sensor.garage_port_contact
from:
- 'on'
- 'off'
to:
- 'on'
- 'off'
- platform: state
id: no_motion
entity_id: binary_sensor.motion_garage_occupancy
from: 'on'
to: 'off'
for:
minutes: 15
condition: []
action:
- choose:
- alias: turn on the stereo
conditions:
- alias: if the port is open
condition: state
entity_id:
- binary_sensor.garage_port_contact
state: 'on'
sequence:
- alias: turn on the stereo
service: switch.turn_on
target:
entity_id: switch.garage_plug
- alias: turn off the stereo
conditions:
- alias: if the port is closed
condition: state
entity_id:
- binary_sensor.garage_port_contact
state: 'off'
- alias: and the stereo is on
condition: state
entity_id: switch.garage_plug
state: 'on'
- alias: and no motion has been detected for a while
condition: state
entity_id: binary_sensor.motion_garage_occupancy
state: 'off'
for:
minutes: 15
sequence:
- alias: turn off the stereo
service: switch.turn_off
target:
entity_id: switch.garage_plug
default:
- alias: nothing to do
delay:
milliseconds: 1
- alias: 'Hallway upstairs: terrace door'
id: 69068a0a-fdf1-4601-b8a8-cd9e8deec8f6
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- binary_sensor.terrace_door_contact
for: 00:05:00
- platform: state
entity_id:
- sensor.terrace_temperature
- sensor.bedroom_temperature
action:
choose:
- alias: when triggered
conditions:
- alias: and the door has been open for a while
condition: state
entity_id:
- binary_sensor.terrace_door_contact
state: 'on'
for: 00:05:00
- alias: and whenever the temperature getting...
condition: or
conditions:
- alias: too cold
condition: template
value_template: '{{ ((states("sensor.bedroom_temperature")|float(0) - states("sensor.terrace_temperature")|float(0))
> 4) and states("sensor.bedroom_temperature")|float(0) < 19 }}'
- alias: too warm
condition: template
value_template: '{{ (states("sensor.bedroom_temperature")|float(0) < states("sensor.terrace_temperature")|float(0))
and states("sensor.bedroom_temperature")|float(0) > 19 }}'
sequence:
- alias: send a notification
service: notify.family
data:
title: Uterummet uppe
message: 'Dags att stänga dörren (inne: {{ states("sensor.bedroom_temperature")|float(0)
}}C ute: {{ states("sensor.terrace_temperature")|float(0) }}C)'
- alias: test multiple remotes
id: 64070baf-8273-4617-b223-4295f9e1db5b
mode: queued
trace:
stored_traces: 20
trigger:
- platform: time_pattern
hours: '*'
- platform: state
id: remote
entity_id: sensor.bedroom_remote_wall_action
action:
- service: system_log.write
data:
message: 'trigger: {{ trigger }}'
- alias: 'waze: announce arrival time'
id: 9d40e5cb-f8fb-45e3-87d8-dd848b670bb9
trace:
stored_traces: 10
trigger:
- platform: zone
entity_id:
- person.bella
zone: zone.hemmets_hus
event: leave
- platform: zone
entity_id:
- person.linus
zone: zone.norra_berget
event: leave
- platform: zone
entity_id:
- person.bella
zone: zone.hemmets_hus
event: enter
variables:
event: '{{ ''lämnade'' if trigger.event == ''leave'' else ''kom fram till'' }}'
person: '{{ trigger.to_state.attributes.friendly_name }}'
sensor: sensor.{{trigger.to_state.attributes.id}}_waze_travel_time
zone: '{{ trigger.zone.attributes.friendly_name }}'
action:
- if: '{{ trigger.event == ''leave'' }}'
then:
- variables:
arrival: '{% set t = states(sensor)|int %} {{ (now().timestamp() + (t*60))
| timestamp_custom(''%H:%M'') }}
'
- service: notify.castle_log
data:
title: Resa
message: '{{person}} {{event}} {{zone}} (kommer vara hemma ungefär {{arrival}})'
else:
- service: notify.castle_log
data:
title: Resa
message: '{{person}} {{event}} {{zone}}'
- alias: 'Techroom: ups changed status'
id: 811aa378-4a4e-4b52-a63f-ed63ea9a4172
mode: queued
trace:
stored_traces: 10
triggers:
- trigger: state
entity_id: sensor.techups_status
not_to:
- unknown
- unavailable
not_from:
- unknown
- unavailable
actions:
- action: notify.castle
data:
title: UPS teknikrum
message: 'Status: {{states(''sensor.techups_status'')}}'
- alias: Vac-it Ralph (uppe)
id: c5ae7db7-0bf6-4cd9-99fc-797126b13efd
trace:
stored_traces: 10
triggers:
- trigger: time
id: start_upstairs
at: input_datetime.time_vacuum_upstairs
- trigger: template
id: start_upstairs_notif
value_template: '{{ now().strftime(''%H:%M:%S'') == (state_attr(''input_datetime.time_vacuum_upstairs'',
''timestamp'')|as_datetime - timedelta(minutes=15)).strftime(''%H:%M:%S'') }}'
condition: []
variables:
anchors:
- &id031
action: notify.family
data:
title: Vac-it Ralph
message: Dags för städning om 15min!
data:
tag: vacuum_ralph
timeout: 900
actions:
choose:
- alias: if we got guests at home
conditions:
- condition: state
entity_id: input_boolean.house_mode_guests
state: 'on'
sequence: []
- alias: decide if we want to do something
conditions:
- condition: and
conditions:
- alias: triggered by start time
condition: trigger
id:
- start_upstairs_notif
- start_upstairs
- alias: and weekday is on schedule
condition: time
weekday:
- mon
- wed
- fri
sequence:
- variables:
trigger: '{{ trigger.id }}'
- alias: choose what to do
choose:
- alias: if heads up was triggered
conditions: '{{ trigger == ''start_upstairs_notif'' }}'
sequence:
- *id031
- alias: if actual start time was triggered
conditions: '{{ trigger == ''start_upstairs'' }}'
sequence:
alias: start to clean
action: vacuum.start
target:
entity_id:
- vacuum.vac_it_ralph
- alias: Vac-it Ralph - disable map when not running
id: e7961fc1-6cee-4ffe-936c-8c49fc49642b
trace:
stored_traces: 10
mode: restart
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id: vacuum.vac_it_ralph
condition: []
actions:
- action: "{% if states('vacuum.vac_it_ralph') in [\"unavailable\", \"unknown\"\
, \"docked\"] %}\n camera.turn_off\n{% else %}\n camera.turn_on\n{% endif\
\ %}\n"
target:
entity_id: camera.xiaomi_cloud_map_extractor
- alias: Vac-it Ralph - notify on error
id: 69b93815-b673-4bff-8e86-68c9586c12f9
trace:
stored_traces: 10
triggers:
- trigger: state
entity_id:
- vacuum.vac_it_ralph
not_from: unavailable
to: error
actions:
- action: notify.family
data:
title: Vac-it Ralph
message: 'Error: {{state_attr(''vacuum.vac_it_ralph'', ''error'')}}'
data:
tag: vacuum_ralph
- alias: 'bedroom: air cleaner'
id: 02d47a86-cef3-435a-8471-c07e0b0fb8a3
mode: queued
triggers:
- trigger: homeassistant
event: start
- trigger: event
event_type:
- automation_reloaded
- trigger: state
entity_id:
- input_boolean.house_mode_away
- input_datetime.bedroom_vent_on
- input_datetime.bedroom_vent_off
- trigger: time
at:
- input_datetime.bedroom_vent_on
- input_datetime.bedroom_vent_off
actions:
choose:
- conditions:
- condition: time
before: input_datetime.bedroom_vent_off
after: input_datetime.bedroom_vent_on
sequence:
- action: fan.set_percentage
target:
entity_id: fan.bedroom_starkvind
data:
percentage: 55
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_away
state: 'on'
sequence:
- action: fan.set_percentage
target:
entity_id: fan.bedroom_starkvind
data:
percentage: 55
default:
- action: fan.set_percentage
target:
entity_id: fan.bedroom_starkvind
data:
percentage: 11
- alias: 'House: water leak'
id: 995c171e-c998-42b6-9599-d5395bcca1d8
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
id: sensor
entity_id:
- binary_sensor.water_sink_water_leak
- binary_sensor.water_wardrobe_water_leak
- binary_sensor.water_bedroom_ac_water_leak
from: 'off'
to: 'on'
variables:
data: &id032
importance: high
ttl: 0
tag: water_leak
sticky: true
visibility: public
msg: "{% if trigger is defined and has_value('trigger.entity_id') %}\n {% set\
\ e = trigger.entity_id %}\n{% else %}\n {% set e = (\n [\n 'binary_sensor.water_sink_water_leak',\
\ \n 'binary_sensor.water_wardrobe_water_leak', \n 'binary_sensor.water_bedroom_ac_water_leak'\n\
\ ]\n | select('is_state', 'on')\n | list)\n %}\n{% endif %} {% set\
\ mapper = {\n 'binary_sensor.water_sink_water_leak' : ' under diskbänken',\n\
\ 'binary_sensor.water_wardrobe_water_leak' : ' i garderoben nere',\n 'binary_sensor.water_bedroom_ac_water_leak':\
\ ', tanken till AC i sovrummet är full'\n} %} Vatten upptäckt{{mapper[e[0]]\
\ if e else ' någonstans'}}!\n"
action:
choose:
conditions:
condition: or
conditions:
- condition: trigger
id: sensor
- condition: state
entity_id:
- binary_sensor.water_sink_water_leak
- binary_sensor.water_wardrobe_water_leak
- binary_sensor.water_bedroom_ac_water_leak
state: 'on'
match: any
sequence:
- service: notify.family
data_template:
title: Vattenläcka!
message: '{{msg}}'
data: *id032
- service: notify.castle
data:
title: Vattenläcka!
message: '{{msg}}'
- alias: 'Water meter: flow'
id: 191c227f-0822-4457-b917-539d9345eb48
triggers:
- trigger: numeric_state
entity_id:
- sensor.watermeter_water_usage_current
above: 0
for:
minutes: 15
id: flow_15
variables:
data: &id033
importance: high
ttl: 0
tag: water_leak
sticky: true
visibility: public
actions:
- choose:
- conditions:
- condition: trigger
id: flow_15
sequence:
- action: notify.family
data_template:
title: Vattenflöde!
message: Vatten har runnit i över 15min (flöde {{states('sensor.watermeter_water_usage_current')|round(2)}}L/min)
data: *id033
- action: notify.castle
data:
title: Vattenflöde!
message: Vatten har runnit i över 15min (flöde {{states('sensor.watermeter_water_usage_current')|round(2)}}L/min)
- alias: 'Laundry room: window lights'
id: 3b83edcb-50e2-4af8-8808-5190199d98da
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- scene_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_bright_inside
- platform: time
at:
- input_datetime.time_goodmorning
- input_datetime.time_goodnight
- platform: state
id: night
entity_id:
- input_boolean.house_mode_sleep
from: 'off'
to: 'on'
condition: []
action:
choose:
- conditions:
- condition: state
entity_id:
- input_boolean.house_mode_bright_inside
state: 'on'
sequence:
- &id034
service: light.turn_off
target:
entity_id:
- light.laundry_room_window
data:
transition: 5
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: time
after: input_datetime.time_goodmorning
before: input_datetime.time_goodnight
sequence:
- service: scene.turn_on
target:
entity_id:
- scene.laundry_room_window_lights_cozy
data:
transition: 5
default:
- *id034
- alias: 'workday: linus'
id: 842ed6ce-287d-4156-8b36-1040f1265f12
trace:
stored_traces: 10
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- platform: state
entity_id:
- binary_sensor.workday_today
- binary_sensor.vacation_linus
condition: []
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.vacation_linus
state: 'on'
- condition: state
entity_id: binary_sensor.workday_today
state: 'off'
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.workday_linus
default:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.workday_linus
- alias: 'Z2M: device leave notification'
id: 71e990e2-1f77-4985-9b7b-76dc9750d17a
trace:
stored_traces: 10
trigger:
- platform: mqtt
topic: zigbee2mqtt/bridge/event
payload: device_leave
value_template: '{{ value_json.type}}'
condition: []
action:
- wait_for_trigger:
- platform: mqtt
topic: zigbee2mqtt/bridge/event
payload: device_joined
value_template: '{{ value_json.type}}'
timeout:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- if:
- condition: template
value_template: '{{ wait.trigger is none }}'
then:
- service: notify.castle
data:
title: Zigbee2MQTT
message: '{{ now().strftime(''%H:%M:%S'') }} - Z2M tappade kontakten med {{
trigger.payload_json.data.friendly_name }}.'
- id: zigbee2mqtt_create_notification_on_successful_interview
alias: Zigbee Device Joined Notification
triggers:
trigger: mqtt
topic: zigbee2mqtt/bridge/event
conditions:
condition: template
value_template: '{{trigger.payload_json.type == "device_interview" and trigger.payload_json.data.status
== "successful" and trigger.payload_json.data.supported}}'
actions:
- action: persistent_notification.create
data_template:
title: Device joined the Zigbee2MQTT network
message: 'Name: {{trigger.payload_json.data.friendly_name}}, Vendor: {{trigger.payload_json.data.definition.vendor}},
Model: {{trigger.payload_json.data.definition.model}}, Description: {{trigger.payload_json.data.definition.description}}'
- id: zigbee2mqtt_update_devices_list
alias: Update Zigbee Devices List
description: ''
triggers:
- trigger: mqtt
topic: zigbee2mqtt/bridge/event
- trigger: mqtt
topic: zigbee2mqtt/bridge/response/device/rename
- trigger: homeassistant
event: start
condition: []
actions:
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- action: input_select.set_options
metadata: {}
data:
options: "{%- set find_integration = 'mqtt' %} {%- set devices = states | map(attribute='entity_id')\
\ | map('device_id') | unique | reject('eq',None) | list %} {%- set ns = namespace(entities\
\ = []) %} {%- for device in devices if device_attr(device, 'identifiers')\
\ %}\n {%- set ids = device_attr(device, 'identifiers') | list | first %}\n\
\ {%- if ids and ids | length == 2 and ids[0] == find_integration and \"\
zigbee2mqtt\" in ids[1] %}\n {% set names = device_attr(device, 'name').split('\\\
n') | list %}\n {%- set ns.entities = ns.entities + names %}\n {%- endif\
\ %}\n{%- endfor %} {{ ns.entities}}\n"
target:
entity_id:
- input_select.zigbee2mqtt_old_name_select
- input_select.zigbee2mqtt_remove_select
- action: input_text.set_value
metadata: {}
data:
value: ''
target:
entity_id: input_text.zigbee2mqtt_new_name
mode: single
- alias: Zucky Stardust (nere)
id: 574e8534-e0c3-47b4-b731-15ed8e5e92be
trace:
stored_traces: 10
trigger:
- platform: time
id: start_downstairs
at: input_datetime.time_vacuum_downstairs
- platform: template
id: start_downstairs_notif
value_template: '{{ now().strftime(''%H:%M:%S'') == (state_attr(''input_datetime.time_vacuum_downstairs'',
''timestamp'')|as_datetime - timedelta(minutes=15)).strftime(''%H:%M:%S'') }}'
condition: []
variables:
anchors:
- &id035
service: notify.family
data:
title: Zucky Stardust
message: Dags för städning om 15min!
data:
tag: vacuum_zucky
timeout: 900
action:
choose:
- alias: if we got guests at home
conditions:
- condition: state
entity_id: input_boolean.house_mode_guests
state: 'on'
sequence: []
- alias: decide if we want to do something
conditions:
- condition: and
conditions:
- alias: triggered by start time
condition: trigger
id:
- start_downstairs_notif
- start_downstairs
- alias: and weekday is on schedule
condition: time
weekday:
- mon
- wed
- fri
sequence:
- variables:
trigger: '{{ trigger.id }}'
- alias: choose what to do
choose:
- alias: if heads up was triggered
conditions: '{{ trigger == ''start_downstairs_notif'' }}'
sequence:
- *id035
- alias: if actual start time was triggered
conditions: '{{ trigger == ''start_downstairs'' }}'
sequence:
alias: start to clean
service: vacuum.start
target:
entity_id:
- vacuum.zucky_stardust