- alias: Bathroom floor heater manual off initial_state: true triggers: trigger: state entity_id: input_boolean.bathroom_floor_heater_auto to: 'off' actions: action: script.turn_on target: entity_id: script.bathroom_floor_heater_turn_off - alias: Bathroom floor heater manual auto initial_state: true triggers: trigger: state entity_id: input_boolean.bathroom_floor_heater_auto to: 'on' actions: action: script.turn_on target: entity_id: script.bathroom_floor_heater_auto - alias: Bathroom floor heater away initial_state: true triggers: trigger: state entity_id: group.device_tracker_family to: not_home conditions: - condition: state entity_id: input_boolean.bathroom_floor_heater_auto state: 'on' - condition: state entity_id: input_boolean.enable_bathroom_floor_heater_automations state: 'on' actions: action: script.turn_on target: entity_id: script.bathroom_floor_heater_turn_off - alias: Bathroom floor heater home initial_state: true triggers: trigger: state entity_id: group.device_tracker_family to: home conditions: - condition: state entity_id: input_boolean.bathroom_floor_heater_auto state: 'on' - condition: state entity_id: input_boolean.enable_bathroom_floor_heater_automations state: 'on' actions: action: script.turn_on target: entity_id: script.bathroom_floor_heater_auto - alias: Leaving home initial_state: true triggers: trigger: state entity_id: group.device_tracker_family to: not_home actions: action: script.indoor_lights_off - alias: Coming home turn on lights bright initial_state: true triggers: - trigger: state entity_id: group.device_tracker_family to: home conditions: - condition: state entity_id: input_boolean.coming_home_turn_on_lights state: 'on' - condition: state entity_id: binary_sensor.relaxed_mode state: 'off' - condition: sun after: sunset after_offset: -01:00:00 - condition: or conditions: - condition: state entity_id: group.indoor_lights state: 'off' - condition: state entity_id: input_boolean.away_lights_active state: 'on' actions: - action: script.bottom_floor_bright - action: input_boolean.turn_off data: entity_id: input_boolean.away_lights_active - condition: state entity_id: input_boolean.enable_advent_light_automations state: 'on' - action: script.turn_on target: entity_id: - script.bedroom_advent_lights - script.office_advent_lights - script.childroom_advent_lights - alias: Coming home turn on lights relaxed initial_state: true triggers: - trigger: state entity_id: group.device_tracker_family to: home conditions: - condition: state entity_id: input_boolean.coming_home_turn_on_lights state: 'on' - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' - condition: sun after: sunset after_offset: -01:00:00 - condition: or conditions: - condition: state entity_id: group.indoor_lights state: 'off' - condition: state entity_id: input_boolean.away_lights_active state: 'on' actions: - action: script.indoor_lights_relaxed - action: input_boolean.turn_off data: entity_id: input_boolean.away_lights_active - alias: Coming home turn on hallway lights initial_state: true triggers: - trigger: state entity_id: group.device_tracker_family to: home - trigger: state entity_id: person.nellie to: home conditions: - condition: state entity_id: input_boolean.coming_home_turn_on_lights state: 'on' - condition: state entity_id: binary_sensor.relaxed_mode state: 'off' - condition: sun before: sunset before_offset: -01:00:00 - condition: or conditions: - condition: state entity_id: group.indoor_lights state: 'off' - condition: state entity_id: device_tracker.sela_lt6ywwb54 state: home - condition: state entity_id: input_boolean.away_lights_active state: 'on' actions: - action: script.hallway_bright - action: input_boolean.turn_off data: entity_id: input_boolean.away_lights_active - condition: state entity_id: input_boolean.enable_advent_light_automations state: 'on' - action: script.advent_lights_turn_on - alias: Coming home group Sonos speakers initial_state: true triggers: trigger: state entity_id: group.device_tracker_family to: home conditions: condition: state entity_id: binary_sensor.livingroom_sonos_tv_active state: 'off' actions: - choose: - conditions: - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' sequence: - action: script.sonos_group_livingroom_speaker - action: script.sonos_set_group_volume data: volume: 0.2 - action: script.sonos_ungroup_childroom_speaker - action: media_player.volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.2 default: - action: script.sonos_group_all_speakers - action: script.sonos_set_group_volume data: volume: 0.2 - alias: Start working initial_state: true triggers: trigger: state entity_id: device_tracker.sela_lt6ywwb54 to: home conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'on' - condition: time before: '17:00:00' actions: - action: script.office_work_light - action: script.hallway_top_floor_bright - action: script.sonos_ungroup_childroom_speaker - action: media_player.volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.4 - condition: state entity_id: person.nellie state: not_home - action: light.turn_off target: entity_id: - light.hallway_ceiling_bottom_floor - light.kitchen_table - light.livingroom_couch_table - light.livingroom_dinner_table - light.livingroom_floor - light.livingroom_window - light.bedroom_bedside - light.childroom_ceiling - action: script.sonos_ungroup_childroom_speaker - alias: Stop working initial_state: true triggers: trigger: state entity_id: device_tracker.sela_lt6ywwb54 to: not_home actions: action: light.turn_off target: entity_id: light.office_ceiling - alias: Leaving home during work hours initial_state: true triggers: trigger: state entity_id: person.david to: not_home conditions: - condition: state entity_id: device_tracker.sela_lt6ywwb54 state: home - condition: state entity_id: person.nellie state: home actions: action: light.turn_off target: area_id: arbetsrum - alias: Coming home during work hours initial_state: true triggers: trigger: state entity_id: device_tracker.davids_iphone to: home conditions: condition: state entity_id: device_tracker.sela_lt6ywwb54 state: home actions: action: script.office_work_light - alias: Nellie leaving home during work hours initial_state: true triggers: trigger: state entity_id: person.nellie to: not_home conditions: - condition: state entity_id: device_tracker.sela_lt6ywwb54 state: home - condition: state entity_id: person.david state: home actions: - action: light.turn_off target: entity_id: - light.hallway_ceiling_bottom_floor - light.hallway_stair_group area_id: - kok - vardagsrum - sovrum - barnrum - condition: state entity_id: media_player.kitchen_sonos state: playing - action: media_player.media_pause target: entity_id: media_player.kitchen_sonos - alias: Toggle coffee maker initial_state: true triggers: - trigger: event event_type: ios.action_fired event_data: actionID: 0AD13D57-0A4F-4973-8908-97A24064DAFE actionName: Turn on coffee maker sourceDeviceID: davids_iphone sourceDeviceName: Davids iPhone sourceDevicePermanentID: CFD2DEC1-8CF3-432F-AF78-7419632CC842 triggerSource: appShortcut actions: - action: switch.toggle target: entity_id: switch.kitchen_coffee_maker - alias: Play child room music initial_state: true triggers: - trigger: event event_type: ios.action_fired event_data: actionID: CADF83CD-087C-4737-8E5F-16D3DB61E40E actionName: Play child room music sourceDeviceID: davids_iphone sourceDeviceName: Davids iPhone sourceDevicePermanentID: CFD2DEC1-8CF3-432F-AF78-7419632CC842 triggerSource: appShortcut - trigger: event event_type: ios.action_fired event_data: actionID: 405DCC9E-1D43-4105-9757-390F31263579 actionName: Play child room music sourceDeviceID: nellies_iphone sourceDeviceName: Nellies iPhone sourceDevicePermanentID: 339E737F-6B8D-4568-8F98-3E422F7E98D8 triggerSource: appShortcut actions: - action: light.turn_off target: entity_id: - light.childroom_ceiling - light.hallway_ceiling_top_floor - light.hallway_stair_up - action: script.turn_on target: entity_id: script.play_child_room_night_music - alias: Turn on PC initial_state: true triggers: - trigger: event event_type: ios.action_fired event_data: actionID: 184A8E4A-CE5B-4B01-B015-7A54F99814F3 actionName: Turn on PC sourceDeviceID: davids_iphone sourceDeviceName: Davids iPhone sourceDevicePermanentID: CFD2DEC1-8CF3-432F-AF78-7419632CC842 triggerSource: appShortcut actions: - action: switch.turn_on target: entity_id: switch.wol_vidar - alias: Evening bright triggers: trigger: sun event: sunset offset: -01:00:00 conditions: - condition: state entity_id: group.device_tracker_family state: home - condition: state entity_id: binary_sensor.relaxed_mode state: 'off' - condition: time before: '19:00:00' actions: action: script.bottom_floor_bright - alias: Evening relaxed triggers: trigger: state entity_id: binary_sensor.relaxed_mode to: 'on' conditions: condition: state entity_id: group.device_tracker_family state: home actions: - action: script.indoor_lights_relaxed - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'on' - action: script.sonos_ungroup_childroom_speaker - condition: template value_template: '{{ state_attr(''media_player.childroom_sonos'',''volume_level'') > 0.10 }} ' - action: media_player.volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.1 - alias: Hallway bright triggers: trigger: time at: 09:00:00 conditions: condition: state entity_id: group.device_tracker_family state: home actions: action: script.hallway_bright - alias: Child room night light triggers: trigger: time at: '21:30:00' actions: action: script.childroom_night_light - alias: Advent lights workday initial_state: true triggers: trigger: time at: 06:45:00 conditions: - condition: state entity_id: input_boolean.enable_advent_light_automations state: 'on' - condition: state entity_id: binary_sensor.workday_sensor state: 'on' actions: action: script.advent_lights_turn_on - alias: Advent lights weekend initial_state: true triggers: trigger: time at: 08:15:00 conditions: - condition: state entity_id: input_boolean.enable_advent_light_automations state: 'on' - condition: state entity_id: binary_sensor.workday_sensor state: 'off' actions: action: script.advent_lights_turn_on - alias: Sunset triggers: trigger: sun event: sunset conditions: - condition: state entity_id: group.device_tracker_family state: home - condition: state entity_id: group.indoor_lights state: 'on' - condition: state entity_id: binary_sensor.relaxed_mode state: 'off' actions: action: script.turn_on target: entity_id: script.window_lights - alias: Bright after sunset bedroom initial_state: false triggers: trigger: state entity_id: script.bedroom_bright to: 'on' conditions: - condition: sun after: sunset - condition: state entity_id: input_boolean.window_lights_after_sunset state: 'on' actions: action: light.turn_on data: entity_id: light.bedroom_bedside brightness_pct: 100 - alias: Bright after sunset livingroom initial_state: true triggers: trigger: state entity_id: script.livingroom_bright to: 'on' conditions: - condition: sun after: sunset - condition: state entity_id: input_boolean.window_lights_after_sunset state: 'on' actions: action: light.turn_on target: entity_id: - light.livingroom_window - light.office_window - alias: Outdoor lights at sunset initial_state: true triggers: trigger: sun event: sunset offset: 00:05:00 actions: action: script.turn_on_outdoor_lights - alias: Outdoor lights at sunrise initial_state: true triggers: trigger: sun event: sunrise actions: action: script.turn_off_outdoor_lights - alias: Outdoor lights when sun above horizon initial_state: true triggers: trigger: time_pattern minutes: /30 conditions: - condition: state entity_id: sun.sun state: above_horizon - condition: state entity_id: - light.outdoor_main_entrance - light.outdoor_porch match: any state: 'on' actions: - action: script.turn_off_outdoor_lights - alias: Turn off child room night light at sunrise initial_state: true triggers: trigger: sun event: sunrise offset: 02:00:00 actions: action: light.turn_off target: entity_id: light.childroom_led_strip - alias: Wakeup weekdays triggers: trigger: template value_template: '{{ now() >= today_at(states(''input_datetime.wakeup_weekdays'')) - timedelta(minutes = 30) }} ' conditions: condition: or conditions: - condition: state entity_id: input_boolean.wakeup_override state: 'on' - condition: and conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'on' - condition: state entity_id: group.device_tracker_family state: home actions: action: script.wakeup_lights - alias: Child room morning wakeup light triggers: trigger: time at: 07:00:00 conditions: condition: state entity_id: binary_sensor.workday_sensor state: 'on' actions: action: light.turn_on data: entity_id: light.childroom_led_strip brightness_pct: 12 rgb_color: - 0 - 0 - 255 transition: 2 effect: None - alias: Wakeup weekend triggers: trigger: template value_template: '{{ now() >= today_at(states(''input_datetime.wakeup_weekend'')) - timedelta(minutes = 30) }} ' conditions: - condition: time weekday: - sat - sun - condition: state entity_id: group.device_tracker_family state: home actions: action: script.wakeup_lights - alias: Go to bed weekdays triggers: trigger: time at: '23:00:00' conditions: condition: state entity_id: binary_sensor.workday_sensor_offset state: 'on' actions: action: script.go_to_bed_lights - alias: Go to bed weekend triggers: trigger: time at: '23:59:00' conditions: condition: time weekday: - fri - sat actions: action: script.go_to_bed_lights - alias: Wakeup nursery triggers: trigger: time at: input_datetime.wakeup_nursery actions: action: light.turn_on data: entity_id: light.bedroom_bedside_2 brightness_pct: 100 transition: 2 - alias: Away turn on lights initial_state: true triggers: trigger: sun event: sunset conditions: - condition: state entity_id: input_boolean.enable_away_lights state: 'on' - condition: state entity_id: group.device_tracker_family state: not_home actions: - action: script.enable_away_lights - action: input_boolean.turn_on data: entity_id: input_boolean.away_lights_active - alias: Leaving home turn on lights initial_state: true triggers: trigger: state entity_id: group.device_tracker_family to: not_home conditions: - condition: state entity_id: input_boolean.enable_away_lights state: 'on' - condition: sun after: sunset actions: - action: script.enable_away_lights - action: input_boolean.turn_on data: entity_id: input_boolean.away_lights_active - alias: Away turn off lights initial_state: true triggers: trigger: time at: '23:30:00' conditions: - condition: state entity_id: group.device_tracker_family state: not_home - condition: state entity_id: group.indoor_lights state: 'on' actions: - action: script.indoor_lights_off - action: input_boolean.turn_off target: entity_id: input_boolean.away_lights_active - alias: Increase bathroom ceiling light brightness initial_state: true triggers: trigger: state entity_id: light.bathroom_ceiling to: 'on' conditions: - condition: template value_template: '{{ state_attr(''light.bathroom_ceiling'',''brightness'') < 255 }} ' - condition: time after: 07:00:00 before: '18:00:00' actions: action: light.turn_on data: entity_id: light.bathroom_ceiling brightness_pct: 100 - alias: Hallway top floor motion hallway bright initial_state: true triggers: trigger: state entity_id: binary_sensor.hallway_top_floor_motion to: 'on' conditions: - condition: state entity_id: input_boolean.enable_hue_motion_sensor_hallway state: 'on' - condition: state entity_id: light.hallway_ceiling_top_floor state: 'off' - condition: or conditions: - condition: and conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'off' - condition: time before: '18:00:00' after: 09:30:00 - condition: and conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'on' - condition: time before: '18:00:00' after: 07:00:00 - condition: template value_template: '{{ is_state_attr(''light.hallway_ceiling_bottom_floor'',''brightness'',255) }} ' - condition: template value_template: '{{ not (is_state(''binary_sensor.childroom_sonos_is_grouped'',''off'') and is_state(''media_player.childroom_sonos'',''playing'')) }} ' actions: action: script.hallway_top_floor_bright - alias: Hallway top floor motion rooms bright initial_state: true triggers: trigger: state entity_id: binary_sensor.hallway_top_floor_motion to: 'on' conditions: - condition: state entity_id: input_boolean.enable_hue_motion_sensor_hallway state: 'on' - condition: state entity_id: light.office_ceiling state: 'off' - condition: state entity_id: binary_sensor.relaxed_mode state: 'off' - condition: or conditions: - condition: and conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'off' - condition: time before: '18:00:00' after: 09:30:00 - condition: and conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'on' - condition: time before: '18:00:00' after: 07:00:00 - condition: template value_template: '{{ is_state_attr(''light.livingroom_couch_table'',''brightness'',255) }} ' actions: - action: script.turn_on target: entity_id: script.office_bright - alias: Turn off top floor lights not in use initial_state: true triggers: trigger: time_pattern minutes: /30 conditions: - condition: time after: 08:00:00 before: '18:00:00' - or: - condition: state entity_id: light.hallway_ceiling_top_floor state: 'on' - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: - binary_sensor.hallway_top_floor_motion - switch.wol_vidar state: 'off' for: 00:30:00 - condition: state entity_id: device_tracker.sela_lt6ywwb54 state: not_home for: 00:30:00 actions: - action: script.turn_on target: entity_id: script.hallway_bottom_floor_bright - action: light.turn_off target: entity_id: - light.office_ceiling - light.childroom_ceiling - alias: Gaming PC turning off initial_state: true triggers: trigger: state entity_id: switch.wol_vidar to: 'off' conditions: - condition: state entity_id: light.office_desk state: 'on' - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' actions: action: script.office_low_brightness - alias: Gaming PC turning on initial_state: true triggers: trigger: state entity_id: switch.wol_vidar to: 'on' conditions: - condition: state entity_id: light.office_desk state: 'on' - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' actions: action: script.office_relaxed - alias: Davids iPhone charging initial_state: true triggers: trigger: state entity_id: sensor.davids_iphone_battery_state to: Charging for: 00:01:00 conditions: - condition: time after: '22:00:00' before: 06:00:00 - condition: state entity_id: switch.wol_vidar state: 'off' - condition: state entity_id: light.office_desk state: 'on' actions: action: script.office_low_brightness - alias: Create light groups initial_state: true triggers: trigger: homeassistant event: start actions: - action: script.create_indoor_lights_group data: exclude_area_id: - utomhus exclude_entity_id: - light.childroom_led_strip - action: script.create_all_lights_group - alias: Watching TV triggers: trigger: state entity_id: media_player.plex_vardagsrum to: playing conditions: condition: and conditions: - condition: or conditions: - condition: time after: '20:30:00' - condition: time before: '10:00:00' - condition: or conditions: - condition: sun after: sunset after_offset: -01:00:00 - condition: sun before: sunrise before_offset: '1:00:00' actions: action: script.watching_tv_lights - alias: Decrease child room music volume when turning indoor lights off initial_state: true triggers: trigger: state entity_id: script.indoor_lights_off to: 'on' conditions: - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' - condition: template value_template: '{{ state_attr(''media_player.childroom_sonos'',''volume_level'') > 0.03 }} ' actions: action: python_script.media_player_volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.03 - alias: Car heater started initial_state: true triggers: trigger: state entity_id: switch.sbw57s_heater to: 'on' conditions: - condition: state entity_id: device_tracker.sbw57s state: not_home - condition: state entity_id: person.david state: not_home actions: action: notify.mobile_app_davids_iphone data: title: Volvo V60 message: Klimatanläggning startad - alias: Car heater audio notification initial_state: true triggers: trigger: state entity_id: switch.sbw57s_heater to: 'on' conditions: - condition: state entity_id: device_tracker.sbw57s state: home - condition: state entity_id: person.david state: home actions: action: script.sonos_tts data: entity_id: media_player.kitchen_sonos volume: 0.1 message: Klimatanläggning startad - alias: Low washer fluid initial_state: true triggers: trigger: time at: 07:00:00 conditions: condition: state entity_id: binary_sensor.volvo_sbw57s_washer_fluid_level_warning state: 'on' actions: action: notify.mobile_app_davids_iphone data: title: Volvo V60 message: Fyll på spolarvätska - alias: Alarm not active initial_state: true triggers: trigger: state entity_id: group.device_tracker_family to: not_home for: 00:30:00 conditions: condition: template value_template: '{{ not is_state(''alarm_control_panel.ajax_alarm_status'',''armed_away'') }} ' actions: choose: - conditions: '{{ states.person.david.last_changed > states.person.nellie.last_changed }} ' sequence: - action: notify.mobile_app_davids_iphone data: message: Larmet är ej aktiverat title: Larmstatus data: sound: name: default critical: 1 volume: 0.5 - conditions: '{{ states.person.david.last_changed < states.person.nellie.last_changed }} ' sequence: - action: notify.mobile_app_nellies_iphone data: message: Larmet är ej aktiverat title: Larmstatus data: sound: name: default critical: 1 volume: 0.5 - alias: Night mode not active initial_state: true triggers: trigger: state entity_id: script.indoor_lights_off to: 'on' conditions: - condition: state entity_id: group.device_tracker_family state: home for: 00:00:05 - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' - condition: template value_template: '{{ not is_state(''alarm_control_panel.ajax_alarm_status'',''armed_night'') }} ' actions: action: notify.mobile_app_davids_iphone data: title: Larmstatus message: Nattläge är ej aktiverat data: sound: name: default critical: 1 volume: 0.1 - alias: Shed door opened not home initial_state: true triggers: trigger: state entity_id: binary_sensor.outdoor_shed_door to: 'on' conditions: - condition: state entity_id: alarm_control_panel.ajax_alarm_status state: armed_away - condition: state entity_id: group.device_tracker_family state: not_home actions: action: notify.mobile_app_davids_iphone data: title: Larmstatus message: Förrådsdörr öppen data: sound: name: default critical: 1 volume: 0.5 - alias: Shed door opened alarm armed night initial_state: true triggers: trigger: state entity_id: binary_sensor.outdoor_shed_door to: 'on' conditions: condition: state entity_id: alarm_control_panel.ajax_alarm_status state: armed_night actions: action: notify.mobile_app_davids_iphone data: title: Larmstatus message: Förrådsdörr öppen data: sound: name: default critical: 1 volume: 0.5 - alias: Shed door open alarm armed night activated initial_state: true triggers: trigger: state entity_id: alarm_control_panel.ajax_alarm_status to: armed_night conditions: condition: state entity_id: binary_sensor.outdoor_shed_door state: 'on' actions: action: notify.mobile_app_davids_iphone data: title: Larmstatus message: Förrådsdörr öppen data: sound: name: default critical: 1 volume: 0.1 - alias: Person detected notify Davids iPhone triggers: trigger: state entity_id: sensor.asgari_1_person_count conditions: condition: template value_template: '{{ trigger.to_state.state | int > trigger.from_state.state | int }}' actions: action: notify.mobile_app_davids_iphone data: title: Övervakningskamera message: Person detekterad data: url: /lovelace/2 push: sound: name: US-EN-Morgan-Freeman-Motion-Detected.wav critical: 1 volume: 0.8 - alias: Person detected notify Nellies iPhone triggers: trigger: state entity_id: sensor.asgari_1_person_count conditions: condition: template value_template: '{{ trigger.to_state.state | int > trigger.from_state.state | int }}' actions: action: notify.mobile_app_nellies_iphone data: title: Övervakningskamera message: Person detekterad data: url: /lovelace/2 push: sound: name: US-EN-Morgan-Freeman-Motion-Detected.wav critical: 1 volume: 0.8 - alias: Person detected notify Sonos triggers: trigger: state entity_id: sensor.asgari_1_person_count conditions: condition: template value_template: '{{ trigger.to_state.state | int > trigger.from_state.state | int }}' actions: action: script.sonos_play_local_media data: entity_id: media_player.livingroom_sonos media_filename: US-EN-Morgan-Freeman-Motion-Detected.mp3 volume: 0.3 - alias: Sound detected notify Davids iPhone triggers: - trigger: state entity_id: binary_sensor.deltaco_1_child_singing_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_crying_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_humming_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_scream_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_humming_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_singing_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_whispering_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_yell_sound to: 'on' actions: action: notify.mobile_app_davids_iphone data: title: Barnrum message: Ljud detekterat data: url: /lovelace/2 push: sound: name: WebcamStart.caf critical: 1 volume: 0.8 - alias: Sound detected notify Nellies iPhone triggers: - trigger: state entity_id: binary_sensor.deltaco_1_child_singing_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_crying_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_humming_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_scream_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_humming_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_singing_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_whispering_sound to: 'on' - trigger: state entity_id: binary_sensor.deltaco_1_yell_sound to: 'on' actions: action: notify.mobile_app_nellies_iphone data: title: Barnrum message: Ljud detekterat data: url: /lovelace/2 push: sound: name: WebcamStart.caf critical: 1 volume: 0.8 - alias: Web service down initial_state: true triggers: trigger: time_pattern minutes: /10 conditions: not: - condition: state entity_id: - sensor.docker_traefik_state - sensor.docker_authelia_state - sensor.docker_mariadb_state - sensor.docker_wordpress_state state: running - condition: time after: 04:00:00 before: 05:00:00 weekday: sun actions: action: notify.mobile_app_davids_iphone data: title: Web service status message: A web service is down data: url: /lovelace/6 - alias: Hue switch bright initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: short_release subtype: 1 conditions: condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: action: script.bottom_floor_bright - alias: Hue switch relaxed initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: long_release subtype: 1 conditions: condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: - action: script.indoor_lights_relaxed - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'on' - action: script.sonos_ungroup_childroom_speaker - action: media_player.volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.2 - alias: Hue switch turn off lighs initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: short_release subtype: 4 conditions: condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: action: script.indoor_lights_off - alias: Hue switch low brightness initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: long_release subtype: 4 conditions: condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: action: script.indoor_lights_low_brightness - alias: Hue switch group livingroom speaker initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: long_release subtype: 2 conditions: condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: choose: - conditions: '{{ is_state(''binary_sensor.livingroom_sonos_is_grouped'',''off'') }} ' sequence: action: script.sonos_group_livingroom_speaker - conditions: '{{ is_state(''binary_sensor.livingroom_sonos_is_grouped'',''on'') }} ' sequence: action: script.sonos_ungroup_livingroom_speaker - alias: Hue switch group childroom speaker initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: long_release subtype: 3 conditions: condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: choose: - conditions: '{{ is_state(''binary_sensor.childroom_sonos_is_grouped'',''off'') }} ' sequence: action: script.sonos_group_childroom_speaker - conditions: '{{ is_state(''binary_sensor.childroom_sonos_is_grouped'',''on'') }} ' sequence: action: script.sonos_ungroup_childroom_speaker - alias: Hue switch increase Sonos volume initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: short_release subtype: 2 conditions: - condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: - choose: - conditions: - condition: state entity_id: media_player.kitchen_sonos state: - paused - idle - condition: state entity_id: media_player.livingroom_apple_tv state: playing - condition: state entity_id: binary_sensor.livingroom_sonos_tv_active state: 'on' sequence: - action: python_script.media_player_volume_set data: entity_id: media_player.livingroom_sonos volume_level: '{{ [((state_attr(''media_player.livingroom_sonos'',''volume_level'') | float * 1.15 + 0.03) | round(2)), 1] | min }} ' - conditions: - condition: state entity_id: media_player.kitchen_sonos state: - paused - idle - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' sequence: - action: python_script.media_player_volume_set data: entity_id: media_player.childroom_sonos volume_level: '{{ [((state_attr(''media_player.childroom_sonos'',''volume_level'') | float * 1.15 + 0.03) | round(2)), 1] | min }} ' default: - action: script.sonos_increase_volume - alias: Hue switch decrease Sonos volume initial_state: true triggers: trigger: event event_type: hue_event event_data: id: hallway_switch_button type: short_release subtype: 3 conditions: - condition: state entity_id: input_boolean.enable_hue_switch_hallway state: 'on' actions: - choose: - conditions: - condition: state entity_id: media_player.kitchen_sonos state: - paused - idle - condition: state entity_id: media_player.livingroom_apple_tv state: playing - condition: state entity_id: binary_sensor.livingroom_sonos_tv_active state: 'on' sequence: - action: python_script.media_player_volume_set data: entity_id: media_player.livingroom_sonos volume_level: '{{ [((state_attr(''media_player.livingroom_sonos'',''volume_level'') | float * 0.85 - 0.03) | round(2)), 0.05] | max }} ' - conditions: - condition: state entity_id: media_player.kitchen_sonos state: - paused - idle - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' sequence: - action: python_script.media_player_volume_set data: entity_id: media_player.childroom_sonos volume_level: '{{ [((state_attr(''media_player.childroom_sonos'',''volume_level'') | float * 0.85 - 0.03) | round(2)), 0.05] | max }} ' default: - action: script.sonos_decrease_volume - alias: Ikea button bedroom on initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 3b531df34853b38343b729aacef15e48 command: 'on' actions: action: script.bedroom_relaxed - alias: Ikea button bedroom on long press initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 3b531df34853b38343b729aacef15e48 command: move_with_on_off actions: action: script.bedroom_low_brightness - alias: Ikea button bedroom off initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 3b531df34853b38343b729aacef15e48 command: 'off' actions: - action: light.turn_off target: area_id: sovrum - alias: Ikea button bedroom off long press triggers: trigger: event event_type: zha_event event_data: device_id: 3b531df34853b38343b729aacef15e48 command: move actions: action: script.indoor_lights_off - alias: Ikea styrbar bedroom on initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: f423762e1c28755b0123cc7fd21c5fa7 command: 'on' actions: action: script.bedroom_relaxed - alias: Ikea styrbar bedroom on long press initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: f423762e1c28755b0123cc7fd21c5fa7 command: move_with_on_off actions: action: script.bedroom_low_brightness - alias: Ikea styrbar bedroom off initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: f423762e1c28755b0123cc7fd21c5fa7 command: 'off' actions: - action: light.turn_off target: area_id: sovrum - alias: Ikea styrbar bedroom off long press triggers: trigger: event event_type: zha_event event_data: device_id: f423762e1c28755b0123cc7fd21c5fa7 command: move actions: action: script.indoor_lights_off - alias: Ikea styrbar bedroom increase press initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: f423762e1c28755b0123cc7fd21c5fa7 command: press args: - 256 - 13 - 0 actions: choose: conditions: condition: state entity_id: light.bedroom_ceiling state: 'on' sequence: action: light.turn_on data: entity_id: light.bedroom_ceiling brightness: '{{ [state_attr(''light.bedroom_ceiling'',''brightness'') | int + 25, 255] | min }} ' default: action: script.bedroom_nursery_light_high - alias: Ikea styrbar bedroom decrease press initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: f423762e1c28755b0123cc7fd21c5fa7 command: press args: - 257 - 13 - 0 actions: choose: conditions: condition: state entity_id: light.bedroom_ceiling state: 'on' sequence: action: light.turn_on data: entity_id: light.bedroom_ceiling brightness: '{{ [state_attr(''light.bedroom_ceiling'',''brightness'') | int - 25, 1] | max }} ' default: action: script.bedroom_nursery_light - alias: Ikea button childroom toggle initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: toggle actions: action: light.toggle data: entity_id: light.childroom_ceiling - alias: Ikea button childroom bright initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: step_with_on_off actions: action: script.childroom_bright - alias: Ikea button childroom relaxed initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: step actions: action: script.childroom_relaxed - alias: Ikea button childroom window light toggle initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: move_with_on_off conditions: condition: state entity_id: input_boolean.enable_advent_light_automations state: 'on' actions: action: light.toggle data: entity_id: light.childroom_window - alias: Ikea button childroom led strip disco initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: move_with_on_off conditions: condition: state entity_id: input_boolean.enable_advent_light_automations state: 'off' actions: - choose: - conditions: condition: state entity_id: light.childroom_led_strip state: 'off' sequence: - action: script.turn_on target: entity_id: script.childroom_disco - conditions: condition: state entity_id: light.childroom_led_strip state: 'on' sequence: - action: light.turn_off target: entity_id: light.childroom_led_strip - alias: Ikea button childroom light turn off initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: move actions: action: script.childroom_light_dim - alias: Ikea button childroom increase volume initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: press args: - 256 - 13 - 0 actions: action: python_script.media_player_volume_set data: entity_id: media_player.childroom_sonos volume_level: '{{ [((state_attr(''media_player.childroom_sonos'',''volume_level'') | float * 1.15 + 0.03) | round(2)), 1] | min }} ' - alias: Ikea button childroom decrease volume initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: press args: - 257 - 13 - 0 actions: action: python_script.media_player_volume_set data: entity_id: media_player.childroom_sonos volume_level: '{{ [((state_attr(''media_player.childroom_sonos'',''volume_level'') | float * 0.85 - 0.03) | round(2)), 0.05] | max }} ' - alias: Ikea button childroom ungroup speaker initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: hold args: - 3329 - 0 actions: action: script.sonos_ungroup_childroom_speaker - alias: Ikea button childroom group speaker initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 44bc2855a0757d86e2bf3ca19df7db77 command: hold args: - 3328 - 0 actions: action: script.sonos_group_childroom_speaker - alias: Office switch turn on initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 0e0ddda228abe1831c9056b2834b6454 command: 'on' actions: if: condition: state entity_id: binary_sensor.relaxed_mode state: 'off' then: action: script.turn_on target: entity_id: script.office_bright else: action: script.turn_on target: entity_id: script.office_relaxed - alias: Office switch turn off initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 0e0ddda228abe1831c9056b2834b6454 command: 'off' actions: action: light.turn_off target: area_id: arbetsrum - alias: Office switch turn on hold initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 0e0ddda228abe1831c9056b2834b6454 command: move_with_on_off conditions: condition: state entity_id: binary_sensor.relaxed_mode state: 'off' actions: action: script.turn_on target: entity_id: script.hallway_top_floor_bright - alias: Office switch turn off hold initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: 0e0ddda228abe1831c9056b2834b6454 command: move actions: action: script.turn_on target: entity_id: script.indoor_lights_low_brightness - alias: Ikea switch turn on coffee maker initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: ba91148bbaa6400dc4a15b0b42004ddb command: 'on' actions: - action: switch.turn_on target: entity_id: switch.kitchen_coffee_maker - alias: Ikea switch turn off coffee maker initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: ba91148bbaa6400dc4a15b0b42004ddb command: 'off' actions: action: switch.turn_off target: entity_id: switch.kitchen_coffee_maker - alias: Ikea switch turn on kitchen bright initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: ba91148bbaa6400dc4a15b0b42004ddb command: move_with_on_off actions: action: script.kitchen_bright - alias: Ikea switch turn off kitchen lights initial_state: true triggers: trigger: event event_type: zha_event event_data: device_id: ba91148bbaa6400dc4a15b0b42004ddb command: move actions: action: light.turn_off target: area_id: kok - alias: Shelly livingroom relaxed initial_state: true triggers: trigger: event event_type: shelly.click event_data: device_id: aad1e36ae5e1a5709dd95de24f0c5fea device: shellyswitch25-E098068CEEBD channel: 2 click_type: single conditions: condition: template value_template: '{{ is_state(''light.livingroom_couch_table'',''on'') and not is_state_attr(''light.livingroom_couch_table'',''brightness'',76) }} ' actions: action: script.livingroom_relaxed - alias: Shelly livingroom bright initial_state: true triggers: trigger: event event_type: shelly.click event_data: device_id: aad1e36ae5e1a5709dd95de24f0c5fea device: shellyswitch25-E098068CEEBD channel: 2 click_type: single conditions: condition: template value_template: '{{ is_state(''light.livingroom_couch_table'',''off'') or is_state_attr(''light.livingroom_couch_table'',''brightness'',76) }} ' actions: action: script.livingroom_bright - alias: Shelly livingroom relaxed long press initial_state: true triggers: trigger: event event_type: shelly.click event_data: device_id: aad1e36ae5e1a5709dd95de24f0c5fea device: shellyswitch25-E098068CEEBD channel: 2 click_type: long conditions: condition: state entity_id: light.livingroom_couch_table state: 'off' actions: action: script.livingroom_relaxed - alias: Shelly livingroom turn off lights initial_state: true triggers: trigger: event event_type: shelly.click event_data: device_id: aad1e36ae5e1a5709dd95de24f0c5fea device: shellyswitch25-E098068CEEBD channel: 2 click_type: long conditions: condition: state entity_id: light.livingroom_couch_table state: 'on' actions: - action: light.turn_off target: area_id: vardagsrum - alias: Enable Sonos alarm triggers: trigger: time at: 03:00:00 conditions: - condition: state entity_id: binary_sensor.workday_sensor state: 'on' - condition: state entity_id: automation.wakeup_weekdays state: 'on' actions: action: script.sonos_set_alarm - alias: Skip song tracks initial_state: true triggers: trigger: template value_template: '{{ state_attr(''media_player.childroom_sonos'',''media_title'')|regex_search(''Perfect'', ignorecase=False) }} ' actions: action: media_player.media_next_track data: entity_id: media_player.childroom_sonos - alias: Activate repeat on Sonos bedroom initial_state: true triggers: trigger: state entity_id: media_player.childroom_sonos to: playing for: 00:00:05 conditions: - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' - condition: template value_template: '{{ is_state_attr(''media_player.childroom_sonos'',''repeat'',''off'') and is_state_attr(''media_player.childroom_sonos'',''media_content_type'',''music'') }} ' actions: action: media_player.repeat_set data: entity_id: media_player.childroom_sonos repeat: all - alias: TV off group speakers initial_state: true triggers: trigger: state entity_id: binary_sensor.livingroom_sonos_tv_active to: 'off' conditions: condition: not conditions: - condition: state entity_id: binary_sensor.livingroom_sonos_is_grouped state: 'on' - condition: state entity_id: media_player.livingroom_sonos state: playing actions: action: script.sonos_group_livingroom_speaker - alias: TV off disable night mode initial_state: true triggers: trigger: state entity_id: binary_sensor.livingroom_sonos_tv_active to: 'off' conditions: condition: or conditions: - condition: state entity_id: switch.sonos_livingroom_night_sound state: 'on' - condition: state entity_id: switch.sonos_livingroom_speech_enhancement state: 'on' actions: action: switch.turn_off target: entity_id: - switch.sonos_livingroom_night_sound - switch.sonos_livingroom_speech_enhancement - alias: Leaving home pause Sonos kitchen initial_state: true triggers: - trigger: state entity_id: group.device_tracker_family to: not_home - trigger: state entity_id: alarm_control_panel.ajax_alarm_status to: armed_away conditions: condition: state entity_id: media_player.kitchen_sonos state: playing actions: - action: python_script.media_player_volume_set data: entity_id: media_player.kitchen_sonos set_group_volume: true volume_level: 0.01 - action: media_player.media_pause entity_id: media_player.kitchen_sonos - action: script.sonos_set_group_volume data: volume: 0.2 - alias: Leaving home pause Sonos childroom initial_state: true triggers: - trigger: state entity_id: group.device_tracker_family to: not_home - trigger: state entity_id: alarm_control_panel.ajax_alarm_status to: armed_away conditions: - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' actions: action: media_player.media_pause entity_id: media_player.childroom_sonos - alias: Pause bedroom music initial_state: true triggers: trigger: event event_type: timer.finished event_data: entity_id: timer.childroom_music conditions: - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' actions: - action: python_script.media_player_volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.01 - action: media_player.media_pause entity_id: media_player.childroom_sonos - action: media_player.volume_set data: entity_id: media_player.childroom_sonos volume_level: 0.1 - alias: Start bedroom music timer initial_state: true triggers: trigger: state entity_id: script.indoor_lights_off to: 'on' conditions: - condition: state entity_id: media_player.childroom_sonos state: playing - condition: state entity_id: timer.childroom_music state: idle - condition: state entity_id: binary_sensor.childroom_sonos_is_grouped state: 'off' - condition: state entity_id: binary_sensor.relaxed_mode state: 'on' actions: action: script.bedroom_music_timer_start - alias: Kitchen coffee maker timer start triggers: - trigger: state entity_id: switch.kitchen_coffee_maker to: 'on' id: state - trigger: event event_type: zha_event event_data: device_id: ba91148bbaa6400dc4a15b0b42004ddb command: 'on' id: remote actions: choose: - conditions: - condition: trigger id: state sequence: action: script.kitchen_coffee_maker_timer_start - conditions: - condition: trigger id: remote - condition: state entity_id: switch.kitchen_coffee_maker state: 'on' sequence: action: script.kitchen_coffee_maker_timer_start - alias: Kitchen coffee maker timer cancel initial_state: true triggers: trigger: state entity_id: switch.kitchen_coffee_maker to: 'off' conditions: condition: state entity_id: timer.kitchen_coffee_maker state: active actions: action: script.kitchen_coffee_maker_timer_cancel - alias: Timer turn off kitchen coffee maker initial_state: true triggers: trigger: event event_type: timer.finished event_data: entity_id: timer.kitchen_coffee_maker conditions: condition: state entity_id: switch.kitchen_coffee_maker state: 'on' actions: action: switch.turn_off target: entity_id: switch.kitchen_coffee_maker - alias: Battery charging station timer start initial_state: true triggers: trigger: state entity_id: switch.battery_charging_station to: 'on' actions: action: timer.start data: entity_id: timer.battery_charging_station duration: '10:00:00' - alias: Battery charging station timer cancel initial_state: true triggers: trigger: state entity_id: switch.battery_charging_station from: 'on' actions: action: timer.cancel target: entity_id: timer.battery_charging_station - alias: Battery charging station turn off initial_state: true triggers: trigger: event event_type: timer.finished event_data: entity_id: timer.battery_charging_station actions: action: switch.turn_off target: entity_id: switch.battery_charging_station