- id: 1st_floor_landing_lights_on_when_movement alias: 1st floor landing - Lights on when movement trigger: - platform: state entity_id: binary_sensor.1st_floor_landing_motion_detector_occupancy from: 'on' to: 'off' condition: null action: - alias: Turn on 1st floor landing light service: light.turn_off target: entity_id: light.1st_floor_landing_light - id: 1st_floor_landing_lights_on_when_motion alias: 1st floor landing - Lights on when motion trigger: - platform: state entity_id: binary_sensor.1st_floor_landing_motion_detector_occupancy from: 'off' to: 'on' condition: null action: - alias: Turn on 1st floor landing light service: light.turn_on target: entity_id: light.1st_floor_landing_light data: brightness_pct: '{%- if (now() > today_at("19:30")) or (now() < today_at("09:00")) -%} 1 {%- elif (states(''sensor.1st_floor_landing_motion_detector_illuminance_lux'') | int ) < ( states(''input_number.1st_floor_landing_light_trigger_lux'') | int ) -%} 50 {%- else -%} 0 {%- endif -%} ' transition: 2 - id: alkmaar_cs_zone_movement alias: Alkmaar CS - Zone movement description: '' trigger: - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.alkmaar_cs event: enter - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.alkmaar_cs event: leave action: - service: notify.all_devices data: message: "{% if trigger.event == \"leave\" %}\n {{ trigger.from_state.attributes.friendly_name\ \ }} left zone: {{ trigger.zone.attributes.friendly_name }}\n{% else %}\n\ \ {{ trigger.from_state.attributes.friendly_name }} entered zone: {{ trigger.zone.attributes.friendly_name\ \ }}\n{% endif %}\n" data: sticky: true - id: amsterdam_bijlmer_arena_zone_movement alias: Amsterdam Bijlmer ArenA - Zone movement description: '' trigger: - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.amsterdam_bijlmer_arena event: enter - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.amsterdam_bijlmer_arena event: leave action: - service: notify.all_devices data: message: "{% if trigger.event == \"leave\" %}\n {{ trigger.from_state.attributes.friendly_name\ \ }} left zone: {{ trigger.zone.attributes.friendly_name }}\n{% else %}\n\ \ {{ trigger.from_state.attributes.friendly_name }} entered zone: {{ trigger.zone.attributes.friendly_name\ \ }}\n{% endif %}\n" data: sticky: true - alias: Living room - AppleTV - Movie Night - Pauze id: living_room_appletv_movie_night_pauze description: '' triggers: - trigger: state entity_id: media_player.woonkamer to: paused conditions: - condition: state entity_id: input_boolean.movie_night_enabled state: 'on' actions: - action: light.turn_on entity_id: light.dining_room_lights data: brightness_pct: 100 - action: light.turn_on entity_id: light.living_room_lights data: brightness_pct: 75 - alias: Living room - AppleTV - Movie Night - Play id: living_room_appletv_movie_night_play description: '' triggers: - trigger: state entity_id: media_player.woonkamer to: playing conditions: - condition: state entity_id: input_boolean.movie_night_enabled state: 'on' actions: - action: light.turn_on entity_id: light.dining_room_lights data: brightness_pct: 50 - action: light.turn_on entity_id: light.living_room_light_kitchen_corner data: brightness_pct: 50 - action: light.turn_off entity_id: light.living_room_light_tv_corner - action: light.turn_off entity_id: light.living_room_light_window_corner - alias: Living room - AppleTV - Movie Night - Pauze id: living_room_appletv_movie_night_pauze description: '' triggers: - trigger: state entity_id: media_player.woonkamer to: standby conditions: - condition: state entity_id: input_boolean.movie_night_enabled state: 'on' actions: - action: light.turn_on entity_id: light.dining_room_lights data: brightness_pct: 100 - action: light.turn_on entity_id: light.living_room_lights data: brightness_pct: 100 - action: input_boolean.turn_off target: entity_id: input_boolean.movie_night_enabled - alias: Attick Light - Off on clear id: attick_light_off_when_clear description: '' trigger: - platform: state entity_id: binary_sensor.attick_landing_motion_detector_occupancy to: 'off' condition: [] action: - service: light.turn_off target: entity_id: light.attick_landing_light mode: single - alias: Attick Light - On on motion id: attick_light_on_when_motion description: '' trigger: - platform: state entity_id: binary_sensor.attick_landing_motion_detector_occupancy to: 'on' condition: [] action: - service: light.turn_on target: entity_id: light.attick_landing_light data: brightness_pct: '{%- if (now() > today_at("19:30")) or (now() < today_at("07:30")) -%} 1 {%- else -%} 100 {%- endif -%} ' transition: 2 mode: restart - alias: Backup - Create full backup id: create_backup trigger: - platform: time_pattern hours: '3' minutes: '0' seconds: '0' action: - service: hassio.backup_full - alias: Backup - Upload backups to Borgbase id: upload_backups_to_borgbase trigger: - platform: time_pattern hours: '5' minutes: '0' seconds: '0' action: - service: hassio.addon_start data: addon: f51ab629_borg_backup - alias: External lights - Off when sunrise id: external_lights_off_when_sunrise description: '' trigger: - event: sunrise platform: sun condition: [] action: - service: light.turn_off data: {} entity_id: light.outside_lights - alias: External lights - On when sunset id: external_lights_on_when_sunset description: '' trigger: - event: sunset platform: sun condition: [] action: - service: light.turn_on data: brightness_pct: 25 entity_id: light.outside_lights mode: single - alias: Garbage alert id: garbage_collection_alert mode: single triggers: - trigger: state entity_id: - sensor.afvalinfo_home_gft - sensor.afvalinfo_home_papier - sensor.afvalinfo_home_pbd attribute: is_collection_date_today to: true condition: [] actions: - action: notify.mobile_jorn_maeike_priority_high data: title: 🚮 Today is garbage day! 🚮 message: '{{ trigger.to_state.attributes.friendly_name }} ' - action: persistent_notification.create data: title: 🚮 Today is garbage day! 🚮 message: '🚮 {{ trigger.to_state.attributes.friendly_name }} 🚮 Today is garbage day! Upcoming garbage collections Zwart (PMD) {{ states(''sensor.afvalinfo_home_pbd'') }} - {{ state_attr(''sensor.afvalinfo_home_pbd'', ''days_until_collection_date'') }} day(s) Groen (GFT) {{ states(''sensor.afvalinfo_home_gft'') }} - {{ state_attr(''sensor.afvalinfo_home_gft'', ''days_until_collection_date'') }} day(s) Blauw (PAP) {{ states(''sensor.afvalinfo_home_papier'') }} - {{ state_attr(''sensor.afvalinfo_home_papier'', ''days_until_collection_date'') }} day(s) ' - alias: Downstairs - Turn Off Everything id: ground_floor_turn_everything_off trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: both_long condition: [] action: - entity_id: - light.downstairs_inside_lights service: light.turn_off - entity_id: - switch.living_room_receiver - switch.living_room_tv service: switch.turn_off - entity_id: - media_player.nvidia_shield service: media_player.turn_off - delay: 00:00:10 - entity_id: - switch.living_room_smart_plug_tv service: switch.turn_off mode: restart - alias: Hallway Light - Off when clear id: hallway_light_off_when_clear description: '' trigger: - platform: state entity_id: binary_sensor.hallway_motion_detector_occupancy to: 'off' condition: [] action: - service: light.turn_off target: entity_id: light.hallway_light mode: single - alias: Hallway light - On on motion id: hallway_light_on_when_motion description: '' trigger: - platform: state entity_id: binary_sensor.hallway_motion_detector_occupancy to: 'on' condition: [] action: - service: light.turn_on target: entity_id: light.hallway_light data: brightness_pct: '{%- if (now() > today_at("19:30")) or (now() < today_at("09:00")) -%} 1 {%- elif (states(''sensor.hallway_motion_detector_illuminance_lux'') | default(0) | int ) < ( states(''input_number.hallway_light_trigger_lux'') | int ) -%} 50 {%- else -%} 0 {%- endif -%} ' transition: 2 mode: restart - id: home_zone_movement alias: Home - Zone movement description: '' trigger: - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.home event: enter - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.home event: leave action: - service: notify.all_devices data: message: "{% if trigger.event == \"leave\" %}\n {{ trigger.from_state.attributes.friendly_name\ \ }} left zone: {{ trigger.zone.attributes.friendly_name }}\n{% else %}\n\ \ {{ trigger.from_state.attributes.friendly_name }} entered zone: {{ trigger.zone.attributes.friendly_name\ \ }}\n{% endif %}\n" data: sticky: true - alias: Living room - Lights off when clear id: living_room_lights_off_when_clear description: '' trigger: - platform: state entity_id: binary_sensor.living_room_motion_detector_occupancy to: 'off' condition: - alias: condition alias (name) condition: time after: '23:00:00' before: 07:00:00 action: - service: light.turn_off target: entity_id: light.dining_room_lights - service: light.turn_off target: entity_id: light.living_room_lights mode: single - alias: Living room - Lights on when door opened id: living_room_lights_on_when_door_opened description: Turn on lights when door is opened triggers: - trigger: state entity_id: binary_sensor.living_room_door_sensor_contact from: 'off' to: 'on' condition: [] actions: - action: light.turn_on data: brightness_pct: 100 entity_id: light.dining_room_lights - action: light.turn_on data: brightness_pct: '{%- if (states(''sensor.living_room_motion_detector_illuminance'') | int ) < (states(''input_number.living_room_light_trigger_lux'') | int) -%} 100 {%- else -%} 0 {%- endif -%}' entity_id: light.living_room_lights mode: single - alias: Shed - Light off on door close id: light_off_when_door_closes description: '' trigger: - platform: state entity_id: binary_sensor.shed_door_sensor_contact to: 'off' condition: [] action: - service: light.turn_off target: entity_id: light.shed_light mode: single - alias: Shed - Light on on door open id: shed_light_on_when_door_opens description: '' trigger: - platform: state entity_id: binary_sensor.shed_door_sensor_contact to: 'on' condition: [] action: - service: light.turn_on entity_id: light.shed_light data: brightness_pct: 100 mode: single - alias: Living Room - Listen to Spotify id: living_room_listen_to_spotify mode: restart trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: right condition: [] action: - service: switch.turn_on entity_id: - switch.living_room_smart_plug_tv - delay: 00:00:05 - service: switch.turn_on entity_id: - switch.living_room_receiver - service: switch.turn_off entity_id: - switch.living_room_tv - service: media_player.turn_on entity_id: - media_player.nvidia_shield - delay: 00:00:02 - service: media_player.select_source data_template: entity_id: media_player.nvidia_shield source: Spotify - delay: 00:00:02 - service: mqtt.publish data_template: topic: cmnd/Living_room_-_IR_send/irsend payload_template: '{"Protocol":"NEC","Bits":32,"Data":0x4B3631CE}' - alias: Mindergas.nl - Post meter readings triggers: - trigger: time at: 00:02:03 actions: - action: rest_command.mindergas_post_meter_readings data_template: date: '{{ (now() - timedelta(hours = 1)).date() }}' meter_reading: '{{ states(''sensor.dsmr_reader_gas_delivered'') }}' - alias: Living room - Movie Night - Enabled id: living_room_movie_night_enabled description: '' triggers: - trigger: state entity_id: input_boolean.movie_night_enabled to: 'on' actions: - action: scene.turn_on target: entity_id: scene.movie_night - alias: Doorbell - Notification when pressed id: notification_when_doorbell_press description: '' mode: single trigger: - alias: Someone presses the doorbell trigger: state entity_id: binary_sensor.doorbell_visitor to: 'on' condition: [] variables: local_time: '{{ now().strftime(''%Y-%m-%dT%H%M%S%Z'') }}' snapshot_path_local: /config/www/tmp/{{ local_time }}.jpg snapshot_path_external: /local/tmp/{{ local_time }}.jpg actions: - alias: Send an alert to everyone action: notify.mobile_jorn_maeike_priority_high data: message: 'There is someone at the door! ' - alias: Take a snapshot action: camera.snapshot data: filename: '{{ snapshot_path_local }}' target: entity_id: camera.doorbell_clear - delay: 00:00:02 - alias: Send the snapshot to everyone action: notify.mobile_jorn_maeike_priority_high data: message: Here they are data: attachment: url: '{{ snapshot_path_external }}' content_type: JPEG - alias: Set persistent notification action: persistent_notification.create data: title: Someone was at the door message: '![image info]({{ snapshot_path_external }}) ' - id: notify_when_front_door_opened alias: Hallway - Notify when front door opened trigger: - platform: state entity_id: binary_sensor.hallway_door_sensor_contact from: 'off' to: 'on' action: - alias: Turn on hallway light service: light.turn_on data: brightness_pct: 40 target: entity_id: light.hallway_light - id: office_zone_movement alias: Office - Zone movement description: '' trigger: - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.ing_acanthus event: enter - platform: zone entity_id: - person.jorn_eilander - person.maeike_eilander zone: zone.ing_acanthus event: leave action: - service: notify.all_devices data: message: "{% if trigger.event == \"leave\" %}\n {{ trigger.from_state.attributes.friendly_name\ \ }} left zone: {{ trigger.zone.attributes.friendly_name }}\n{% else %}\n\ \ {{ trigger.from_state.attributes.friendly_name }} entered zone: {{ trigger.zone.attributes.friendly_name\ \ }}\n{% endif %}\n" data: sticky: true - alias: Zigbee2MQTT Log Level initial_state: 'on' trigger: platform: state entity_id: input_select.zigbee2mqtt_log_level action: - service: mqtt.publish data: payload_template: '{{ states(''input_select.zigbee2mqtt_log_level'') }}' topic: zigbee2mqtt/bridge/request/config/log_level - id: zigbee_join_enabled alias: Zigbee Join Enabled trigger: platform: state entity_id: switch.zigbee2mqtt_main_join to: 'on' action: service: timer.start entity_id: timer.zigbee_permit_join data_template: duration: '{{ ''00:0%i:00'' % (states(''input_number.zigbee2mqtt_join_minutes'') | int ) }}' - id: zigbee_join_disabled alias: Zigbee Join Disabled trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.zigbee_permit_join - platform: state entity_id: switch.zigbee2mqtt_main_join to: 'off' action: - service: timer.cancel data: entity_id: timer.zigbee_permit_join - service: switch.turn_off entity_id: switch.zigbee2mqtt_main_join - id: zigbee2mqtt_create_notification_on_successful_interview alias: Zigbee Device Joined Notification trigger: platform: mqtt topic: zigbee2mqtt/bridge/event condition: condition: template value_template: '{{trigger.payload_json.type == "device_interview" and trigger.payload_json.data.status == "successful" and trigger.payload_json.data.supported}}' action: - service: 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}}' - alias: Living Room - Play Nintendo Switch id: living_room_play_switch mode: restart trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: left_double action: - service: switch.turn_on entity_id: - switch.living_room_smart_plug_tv - delay: 00:00:05 - service: switch.turn_on entity_id: - switch.living_room_receiver - switch.living_room_tv - service: media_player.turn_off entity_id: - media_player.nvidia_shield - delay: 00:00:02 - service: mqtt.publish data_template: topic: cmnd/Living_room_-_IR_send/irsend payload: '{"Protocol":"NEC","Bits":32,"Data":0x4BB6B04F}' - alias: 🥵 Room temperature 🥶 id: home_room_temperature trigger: - platform: numeric_state entity_id: - sensor.bedroom_eline_climate_sensor_temperature - sensor.bedroom_julien_climate_sensor_temperature - sensor.bedroom_master_climate_sensor_temperature - sensor.dining_room_climate_sensor_temperature - sensor.study_climate_sensor_temperature above: 18 below: 21 for: minutes: 10 action: - service: notify.mobile_app_jorns_iphone data: message: '🥵 Room temperature 🥶 {{ trigger.to_state.attributes.friendly_name | replace(''_'',''\_'') }} is reporting: {{ trigger.to_state.attributes.temperature }}{{ trigger.to_state.attributes.unit_of_measurement }}. The temperature is {%- if trigger.to_state.attributes.temperature > trigger.from_state.attributes.temperature -%} rising! {%- else -%} falling! {%- endif -%}' - alias: 🔥 Smoke Alarm 🔥 id: smoke_sensor_triggered mode: restart triggers: - trigger: template value_template: "{%- for sensor in states.binary_sensor if (sensor.entity_id).endswith(\"\ smoke\") and is_state(sensor.entity_id, \"on\") -%}\n {{ is_state(sensor.entity_id,\ \ 'on') }}\n{%- endfor -%}" actions: - action: notify.mobile_jorn_maeike_priority_high data: title: 🔥 Smoke Alarm 🔥 message: "{%- for sensor in states.binary_sensor if (sensor.entity_id).endswith(\"\ smoke\") and is_state(sensor.entity_id, \"on\") -%}\n {{ sensor.name }}\n\ {% endfor %}\n" data: sticky: true - action: persistent_notification.create data: title: 🔥 Smoke Alarm 🔥 message: "{%- for sensor in states.binary_sensor if (sensor.entity_id).endswith(\"\ smoke\") and is_state(sensor.entity_id, \"on\") -%}\n {{ sensor.name }}\n\ {% endfor %}\n" - alias: ⚠️ Smoke Alarm(s) unavailable ⚠️ id: smoke_sensor_unavailable mode: restart triggers: - trigger: time at: 07:00 conditions: "{%- set sensors = namespace() -%} {%- set sensors.smoke = [] -%} {%-\ \ for sensor in states.binary_sensor if (sensor.entity_id).endswith(\"smoke\"\ ) and is_state(sensor.entity_id, [\"unavailable\", \"unknown\"]) -%}\n {%- set\ \ sensors.smoke = sensors.smoke + [sensor] -%}\n{%- endfor -%} {%- if sensors.smoke\ \ | length > 0 -%} true {%- endif -%}" actions: - action: notify.mobile_app_jorns_iphone data: title: ⚠️ Smoke Alarm(s) unavailable ⚠️ message: 'Some smoke alarms are unavailable, go fix! ' data: sticky: true - action: persistent_notification.create data: title: ⚠️ Smoke Alarm(s) unavailable ⚠️ message: "{% for sensor in states.binary_sensor if (sensor.entity_id).endswith(\"\ smoke\") and is_state(sensor.entity_id, [\"unavailable\", \"unknown\"]) %}\n\ \ {{- sensor.name }}\n{% endfor %}\n" - alias: Sync Tasmota states id: Sync Tasmota states trigger: - platform: homeassistant event: start action: - service: mqtt.publish data: topic: cmnd/tasmotas/state payload: '' - service: mqtt.publish data: topic: tasmotas/cmnd/state payload: '' - service: mqtt.publish data: topic: cmnd/tasmotas/SetOption19 payload: '0' initial_state: true mode: single - alias: Living Room - Turn Off Media Corner id: living_room_media_corner_turn_off trigger: - platform: event event_type: telegram_callback event_data: command: /living_room_turn_off_media action: - service: telegram_bot.send_message data: title: 🚫 Turning off Media Center 🚫 message: Turning off {{ state_attr('switch.living_room_receiver', 'friendly_name') }} and {{ state_attr('switch.living_room_tv', 'friendly_name') }} - entity_id: - switch.living_room_receiver - switch.living_room_tv service: switch.turn_off - entity_id: - media_player.nvidia_shield service: media_player.turn_off mode: restart - alias: 📺 TV is still on 📺 id: living_room_tv_still_on trigger: - platform: numeric_state entity_id: - sensor.living_room_smart_plug_tv_energy_power above: 15 for: 00:01:00 condition: - condition: template value_template: '{{ states(''media_player.nvidia_shield'') in [''off'', ''idle''] }}' action: - service: telegram_bot.send_message data: title: 📺 TV is still on 📺 message: It looks like the TV is still on and nobody's watching anything inline_keyboard: - Turn everything off:/living_room_turn_off_media - alias: Living Room - Watch Disney+ id: living_room_watch_disney mode: restart trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: left condition: [] action: - service: switch.turn_on entity_id: - switch.living_room_smart_plug_tv - delay: 00:00:05 - service: switch.turn_on entity_id: - switch.living_room_receiver - switch.living_room_tv - service: media_player.turn_on entity_id: - media_player.nvidia_shield - delay: 00:00:02 - service: media_player.select_source data_template: entity_id: media_player.nvidia_shield source: com.disney.disneyplus - delay: 00:00:02 - service: mqtt.publish data_template: topic: cmnd/Living_room_-_IR_send/irsend payload_template: '{"Protocol":"NEC","Bits":32,"Data":0x4B3631CE}' - alias: Living Room - Watch Netflix id: living_room_watch_netflix mode: restart trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: left condition: [] action: - service: switch.turn_on entity_id: - switch.living_room_smart_plug_tv - delay: 00:00:05 - service: switch.turn_on entity_id: - switch.living_room_receiver - switch.living_room_tv - service: media_player.turn_on entity_id: - media_player.nvidia_shield - delay: 00:00:02 - service: media_player.select_source data_template: entity_id: media_player.nvidia_shield source: Netflix - service: mqtt.publish data_template: topic: cmnd/Living_room_-_IR_send/irsend payload_template: '{"Protocol":"NEC","Bits":32,"Data":0x4B3631CE}' - alias: Living Room - Watch Plex id: living_room_watch_plex mode: restart trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: left condition: [] action: - service: switch.turn_on entity_id: - switch.living_room_smart_plug_tv - delay: 00:00:05 - service: switch.turn_on entity_id: - switch.living_room_receiver - switch.living_room_tv - service: media_player.turn_on entity_id: - media_player.nvidia_shield - delay: 00:00:02 - service: media_player.select_source data_template: entity_id: media_player.nvidia_shield source: com.plexapp.android - service: mqtt.publish data_template: topic: cmnd/Living_room_-_IR_send/irsend payload_template: '{"Protocol":"NEC","Bits":32,"Data":0x4B3631CE}' - id: living_room_watch_tv alias: Living Room - Watch TV trigger: - entity_id: - sensor.0x00158d000428e63f_click platform: state to: single_left condition: null action: - service: switch.turn_on entity_id: - switch.living_room_smart_plug_tv - delay: 00:00:05 - service: switch.turn_on entity_id: - switch.living_room_receiver - switch.living_room_tv - service: media_player.turn_on entity_id: - media_player.nvidia_shield - service: mqtt.publish data_template: topic: cmnd/Living_room_-_IR_send/irsend payload_template: '{"Protocol":"NEC","Bits":32,"Data":0x4B3631CE}'