AutomationDataset/ReyhZhao/ReyhZhao_automations.yaml

1796 lines
51 KiB
YAML

- alias: Ender 10s Pro uit na printen vragen via Telegram
initial_state: true
trigger:
- entity_id: binary_sensor.octoprint_printing
from: 'on'
platform: state
to: 'off'
action:
- data_template:
inline_keyboard:
- Uitschakelen:/button_uitschakelen
message: De printopdracht is afgerond, Creality CR10s Pro uitschakelen?
target: 243259223
title: '*Creality CR10s Pro uitschakelen?*'
service: telegram_bot.send_message
- alias: Ender 10s Pro uitschakelen na bevestiging via Telegram
initial_state: true
trigger:
- event_data:
data: /button_uitschakelen
event_type: telegram_callback
platform: event
action:
- data:
message: Ender 10s Pro wordt uitgeschakeld.
title: '*Ender 10s Pro uitgeschakeld*'
service: notify.telegram_eddie
- data:
entity_id: switch.ender_3_pro
service: switch.turn_off
- alias: Send notification when brand alarm triggered
trigger:
- platform: state
entity_id: binary_sensor.smokedetector_woonkamer
to: 'on'
action:
- service: notify.ALL_CONTACTS
data:
message: Brand ALARM! Rook gedetecteerd!!!!
data:
push:
sound:
name: default
critical: 1
volume: 1.0
- null
- alias: Send notification when alarm triggered
trigger:
- platform: state
entity_id: alarm_control_panel.ha_alarm
to: triggered
action:
- service: notify.ALL_CONTACTS
data:
message: ALARM! The alarm has been triggered
data_template:
message: "ALARM! The alarm has been triggered\n{% if is_state('group.motion',\
\ 'on') %} Zones met beweging:\n {%- for entity in states.group.motion.attributes.entity_id\
\ -%}\n {%- if states[entity.split('.')[0]][entity.split('.')[1]].state\
\ == 'on' %}\n - {{ states[entity.split('.')[0]][entity.split('.')[1]].attributes.friendly_name\
\ }}\n {%- endif %}\n {%- endfor -%}\n{% endif %}\n{% if is_state('group.ramen',\
\ 'on') %} Open ramen:\n {%- for entity in states.group.ramen.attributes.entity_id\
\ -%}\n {%- if states[entity.split('.')[0]][entity.split('.')[1]].state\
\ == 'on' %}\n - {{ states[entity.split('.')[0]][entity.split('.')[1]].attributes.friendly_name\
\ }}\n {%- endif %}\n {%- endfor -%}\n{% endif %}\n{% if is_state('group.deuren',\
\ 'on') %} Open deuren:\n{%- for entity in states.group.deuren.attributes.entity_id\
\ -%}\n {%- if states[entity.split('.')[0]][entity.split('.')[1]].state ==\
\ 'on' %}\n - {{ states[entity.split('.')[0]][entity.split('.')[1]].attributes.friendly_name\
\ }}\n {%- endif %}\n{%- endfor -%} {% endif %}"
data:
actions:
- action: ALARM_DISARM
title: Disarm
push:
sound:
name: default
critical: 1
volume: 0.7
- null
- alias: Disarm the alarm
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: ALARM_DISARM
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.ha_alarm
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
- alias: Trigger iedereen van huis
description: ''
trigger:
- entity_id: group.presence
platform: state
to: not_home
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.ha_alarm
- service: homeassistant.turn_off
entity_id: group.allelampen
- service: alarmo.arm
data:
entity_id: alarm_control_panel.alarmo
mode: away
skip_delay: true
force: true
- alias: Trigger iemand thuis
description: Disarm alarm als er iemand thuis komt.
trigger:
- entity_id: group.presence
platform: state
to: home
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.ha_alarm
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
- alias: Schakel alarm uit als de eerste wakker wordt
trigger:
- platform: state
entity_id: binary_sensor.motion_trap
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_night
- condition: state
entity_id: binary_sensor.motion_overloop
state: 'on'
- condition: or
conditions:
- condition: time
after: '5:00:00'
before: '8:30:00'
weekday:
- mon
- condition: time
after: '6:00:00'
before: '10:00:00'
weekday:
- tue
- wed
- thu
- fri
- sat
- sun
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.ha_alarm
- service: homeassistant.turn_off
entity_id:
- input_boolean.nachtstand
- service: homeassistant.turn_on
entity_id:
- automation.trigger_woonkamer_lamp_on
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
- service: notify.mobile_app_reyhzhao
data_template:
message: Goeie morgen.
data:
push:
sound:
name: default
- alias: Trigger alarm while armed home
trigger:
- platform: state
entity_id: binary_sensor.achterdeur
to: 'on'
- platform: state
entity_id: binary_sensor.voordeur
to: 'on'
- platform: state
entity_id: binary_sensor.raam_badkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_kantoor
to: 'on'
- platform: state
entity_id: binary_sensor.window_logeerkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_slaapkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_woonkamer
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_home
action:
service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.ha_alarm
- alias: Trigger alarm while armed night
trigger:
- platform: state
entity_id: binary_sensor.achterdeur
to: 'on'
- platform: state
entity_id: binary_sensor.voordeur
to: 'on'
- platform: state
entity_id: binary_sensor.raam_badkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_kantoor
to: 'on'
- platform: state
entity_id: binary_sensor.window_logeerkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_slaapkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_woonkamer
to: 'on'
- platform: state
entity_id: binary_sensor.pir_zolder
to: 'on'
- platform: state
entity_id: binary_sensor.motion_kantoor
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_night
action:
service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.ha_alarm
- alias: Trigger alarm while armed away
trigger:
- platform: state
entity_id: binary_sensor.achterdeur
to: 'on'
- platform: state
entity_id: binary_sensor.voordeur
to: 'on'
- platform: state
entity_id: binary_sensor.window_kantoor
to: 'on'
- platform: state
entity_id: binary_sensor.window_logeerkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_slaapkamer
to: 'on'
- platform: state
entity_id: binary_sensor.window_woonkamer
to: 'on'
- platform: state
entity_id: binary_sensor.raam_badkamer
to: 'on'
- platform: state
entity_id: binary_sensor.pir_zolder
to: 'on'
- platform: state
entity_id: binary_sensor.motion_gang
to: 'on'
- platform: state
entity_id: binary_sensor.motion_gang_2
to: 'on'
- platform: state
entity_id: binary_sensor.motion_trap
to: 'on'
- platform: state
entity_id: binary_sensor.motion_overloop
to: 'on'
- platform: state
entity_id: binary_sensor.motion_slaapkamer
to: 'on'
- platform: state
entity_id: binary_sensor.motion_logeerkamer
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_away
action:
service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.ha_alarm
- alias: ARM Alarm at 22:00 if someone's home
trigger:
platform: time
at: '22:00:00'
condition:
- condition: state
entity_id: group.presence
state: home
- condition: state
entity_id: alarm_control_panel.alarmo
state: disarmed
action:
- service: alarmo.arm
data:
entity_id: alarm_control_panel.alarmo
mode: home
skip_delay: true
- id: '1656000309266'
alias: push HA configuration to GitHub repo
description: ''
trigger:
- at: '15:10:00'
platform: time
action:
service: shell_command.push_to_github
- id: '1702651345928'
alias: Kertverlichting aan in het donker
description: ''
trigger:
- platform: state
entity_id:
- input_select.schemer_buiten
from: Licht
to: Donker
condition:
- condition: state
entity_id: person.eddie
state: home
action:
- service: switch.turn_on
target:
entity_id: switch.kerstverlichting
data: {}
mode: single
- id: '1705342815614'
alias: Frigate Notifications Tuin
description: ''
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.tuin
notify_device: ea07a2d0f491470fbdfbc90cbbf97f4f
base_url: https://ha.vels.online
alert_once: true
ios_live_view: true
labels:
- person
presence_filter: group.presence
- id: '1705342898510'
alias: Frigate Notifications Voordeur
description: ''
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.voordeur
notify_device: ea07a2d0f491470fbdfbc90cbbf97f4f
base_url: https://ha.vels.online
alert_once: true
ios_live_view: true
presence_filter: group.presence
- id: '1705343514704'
alias: Overloop Motion
description: ''
use_blueprint:
path: freakshock88/motion_illuminance_activated_entity.yaml
input:
motion_sensor: light.pir_overloop_basic
target_entity: light.overloop_2
no_motion_wait: input_number.overloop_turnoff_waittime
- id: '1705860970036'
alias: Low battery level detection & notification for all battery sensors
description: ''
use_blueprint:
path: sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml
input:
threshold: 35
time: '20:00:00'
actions:
- service: notify.mobile_app_reyhzhao
metadata: {}
data:
title: Low battery
message: 'Sensors: {{sensors}}'
- id: '1706960896709'
alias: IOS-Action - Alarm Arm Away
description: ''
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionName: Alarm - Arm Away
action:
- service: alarmo.arm
metadata: {}
data:
mode: away
skip_delay: true
force: true
entity_id: alarm_control_panel.alarmo
initial_state: true
mode: single
- id: '1706961147636'
alias: IOS-Action - Alarm Disarm
description: ''
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionName: Alarm - Disarm
action:
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.alarmo
initial_state: true
mode: single
- id: '1726247369020'
alias: Spotify - Move Audio to Kantoor
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.motion_kantoor
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: media_player.spotify
state: playing
action:
- action: media_player.select_source
metadata: {}
data:
source: raspotify (raspotify)
target:
entity_id: media_player.spotify
mode: single
- id: '1726247506740'
alias: Spotify - Move Audio to Woonkamer
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.pir_woonkamer2_home_security_motion_detection
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: media_player.spotify
state: playing
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.motion_overloop
state: 'on'
- condition: state
entity_id: binary_sensor.motion_gang
state: 'on'
action:
- action: media_player.select_source
metadata: {}
data:
source: woonkamer
target:
entity_id: media_player.spotify
mode: single
- id: '1736180505596'
alias: Random Away Lights
description: ''
triggers:
- minutes: /15
trigger: time_pattern
conditions:
- condition: state
entity_id: group.presence
state: not_home
- condition: sun
after: sunset
after_offset: -00:30:00
- condition: time
before: '22:30:00'
actions:
- delay: 00:{{ '{:02}'.format(range(0,30) | random | int) }}:00
- data_template:
entity_id: input_text.light_to_switch
value: '{{ state_attr(''group.simulation_lights'',''entity_id'') | random }}'
action: input_text.set_value
- data_template:
entity_id: '{{states(''input_text.light_to_switch'')}}'
action: homeassistant.toggle
mode: single
initial_state: true
- id: '1739122459288'
alias: Notification of camera events
triggers:
- topic: frigate/events
trigger: mqtt
conditions:
- condition: template
value_template: '{{ trigger.payload_json[''type''] == ''end'' }}'
- condition: template
value_template: '{{ trigger.payload_json[''after''][''entered_zones''] | length
> 0 }}'
actions:
- variables:
event_id: '{{ trigger.payload_json[''after''][''id''] }}'
camera: '{{ trigger.payload_json[''after''][''camera''] }}'
label: '{{ trigger.payload_json[''after''][''label''] }}'
- wait_for_trigger:
- topic: frigate/tracked_object_update
value_template: '{{ value_json[''type''] == ''description'' and value_json[''id'']
== event_id }}
'
variables:
event_id: '{{ event_id }}'
trigger: mqtt
timeout: '15'
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger is not none }}'
sequence:
- variables:
description: '{{ wait.trigger.payload_json[''description''] }}'
- data:
message: '{{ description }} - View Snapshot: https://pub.domain.com/api/frigate/notifications/{{
event_id }}/snapshot.jpg - View clip: https://pub.domain.com/api/frigate/notifications/{{
event_id }}/clip.mp4
'
data:
verify_ssl: false
urls:
- http://10.0.1.11:8123/api/frigate/notifications/{{ event_id }}/thumbnail.jpg
action: notify.signal
- data:
url: http://10.0.1.11:8123/api/frigate/notifications/{{ event_id }}/thumbnail.jpg
caption: "<b>Camera Alert</b> \U0001F6A8\n├ <i>Camera:</i> {{ camera }}\
\ \n└ <i>Event:</i> ┐\n{{ description }}\n\n<a href=\"https://pub.domain.com/api/frigate/notifications/{{\
\ event_id }}/snapshot.jpg\">\U0001F4F7 View Snapshot \U0001F4F7</a>\n\
\n<a href=\"https://pub.domain.com/api/frigate/notifications/{{ event_id\
\ }}/clip.mp4\">\U0001F3A5 View Clip \U0001F3A5</a>\n"
parse_mode: html
disable_web_page_preview: true
action: telegram_bot.send_photo
default:
- action: notify.notify
data:
message: Camera triggerd
- data:
target: -123456789
url: http://10.0.1.11:8123/api/frigate/notifications/{{ event_id }}/thumbnail.jpg
caption: '<b>Camera Alert</b> 🚨
├ <i>Camera:</i> {{ camera }}
└ <i>Event:</i> {{ label }} detected
<a href="https://pub.domain.com/api/frigate/notifications/{{ event_id }}/snapshot.jpg">📷
View Snapshot 📷</a>
<a href="https://pub.domain.com/api/frigate/notifications/{{ event_id }}/clip.mp4">🎥
View Clip 🎥</a>
'
parse_mode: html
disable_web_page_preview: true
action: telegram_bot.send_photo
- delay: '00:00:01.2'
mode: queued
- alias: Trigger Eddie Thuis
description: ''
trigger:
- entity_id: person.eddie
platform: state
to: home
action:
- service: notify.mobile_app_reyhzhao
data_template:
message: Welkom thuis
data:
push:
sound:
name: US-EN-Morgan-Freeman-Welcome-Home.wav
- alias: Trigger Eddie Slaapt
description: ''
trigger:
- platform: state
entity_id: switch.schakelaar_nachtstand
to: 'on'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.status_eddie
option: Slaapt
- alias: Trigger Eddie Wakker
description: ''
trigger:
- platform: state
entity_id: switch.schakelaar_nachtstand
to: 'off'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.status_eddie
option: Wakker
- alias: Irrigation - Set Next Run Time When Schedule Enabled Or Time Changed
trigger:
- platform: state
entity_id:
- input_boolean.cycle1_enable
- input_boolean.cycle2_enable
to: 'on'
- platform: state
entity_id:
- input_select.cycle1_schedule_time
- input_select.cycle2_schedule_time
- platform: state
entity_id:
- input_select.cycle1_watering_days
- input_select.cycle2_watering_days
action:
- service: input_datetime.set_datetime
data_template:
entity_id: "{% if 'cycle1' in trigger.entity_id %}\n input_datetime.cycle1_next_run_time\n\
{% else %}\n input_datetime.cycle2_next_run_time\n{% endif %}\n"
date: "{% if 'cycle1' in trigger.entity_id %}\n {% set time = states('input_select.cycle1_schedule_time')\
\ %}\n{% else %}\n {% set time = states('input_select.cycle2_schedule_time')\
\ %}\n{% endif %} {% if now().strftime('%H:%M') < time %}\n {{ as_timestamp(now())\
\ | timestamp_custom(\"%Y-%m-%d\") }}\n{% else %}\n {{ (as_timestamp(now())\
\ + 24 * 3600 ) | timestamp_custom(\"%Y-%m-%d\") }}\n{% endif %}\n"
time: "{% if 'cycle1' in trigger.entity_id %}\n {{ states('input_select.cycle1_schedule_time')\
\ }}\n{% else %}\n {{ states('input_select.cycle2_schedule_time') }}\n{%\
\ endif %}\n"
- alias: Irrigation - Run Cycle 1
trigger:
- platform: time_pattern
minutes: 0
seconds: 0
condition:
- condition: template
value_template: '{{ now().strftime(''%Y-%m-%d %H:%M:00'') == states(''input_datetime.cycle1_next_run_time'')
}}
'
- condition: state
entity_id: input_boolean.cycle1_enable
state: 'on'
action:
- service: script.irrigation_run_a_cycle
data_template:
cycle: '1'
- service: script.update_next_runtime
data_template:
cycle: '1'
- alias: Irrigation - Run Cycle 2
trigger:
- platform: time_pattern
minutes: 0
seconds: 0
condition:
- condition: template
value_template: '{{ now().strftime(''%Y-%m-%d %H:%M:00'') == states(''input_datetime.cycle2_next_run_time'')
}}
'
- condition: state
entity_id: input_boolean.cycle2_enable
state: 'on'
action:
- service: script.irrigation_run_a_cycle
data_template:
cycle: '2'
- service: script.update_next_runtime
data_template:
cycle: '2'
- alias: Irrigation - Run A Cycle Manually
trigger:
- platform: state
entity_id:
- input_boolean.cycle1_manual_run
- input_boolean.cycle2_manual_run
from: 'off'
to: 'on'
condition:
- condition: template
value_template: "{% if trigger.entity_id == 'input_boolean.cycle1_manual_run'\
\ %}\n {{ states('sensor.cycle2_running') == 'Not running' }}\n{% else %}\n\
\ {{ states('sensor.cycle1_running') == 'Not running' }}\n{% endif %}\n"
action:
- service: input_text.set_value
data_template:
entity_id: "{% if trigger.entity_id == 'input_boolean.cycle1_manual_run' %}\n\
\ input_text.cycle1_current_zone\n{% else %}\n input_text.cycle2_current_zone\n\
{% endif %}\n"
value: Initialising...
- service: homeassistant.turn_off
data_template:
entity_id: group.irrigation_switches
- service: homeassistant.turn_off
entity_id: script.irrigation_run_a_cycle
- service: homeassistant.turn_off
entity_id: script.irrigation_irrigate_a_zone
- service_template: "{% if is_state('input_boolean.cycle1_enable', 'on') %}\n input_boolean.turn_on\n\
{% else %}\n input_boolean.turn_off\n{% endif %}\n"
data:
entity_id: input_boolean.cycle1_enable_saved_state
- service_template: "{% if is_state('input_boolean.cycle2_enable', 'on') %}\n input_boolean.turn_on\n\
{% else %}\n input_boolean.turn_off\n{% endif %}\n"
data:
entity_id: input_boolean.cycle2_enable_saved_state
- service: homeassistant.turn_off
entity_id:
- input_boolean.cycle1_enable
- input_boolean.cycle2_enable
- service: script.irrigation_run_a_cycle
data_template:
cycle: "{% if trigger.entity_id == 'input_boolean.cycle1_manual_run' %}\n 1\n\
{% else %}\n 2\n{% endif %}\n"
- wait_template: '{{ is_state(''script.irrigation_run_a_cycle'', ''off'') }}'
- service: homeassistant.turn_off
entity_id:
- input_boolean.cycle1_manual_run
- input_boolean.cycle2_manual_run
- service_template: "{% if is_state('input_boolean.cycle1_enable_saved_state', 'on')\
\ %}\n input_boolean.turn_on\n{% else %}\n input_boolean.turn_off\n{% endif\
\ %}\n"
data:
entity_id: input_boolean.cycle1_enable
- service_template: "{% if is_state('input_boolean.cycle2_enable_saved_state', 'on')\
\ %}\n input_boolean.turn_on\n{% else %}\n input_boolean.turn_off\n{% endif\
\ %}\n"
data:
entity_id: input_boolean.cycle2_enable
- alias: Irrigation - Cancel A Manual Cycle
trigger:
- platform: state
entity_id:
- input_boolean.cycle1_manual_run
- input_boolean.cycle2_manual_run
from: 'on'
to: 'off'
action:
- service: homeassistant.turn_off
data_template:
entity_id: group.irrigation_switches
- service: homeassistant.turn_off
entity_id: script.irrigation_run_a_cycle
- service: homeassistant.turn_off
entity_id: script.irrigation_irrigate_a_zone
- service: timer.cancel
data_template:
entity_id: "{% if trigger.entity_id == 'input_boolean.cycle1_manual_run' %}\n\
\ timer.cycle1_zone_duration\n{% else %}\n timer.cycle2_zone_duration\n\
{% endif %}\n"
- service: homeassistant.turn_off
data_template:
entity_id: "{% if trigger.entity_id == 'input_boolean.cycle1_manual_run' %}\n\
\ input_boolean.cycle1_running\n{% else %}\n input_boolean.cycle2_running\n\
{% endif %}\n"
- service: input_text.set_value
data_template:
entity_id: "{% if trigger.entity_id == 'input_boolean.cycle1_manual_run' %}\n\
\ input_text.cycle1_current_zone\n{% else %}\n input_text.cycle2_current_zone\n\
{% endif %}\n"
value: None
- alias: Irrigation - Update The Last Time A Cycle Ended
trigger:
- platform: state
entity_id: group.irrigation_switches
to: 'off'
for: 00:00:05
action:
- service: input_datetime.set_datetime
data_template:
entity_id: input_datetime.last_irrigated_time
date: '{{ as_timestamp(now()) | timestamp_custom("%Y-%m-%d") }}
'
time: '{{ as_timestamp(now()) | timestamp_custom("%H:%M") }}
'
- alias: Irrigation - Master Control Switch
trigger:
- platform: state
entity_id: input_boolean.irrigation_master_control_switch
- platform: homeassistant
event: start
action:
- service: input_boolean.turn_off
data:
entity_id:
- input_boolean.cycle1_manual_run
- input_boolean.cycle2_manual_run
- service_template: "{% if is_state('input_boolean.irrigation_master_control_switch',\
\ 'on') %}\n automation.turn_on\n{% else %}\n automation.turn_off\n{% endif\
\ %}\n"
data_template:
entity_id: "{% for item in states['automation'] if item.name.startswith('Irrigation\
\ - ') and\n item.name.find('Master\
\ Control Switch') == -1 -%}\n {% if not loop.first %},{% endif %}{{ item.entity_id\
\ }}\n{%- endfor %}\n"
- service_template: "{% if is_state('input_boolean.irrigation_master_control_switch',\
\ 'on') %}\n automation.turn_on\n{% else %}\n automation.turn_off\n{% endif\
\ %}\n"
data_template:
entity_id: "{% for item in states['automation'] if item.name.startswith('Irrigation\
\ Weather - ') -%}\n {% if not loop.first %},{% endif %}{{ item.entity_id\
\ }}\n{%- endfor %}\n"
- alias: Irrigation - Notify About Irrigation Events When On Holiday
trigger:
- platform: state
entity_id:
- input_boolean.cycle1_running
- input_boolean.cycle2_running
condition:
- condition: state
entity_id: input_select.holiday
state: 'True'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.telegram_holiday_irrigation_eddie
state: 'on'
- condition: state
entity_id: input_boolean.telegram_holiday_irrigation_esther
state: 'on'
action:
- service_template: "{% if trigger.to_state.state == 'on' %}\n script.notify_irrigation_start\n\
{% else %}\n script.notify_irrigation_end\n{% endif %}\n"
data_template:
cycle: "{% if trigger.entity_id == 'input_boolean.cycle1_running' %}\n 1\n\
{% else %}\n 2\n{% endif %}\n"
- alias: Irrigation Failsafe - Master Control Switch
trigger:
- platform: state
entity_id: input_boolean.irrigation_master_control_switch
to: 'off'
- platform: homeassistant
event: start
action:
- service: homeassistant.turn_off
entity_id:
- input_boolean.cycle1_manual_run
- input_boolean.cycle2_manual_run
- switch.zone1_valve
- alias: Irrigation Failsafe - Valve 1 On
trigger:
- platform: state
entity_id:
- switch.zone1_valve
to: 'on'
action:
- wait_template: '{{ is_state(''switch.zone1_valve'', ''off'') }}'
timeout: 00:30:15
- service: homeassistant.turn_off
entity_id: switch.zone1_valve
- alias: Irrigation Weather - Adjust Durations With Change In Cycle1 Baseline Duration
trigger:
- platform: state
entity_id:
- input_number.cycle1_zone1_duration
action:
- wait_template: '{{ is_state(''script.adjust_cycle1_durations'', ''off'') }}'
- service: script.adjust_cycle1_durations
- alias: Irrigation Weather - Adjust Durations With Change In Cycle2 Baseline Duration
trigger:
- platform: state
entity_id:
- input_number.cycle2_zone1_duration
action:
- wait_template: '{{ is_state(''script.adjust_cycle2_durations'', ''off'') }}'
- service: script.adjust_cycle2_durations
- alias: Irrigation Weather - Adjust Durations With Change In Rain Or Temp Baseline
trigger:
- platform: state
entity_id:
- input_number.temperature_baseline
- input_number.rainfall_threshold
- input_number.rain_percent_minus1
- input_number.rain_percent_minus2
- input_number.rain_percent_minus3
action:
- service: script.calculate_average_weather_conditions
- wait_template: '{{ is_state(''script.calculate_average_weather_conditions'', ''off'')
}}'
- service: script.adjust_cycle1_durations
- service: script.adjust_cycle2_durations
- alias: Irrigation Weather - Adjust Durations When Option To Use Weather Adjustment
Turned On
trigger:
- platform: state
entity_id:
- input_boolean.cycle1_use_weather_adjustment
- input_boolean.cycle2_use_weather_adjustment
to: 'on'
action:
- service_template: "{% if trigger.entity_id == 'input_boolean.cycle1_use_weather_adjustment'\
\ %}\n script.adjust_cycle1_durations\n{% else %}\n script.adjust_cycle2_durations\n\
{% endif %}\n"
- alias: Irrigation Weather - Update Average Weather Conditions Every 30 Mins
trigger:
- platform: time_pattern
minutes: /30
seconds: 0
action:
- service: script.calculate_average_weather_conditions
- wait_template: '{{ is_state(''script.calculate_average_weather_conditions'', ''off'')
}}'
- service: script.adjust_cycle1_durations
- wait_template: '{{ is_state(''script.adjust_cycle1_durations'', ''off'') }}'
- service: script.adjust_cycle2_durations
- wait_template: '{{ is_state(''script.adjust_cycle2_durations'', ''off'') }}'
- alias: Irrigation Weather Data - Collect New And Cycle Historic Weather Data
id: Irrigation Weather Data - Collect New And Cycle Historic Weather Data
trigger:
- platform: time
at: 06:00:00
action:
- service: script.garden_temperature_data
data_template:
loop_count: "{% set ns = namespace(count = 0) %} {% for item in states if item.entity_id.startswith('input_number.temp_minus')\
\ %}\n {% set ns.count = loop.index %}\n{% endfor %} {{ (ns.count - 1) }}\n"
- alias: Trigger iemand gaat slapen
description: Trigger als iemand gaat slapen, check of nachtstand aan moet.
triggers:
trigger: state
entity_id:
- input_select.status_eddie
condition:
condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: person.eddie
state: home
- condition: state
entity_id: input_select.status_eddie
state: Slaapt
action:
- action: homeassistant.turn_on
entity_id:
- input_boolean.nachtstand
- alias: Trigger iemand wordt wakker
description: Trigger als iemand wakker wordt, check of nachtstand uit moet.
triggers:
trigger: state
entity_id:
- input_select.status_eddie
to: Wakker
action:
- action: homeassistant.turn_off
entity_id:
- input_boolean.nachtstand
- alias: Nachtstand ingeschakeld
description: ''
trigger:
trigger: state
entity_id: input_boolean.nachtstand
to: 'on'
actions:
- action: homeassistant.turn_off
entity_id:
- group.all_lights
- switch.lamp_gang
- light.overloop
- automation.trigger_woonkamer_lamp_motion
- switch.kerstverlichting_buiten
- switch.mmwave_sensor
- binary_sensor.motion_woonkamer_mmwaveradar
- switch.kerstverlichting
- action: alarmo.arm
data:
entity_id: alarm_control_panel.alarmo
mode: night
skip_delay: true
force: true
- alias: Nachtstand uitgeschakeld
description: Nachtstand uitgeschakeld
triggers:
trigger: state
entity_id: input_boolean.nachtstand
to: 'off'
actions:
- action: homeassistant.turn_on
entity_id:
- automation.trigger_woonkamer_lamp_motion
- switch.mmwave_sensor
- action: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
- alias: Reset nachtstand overdag.
description: Reset nachtstand overdag.
triggers:
trigger: time
at: 08:00:00
actions:
- action: homeassistant.turn_off
entity_id: switch.schakelaar_nachtstand
- action: input_select.select_option
data_template:
entity_id: input_select.status_eddie
option: Wakker
- alias: Trigger Het wordt licht buiten
description: ''
trigger:
platform: numeric_state
entity_id: sensor.lux_buiten
above: 1700
condition:
condition: state
entity_id: input_select.schemer_buiten
state: Schemer
action:
- service: input_select.select_option
data_template:
entity_id: input_select.schemer_buiten
option: Licht
- alias: Trigger Het wordt lichter buiten
description: ''
trigger:
platform: numeric_state
entity_id: sensor.lux_buiten
above: 900
condition:
condition: state
entity_id: input_select.schemer_buiten
state: Donker
action:
- service: input_select.select_option
data_template:
entity_id: input_select.schemer_buiten
option: Schemer
- alias: Trigger Het wordt donker buiten
description: ''
trigger:
platform: numeric_state
entity_id: sensor.lux_buiten
below: 1600
condition:
condition: state
entity_id: input_select.schemer_buiten
state: Licht
action:
- service: input_select.select_option
data_template:
entity_id: input_select.schemer_buiten
option: Schemer
- alias: Trigger Het wordt donker buiten
description: ''
trigger:
platform: numeric_state
entity_id: sensor.lux_buiten
below: 800
condition:
condition: state
entity_id: input_select.schemer_buiten
state: Schemer
action:
- service: input_select.select_option
data_template:
entity_id: input_select.schemer_buiten
option: Donker
- alias: Trigger Het wordt licht in het kantoor
description: ''
trigger:
platform: numeric_state
entity_id: sensor.lux_kantoor
above: 15
condition:
condition: state
entity_id: input_select.schemer_kantoor
state: Donker
action:
- service: input_select.select_option
data_template:
entity_id: input_select.schemer_kantoor
option: Licht
- alias: Trigger Het wordt donker in het kantoor
description: ''
trigger:
platform: numeric_state
entity_id: sensor.lux_kantoor
below: 5
condition:
condition: state
entity_id: input_select.schemer_kantoor
state: Licht
action:
- service: input_select.select_option
data_template:
entity_id: input_select.schemer_kantoor
option: Donker
- alias: Trigger Slaapkamer Schakelaar Links on
description: ''
trigger:
- entity_id: switch.nachtkastje_links
platform: state
to: 'on'
condition: []
action:
- service: homeassistant.turn_on
entity_id: group.lampen_boven
- alias: Trigger Slaapkamer Schakelaar Links off
description: ''
trigger:
- entity_id: switch.nachtkastje_links
platform: state
to: 'off'
condition: []
action:
- service: homeassistant.turn_off
entity_id: group.lampen_boven
- service: homeassistant.turn_on
entity_id: group.lampen_beneden
- alias: Smart Irrigation
description: Start Smart Irrigation based on event and run it only if the `sensor.smart_irrigation_[zone_name]`
is >0 and run it for precisely that many seconds
trigger:
- trigger: event
event_type: smart_irrigation_start_irrigation_all_zones
condition:
- condition: numeric_state
entity_id: sensor.smart_irrigation_tuin
above: 0
action:
- delay:
seconds: '{{states("sensor.smart_irrigation_tuin")}}'
- action: smart_irrigation.reset_bucket
data: {}
entity_id: sensor.smart_irrigation_tuin
- alias: Trigger Trapkast on
description: ''
trigger:
- entity_id: switch.schakelaar_trapkast
platform: state
to: 'on'
condition: []
action:
- service: homeassistant.turn_on
entity_id: switch.lamp_trapkast_n
- alias: Trigger Trapkast off
description: ''
trigger:
- entity_id: switch.schakelaar_trapkast
platform: state
to: 'off'
condition: []
action:
- service: homeassistant.turn_off
entity_id: switch.lamp_trapkast_n
- alias: Trigger Trap Schakelaar Links on
description: ''
trigger:
- entity_id: switch.trap_schakelaar_links
platform: state
to: 'on'
condition: []
action:
- service: homeassistant.turn_on
entity_id: group.lampen_boven
- alias: Trigger Trap Schakelaar Links off
description: ''
trigger:
- entity_id: switch.trap_schakelaar_links
platform: state
to: 'off'
condition: []
action:
- service: homeassistant.turn_off
entity_id: group.lampen_boven
- alias: Trigger Trap Schakelaar Rechts on
description: ''
trigger:
- entity_id: switch.trap_schakelaar_rechts
platform: state
to: 'on'
condition: []
action:
- service: homeassistant.turn_on
entity_id: group.lampen_beneden
- alias: Trigger Trap Schakelaar Rechts off
description: ''
trigger:
- entity_id: switch.trap_schakelaar_rechts
platform: state
to: 'off'
condition: []
action:
- service: homeassistant.turn_off
entity_id: group.lampen_beneden
- alias: Trigger Buiten Lamp On
description: ''
trigger:
- platform: state
entity_id: binary_sensor.achterdeur
to: 'on'
- platform: state
entity_id: person.eddie
to: home
condition:
condition: state
entity_id: input_select.schemer_buiten
state: Donker
action:
- service: homeassistant.turn_on
entity_id:
- light.tuin
- switch.tuin_verlichting_switch
- light.buiten
- service: timer.start
data:
entity_id: timer.buiten
- alias: Trigger iemand huis - Buiten verlichting
description: Buitenverlichting aan als iemand thuis komt.
trigger:
- entity_id: group.presence
platform: state
to: home
condition:
condition: state
entity_id: input_select.schemer_buiten
state: Donker
action:
- service: homeassistant.turn_on
entity_id:
- light.tuin
- switch.tuin_verlichting_switch
- light.buiten
- switch.kerstverlichting
- service: timer.start
data:
entity_id: timer.buiten
- alias: Turn off Buiten lamp, x minutes after last movement
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.buiten
action:
service: homeassistant.turn_off
entity_id:
- light.tuin
- switch.tuin_verlichting_switch
- light.buiten
- alias: Trigger donker buiten en iemand in tuin
description: ''
trigger:
- platform: state
entity_id: switch.schemer_buiten
to: Donker
condition:
condition: state
entity_id: binary_sensor.achterdeur
state: 'on'
action:
- service: homeassistant.turn_on
entity_id:
- light.tuin
- switch.tuin_verlichting_switch
- light.buiten
- alias: Trigger Gang Lamp On
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.voordeur
- binary_sensor.motion_gang
- binary_sensor.motion_trap
- binary_sensor.motion_gang_2
- binary_sensor.pir_gang_sensor_state_aux
to: 'on'
action:
- service: homeassistant.turn_on
entity_id: switch.lamp_gang
- service: timer.cancel
entity_id: timer.gang
- service: timer.start
entity_id: timer.gang
- alias: Turn off gang lamp, x minutes after last movement
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.gang
action:
service: homeassistant.turn_off
entity_id: switch.lamp_gang
- alias: Trigger Kantoor Lamp On
description: ''
trigger:
- platform: state
entity_id: binary_sensor.presense_kantoor
to: 'on'
- platform: state
entity_id: switch.schakelaar_kantoor
to: 'on'
condition:
condition: state
entity_id: input_select.schemer_kantoor
state: Donker
action:
service: homeassistant.turn_on
entity_id:
- light.kantoor
- switch.schakelaar_kantoor
- switch.kantoor_sfeerverlichting
- alias: Trigger Kantoor Lamp On als het donker wordt
description: ''
trigger:
- platform: state
entity_id: input_select.schemer_kantoor
to: Donker
condition:
- or:
- condition: numeric_state
entity_id: sensor.espresense_kantoor_count
above: 1
- condition: template
value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.binary_sensor.motion_kantoor.last_changed)))
| round(0) < 180 }}'
action:
service: homeassistant.turn_on
entity_id:
- light.kantoor
- switch.schakelaar_kantoor
- switch.kantoor_sfeerverlichting
- alias: Trigger Kantoor Lamp Off als het licht wordt
description: ''
trigger:
- platform: state
entity_id: input_select.schemer_kantoor
to: Licht
action:
service: homeassistant.turn_off
entity_id:
- light.kantoor
- switch.schakelaar_kantoor
- switch.kantoor_sfeerverlichting
- alias: Turn off Kantoor lamp, schakelaar
trigger:
- platform: state
entity_id: switch.schakelaar_kantoor
to: 'off'
action:
service: homeassistant.turn_off
entity_id:
- light.kantoor
- switch.schakelaar_kantoor
- switch.kantoor_sfeerverlichting
- alias: Turn off Kantoor lamp, x minutes after last movement
trigger:
- platform: state
entity_id: binary_sensor.presense_kantoor
to: 'off'
for:
minutes: 2
condition:
- condition: numeric_state
entity_id: sensor.espresense_kantoor_count
below: 1
action:
service: homeassistant.turn_off
entity_id:
- light.kantoor
- switch.schakelaar_kantoor
- switch.kantoor_sfeerverlichting
- alias: Wakeup backup NUC
description: ''
trigger:
- platform: time
at: 09:30:00
action:
service: homeassistant.turn_on
entity_id:
- switch.backup_nuc_wol
- alias: Trigger keuken Lamp On
description: ''
trigger:
- platform: state
entity_id: binary_sensor.motion_keuken
to: 'on'
- platform: state
entity_id: switch.schakelaar_keuken
to: 'on'
action:
service: homeassistant.turn_on
entity_id:
- switch.lamp_keuken
- switch.schakelaar_keuken
- alias: Turn off Keuken lamp door schakelaar
trigger:
- platform: state
entity_id: switch.schakelaar_keuken
to: 'off'
action:
service: homeassistant.turn_off
entity_id: switch.lamp_keuken
- alias: Turn off keuken lamp, x minutes after last movement
trigger:
- platform: state
entity_id: binary_sensor.motion_keuken
to: 'off'
for:
minutes: 3
action:
service: homeassistant.turn_off
entity_id:
- switch.lamp_keuken
- switch.schakelaar_keuken
- alias: Trigger eetkamer tafel lamp On
description: ''
trigger:
- platform: state
entity_id: switch.schakelaar_eetkamer
to: 'on'
action:
service: homeassistant.turn_on
entity_id:
- light.eetkamer
- alias: Turn off eetkamer tafel door schakelaar
trigger:
- platform: state
entity_id: switch.schakelaar_eetkamer
to: 'off'
action:
service: homeassistant.turn_off
entity_id: light.eetkamer
- alias: Trigger Overloop Lamp On - Iedereen wakker
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.motion_overloop
- binary_sensor.motion_trap
- binary_sensor.pir_overloop_sensor_state_general_purpose
to: 'on'
condition:
- condition: state
entity_id: light.overloop
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.status_eddie
state: Wakker
action:
- service: homeassistant.turn_on
entity_id: light.overloop
data:
brightness: 254
- service: timer.cancel
entity_id: timer.overloop
- service: timer.start
entity_id: timer.overloop
- alias: Trigger Overloop Lamp On - Iemand slaapt
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.motion_overloop
- binary_sensor.motion_trap
- binary_sensor.pir_overloop_sensor_state_general_purpose
to: 'on'
condition:
- condition: state
entity_id: light.overloop
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_select.status_eddie
state: Slaapt
action:
- service: homeassistant.turn_on
entity_id: light.overloop
data:
brightness: 50
- service: timer.start
entity_id: timer.overloop
- alias: Turn off overloop lamp, x minutes after last movement
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.overloop
action:
service: homeassistant.turn_off
entity_id: light.overloop
- alias: Trigger WC
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.motion_wc
from: 'off'
to: 'on'
condition: []
action:
- service: homeassistant.turn_on
data: {}
target:
entity_id: switch.dual_paddle_wall_switch
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.motion_wc
from: 'on'
to: 'off'
for:
hours: 0
minutes: 2
seconds: 0
- service: homeassistant.turn_off
data: {}
target:
entity_id: switch.dual_paddle_wall_switch
mode: single
- alias: Trigger Woonkamer Lamp On als het donker wordt
description: ''
trigger:
- platform: state
entity_id: input_select.schemer_buiten
to: Schemer
condition:
- condition: template
value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.binary_sensor.motion_woonkamer_mmwaveradar.last_changed)))
| round(0) < 180 }}'
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: disarmed
action:
- service: scene.turn_on
target:
entity_id: '{% if now().strftime(''%H'')| int >= 20 %} scene.woonkamer_rustig
{% elif now().strftime(''%H'')| int >= 7 %} scene.woonkamer_helder {% endif
%}
'
- service: homeassistant.turn_on
entity_id:
- light.woonkamer
- light.kerstboom
- alias: Trigger Woonkamer Lamp Off als het licht wordt
description: ''
trigger:
- platform: state
entity_id: input_select.schemer_buiten
to: Licht
action:
service: homeassistant.turn_off
entity_id:
- light.woonkamer
- light.kerstboom
- alias: Trigger Woonkamer Lamp motion
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.achterdeur
- binary_sensor.motion_woonkamer1
- binary_sensor.motion_woonkamer2
to: 'on'
condition:
and:
- condition: state
entity_id: light.woonkamer
state: 'off'
- condition: state
entity_id: input_boolean.nachtstand
state: 'Off'
- or:
- condition: state
entity_id: input_select.schemer_buiten
state: Schemer
- condition: state
entity_id: input_select.schemer_buiten
state: Donker
action:
- service: homeassistant.turn_on
entity_id:
- switch.schakelaar_woonkamer
- service: scene.turn_on
target:
entity_id: '{% if now().strftime(''%H'')| int >= 20 %} scene.woonkamer_rustig
{% elif now().strftime(''%H'')| int >= 7 %} scene.woonkamer_helder {% endif
%}
'
- service: homeassistant.turn_on
data_template:
entity_id: light.woonkamer
brightness: '{% if states.media_player.nvidia_shield == ''playing'' %} 75 {%
elif now().strftime(''%H'')| int >= 22 %} 120 {% elif now().strftime(''%H'')|
int < 7 %} 120 {% elif now().strftime(''%H'')| int >= 7 %} 255 {% endif %}
'
- service: timer.start
data:
entity_id: timer.woonkamer
- alias: Trigger Woonkamer Lamp dim playing content.
description: ''
trigger:
- platform: state
entity_id:
- media_player.nvidia_shield
to: playing
for: 00:00:20
condition:
- condition: state
entity_id: light.woonkamer
state: 'on'
- condition: time
after: '20:30:00'
action:
- service: homeassistant.turn_on
data_template:
entity_id: light.woonkamer
brightness: 75
- alias: Trigger Woonkamer Lamp un-dim stopped playing content.
description: ''
trigger:
- platform: state
entity_id:
- media_player.nvidia_shield
to: idle
for: 00:00:20
condition:
condition: state
entity_id: light.woonkamer
state: 'on'
action:
- service: homeassistant.turn_on
data_template:
entity_id: light.woonkamer
brightness: '{% if now().strftime(''%H'')| int >= 22 %} 120 {% elif now().strftime(''%H'')|
int < 7 %} 120 {% elif now().strftime(''%H'')| int >= 7 %} 255 {% endif %}
'
- alias: Trigger Woonkamer Lamp schakelaar
description: ''
trigger:
- platform: state
entity_id:
- switch.schakelaar_woonkamer
to: 'on'
action:
- service: homeassistant.turn_on
entity_id:
- switch.schakelaar_woonkamer
- service: scene.turn_on
target:
entity_id: '{% if now().strftime(''%H'')| int >= 20 %} scene.woonkamer_rustig
{% elif now().strftime(''%H'')| int >= 7 %} scene.woonkamer_helder {% endif
%}
'
- service: homeassistant.turn_on
data_template:
entity_id: light.woonkamer
brightness: '{% if states.media_player.nvidia_shield == ''playing'' %} 75 {%
elif now().strftime(''%H'')| int >= 20 %} 120 {% elif now().strftime(''%H'')|
int < 7 %} 120 {% elif now().strftime(''%H'')| int >= 7 %} 255 {% endif %}
'
- service: timer.start
data:
entity_id: timer.woonkamer
- alias: Turn off Woonkamer lamp door schakelaar
trigger:
- platform: state
entity_id: switch.schakelaar_woonkamer
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: light.woonkamer
- service: timer.cancel
data:
entity_id: timer.woonkamer
- alias: Turn off Woonkamer lamp, x minutes after last movement
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.woonkamer
condition:
- condition: state
entity_id: binary_sensor.motion_woonkamer_mmwaveradar
state: 'off'
- condition: template
value_template: '{{ ((as_timestamp(now()) - as_timestamp(states.binary_sensor.motion_woonkamer_mmwaveradar.last_changed)))
| round(0) > 240 }}'
action:
service: homeassistant.turn_off
entity_id:
- light.woonkamer
- switch.schakelaar_woonkamer
- alias: Sync woonkamer schakelaar met lamp.
trigger:
- platform: state
entity_id: light.woonkamer
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: switch.schakelaar_woonkamer
- alias: Sync woonkamer schakelaar met lamp -off.
trigger:
- platform: state
entity_id: light.woonkamer
to: 'on'
action:
- service: homeassistant.turn_on
entity_id: switch.schakelaar_woonkamer
- alias: Sync eetkamer schakelaar met lamp.
trigger:
- platform: state
entity_id: light.eetkamer
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: switch.schakelaar_eetkamer
- alias: Sync eetkamer schakelaar met lamp -off.
trigger:
- platform: state
entity_id: light.eetkamer
to: 'on'
action:
- service: homeassistant.turn_on
entity_id: switch.schakelaar_eetkamer
- alias: Trigger Zolder Lamp On
description: ''
trigger:
- platform: state
entity_id: binary_sensor.zolder_occupancy
to: 'on'
- platform: state
entity_id: binary_sensor.schakelaar_trap_links
to: 'on'
action:
service: homeassistant.turn_on
entity_id:
- switch.lamp_zolder
- alias: Turn off Zolder lamp, x minutes after last movement
trigger:
- platform: state
entity_id: binary_sensor.zolder_occupancy
to: 'off'
for:
minutes: 5
- platform: state
entity_id: binary_sensor.schakelaar_trap_links
to: 'off'
action:
service: homeassistant.turn_off
entity_id:
- switch.lamp_zolder
- id: Automatic light toggle
alias: Random Away Lights
initial_state: true
trigger:
- platform: time_pattern
minutes: /15
condition:
- condition: state
entity_id: group.presence
state: not_home
- condition: sun
after: sunset
after_offset: -00:30:00
- condition: time
before: '22:30:00'
action:
- delay: 00:{{ '{:02}'.format(range(0,30) | random | int) }}:00
- service: input_text.set_value
data_template:
entity_id: input_text.light_to_switch
value: '{{ state_attr(''group.simulation_lights'',''entity_id'') | random }}'
- service: homeassistant.toggle
data_template:
entity_id: '{{states(''input_text.light_to_switch'')}}'
- id: Turning off all toggled lights
alias: Turn off all lights
initial_state: true
trigger:
- platform: time
at: '22:30:00'
condition:
- condition: state
entity_id: group.presence
state: not_home
action:
- delay: 00:{{ range(15,59) | random | int }}:00
- service: homeassistant.turn_off
entity_id: group.simulation_lights