Fix presence simulation activation flow
This commit is contained in:
@@ -1,184 +1,178 @@
|
|||||||
alias: Presence Simulation - Tidsblokke (realistisk)
|
- alias: Presence Simulation - Tidsblokke (realistisk)
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- platform: time
|
- platform: time
|
||||||
at: "07:00:00"
|
at: "07:00:00"
|
||||||
- platform: time
|
- platform: time
|
||||||
at: "12:00:00"
|
at: "12:00:00"
|
||||||
- platform: time
|
- platform: time
|
||||||
at: "18:00:00"
|
at: "18:00:00"
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.presence_simulation
|
entity_id: input_boolean.presence_simulation
|
||||||
state: "on"
|
state: "on"
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- variables:
|
- variables:
|
||||||
lights_morning:
|
lights_morning:
|
||||||
- light.livingroom
|
- light.livingroom
|
||||||
- light.indkoersel_2
|
- light.indkorsel_2
|
||||||
- light.andreas_vaerelse
|
- light.andreas_vaerelse
|
||||||
- light.bedroom
|
- light.bedroom
|
||||||
- light.daniels_vaerelse
|
- light.daniels_vaerelse
|
||||||
- light.forgang
|
- light.forgang
|
||||||
|
|
||||||
lights_midday:
|
lights_midday:
|
||||||
- light.kokken
|
- light.livingroom
|
||||||
- light.indkoersel
|
|
||||||
|
|
||||||
lights_evening:
|
|
||||||
- light.livingroom
|
|
||||||
- light.indkoersel_2
|
|
||||||
- light.andreas_vaerelse
|
|
||||||
- light.bedroom
|
|
||||||
- light.daniels_vaerelse
|
|
||||||
- light.forgang
|
|
||||||
|
|
||||||
rand_music: "{{ range(0,100) | random }}"
|
lights_evening:
|
||||||
|
- light.livingroom
|
||||||
|
- light.indkorsel_2
|
||||||
|
- light.andreas_vaerelse
|
||||||
|
- light.bedroom
|
||||||
|
- light.daniels_vaerelse
|
||||||
|
- light.forgang
|
||||||
|
|
||||||
- choose:
|
rand_music: "{{ range(0,100) | random }}"
|
||||||
|
|
||||||
# 🌅 MORGEN
|
- choose:
|
||||||
- conditions:
|
# 🌅 MORGEN
|
||||||
- condition: time
|
- conditions:
|
||||||
after: "06:59:00"
|
- condition: time
|
||||||
before: "12:00:00"
|
after: "06:59:00"
|
||||||
sequence:
|
before: "12:00:00"
|
||||||
|
sequence:
|
||||||
- repeat:
|
- repeat:
|
||||||
for_each: "{{ lights_morning }}"
|
for_each: "{{ lights_morning }}"
|
||||||
sequence:
|
|
||||||
- service: light.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: "{{ repeat.item }}"
|
|
||||||
- delay:
|
|
||||||
seconds: "{{ range(30,180) | random }}"
|
|
||||||
|
|
||||||
- delay:
|
|
||||||
minutes: "{{ range(10,30) | random }}"
|
|
||||||
|
|
||||||
- repeat:
|
|
||||||
for_each: "{{ lights_morning | reverse }}"
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: "{{ repeat.item }}"
|
|
||||||
- delay:
|
|
||||||
seconds: "{{ range(20,120) | random }}"
|
|
||||||
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ rand_music < 20 }}"
|
|
||||||
sequence:
|
sequence:
|
||||||
- service: media_player.play_media
|
- service: light.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: media_player.kokken
|
entity_id: "{{ repeat.item }}"
|
||||||
data:
|
|
||||||
media_content_type: music
|
|
||||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
|
||||||
|
|
||||||
- delay:
|
- delay:
|
||||||
minutes: "{{ range(5,15) | random }}"
|
seconds: "{{ range(30,180) | random }}"
|
||||||
|
|
||||||
- service: media_player.media_stop
|
- delay:
|
||||||
target:
|
minutes: "{{ range(10,30) | random }}"
|
||||||
entity_id: media_player.kokken
|
|
||||||
|
|
||||||
|
- repeat:
|
||||||
# 🌤️ MIDDAG
|
for_each: "{{ lights_morning | reverse }}"
|
||||||
- conditions:
|
|
||||||
- condition: time
|
|
||||||
after: "11:59:00"
|
|
||||||
before: "18:00:00"
|
|
||||||
sequence:
|
|
||||||
|
|
||||||
- repeat:
|
|
||||||
for_each: "{{ lights_midday }}"
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: "{{ repeat.item }}"
|
|
||||||
- delay:
|
|
||||||
seconds: "{{ range(60,300) | random }}"
|
|
||||||
|
|
||||||
- delay:
|
|
||||||
minutes: "{{ range(5,20) | random }}"
|
|
||||||
|
|
||||||
- repeat:
|
|
||||||
for_each: "{{ lights_midday | reverse }}"
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: "{{ repeat.item }}"
|
|
||||||
- delay:
|
|
||||||
seconds: "{{ range(30,180) | random }}"
|
|
||||||
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ rand_music < 30 }}"
|
|
||||||
sequence:
|
sequence:
|
||||||
- service: media_player.play_media
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: media_player.kokken
|
entity_id: "{{ repeat.item }}"
|
||||||
data:
|
|
||||||
media_content_type: music
|
|
||||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
|
||||||
|
|
||||||
- delay:
|
- delay:
|
||||||
minutes: "{{ range(5,15) | random }}"
|
seconds: "{{ range(20,120) | random }}"
|
||||||
|
|
||||||
- service: media_player.media_stop
|
- choose:
|
||||||
target:
|
- conditions:
|
||||||
entity_id: media_player.kokken
|
- condition: template
|
||||||
|
value_template: "{{ rand_music < 20 }}"
|
||||||
|
sequence:
|
||||||
|
- service: media_player.play_media
|
||||||
|
target:
|
||||||
|
entity_id: media_player.kokken
|
||||||
|
data:
|
||||||
|
media_content_type: music
|
||||||
|
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||||
|
|
||||||
|
- delay:
|
||||||
|
minutes: "{{ range(5,15) | random }}"
|
||||||
|
|
||||||
# 🌙 AFTEN
|
- service: media_player.media_stop
|
||||||
- conditions:
|
target:
|
||||||
- condition: time
|
entity_id: media_player.kokken
|
||||||
after: "17:59:00"
|
|
||||||
before: "22:30:00"
|
|
||||||
sequence:
|
|
||||||
|
|
||||||
- repeat:
|
# 🌤️ MIDDAG
|
||||||
for_each: "{{ lights_evening }}"
|
- conditions:
|
||||||
sequence:
|
- condition: time
|
||||||
- service: light.turn_on
|
after: "11:59:00"
|
||||||
target:
|
before: "18:00:00"
|
||||||
entity_id: "{{ repeat.item }}"
|
sequence:
|
||||||
- delay:
|
- repeat:
|
||||||
seconds: "{{ range(20,120) | random }}"
|
for_each: "{{ lights_midday }}"
|
||||||
|
|
||||||
- delay:
|
|
||||||
minutes: "{{ range(15,60) | random }}"
|
|
||||||
|
|
||||||
- repeat:
|
|
||||||
for_each: "{{ lights_evening | reverse }}"
|
|
||||||
sequence:
|
|
||||||
- service: light.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: "{{ repeat.item }}"
|
|
||||||
- delay:
|
|
||||||
seconds: "{{ range(20,120) | random }}"
|
|
||||||
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ rand_music < 50 }}"
|
|
||||||
sequence:
|
sequence:
|
||||||
- service: media_player.play_media
|
- service: light.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: media_player.kokken
|
entity_id: "{{ repeat.item }}"
|
||||||
data:
|
|
||||||
media_content_type: music
|
|
||||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
|
||||||
|
|
||||||
- delay:
|
- delay:
|
||||||
minutes: "{{ range(10,20) | random }}"
|
seconds: "{{ range(60,300) | random }}"
|
||||||
|
|
||||||
- service: media_player.media_stop
|
- delay:
|
||||||
|
minutes: "{{ range(5,20) | random }}"
|
||||||
|
|
||||||
|
- repeat:
|
||||||
|
for_each: "{{ lights_midday | reverse }}"
|
||||||
|
sequence:
|
||||||
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: media_player.kokken
|
entity_id: "{{ repeat.item }}"
|
||||||
|
- delay:
|
||||||
|
seconds: "{{ range(30,180) | random }}"
|
||||||
|
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ rand_music < 30 }}"
|
||||||
|
sequence:
|
||||||
|
- service: media_player.play_media
|
||||||
|
target:
|
||||||
|
entity_id: media_player.kokken
|
||||||
|
data:
|
||||||
|
media_content_type: music
|
||||||
|
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||||
|
|
||||||
|
- delay:
|
||||||
|
minutes: "{{ range(5,15) | random }}"
|
||||||
|
|
||||||
|
- service: media_player.media_stop
|
||||||
|
target:
|
||||||
|
entity_id: media_player.kokken
|
||||||
|
|
||||||
|
# 🌙 AFTEN
|
||||||
|
- conditions:
|
||||||
|
- condition: time
|
||||||
|
after: "17:59:00"
|
||||||
|
before: "22:30:00"
|
||||||
|
sequence:
|
||||||
|
- repeat:
|
||||||
|
for_each: "{{ lights_evening }}"
|
||||||
|
sequence:
|
||||||
|
- service: light.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: "{{ repeat.item }}"
|
||||||
|
- delay:
|
||||||
|
seconds: "{{ range(20,120) | random }}"
|
||||||
|
|
||||||
|
- delay:
|
||||||
|
minutes: "{{ range(15,60) | random }}"
|
||||||
|
|
||||||
|
- repeat:
|
||||||
|
for_each: "{{ lights_evening | reverse }}"
|
||||||
|
sequence:
|
||||||
|
- service: light.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: "{{ repeat.item }}"
|
||||||
|
- delay:
|
||||||
|
seconds: "{{ range(20,120) | random }}"
|
||||||
|
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ rand_music < 50 }}"
|
||||||
|
sequence:
|
||||||
|
- service: media_player.play_media
|
||||||
|
target:
|
||||||
|
entity_id: media_player.kokken
|
||||||
|
data:
|
||||||
|
media_content_type: music
|
||||||
|
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||||
|
|
||||||
|
- delay:
|
||||||
|
minutes: "{{ range(10,20) | random }}"
|
||||||
|
|
||||||
|
- service: media_player.media_stop
|
||||||
|
target:
|
||||||
|
entity_id: media_player.kokken
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
alias: Start Vacation Mode
|
- alias: Vacation Mode - Start via dashboard
|
||||||
description: Aktiverer presence simulation ved feriestart og planlægger slutdato
|
description: Aktiverer presence simulation, når Vacation Mode tændes fra dashboardet
|
||||||
trigger:
|
trigger:
|
||||||
- platform: time
|
- platform: state
|
||||||
at: "2026-03-28 14:00:00" # Ferie start
|
entity_id: input_boolean.vacation_mode
|
||||||
action:
|
to: "on"
|
||||||
- service: input_boolean.turn_on
|
|
||||||
target:
|
action:
|
||||||
entity_id: input_boolean.presence_simulation
|
- service: input_boolean.turn_on
|
||||||
# Planlæg slutdato automatisk
|
target:
|
||||||
- delay:
|
entity_id: input_boolean.presence_simulation
|
||||||
days: 7
|
|
||||||
- service: input_boolean.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: input_boolean.presence_simulation
|
|
||||||
|
|||||||
@@ -1,26 +1,28 @@
|
|||||||
alias: Vacation Mode - Recovery efter restart
|
- alias: Vacation Mode - Recovery efter restart
|
||||||
|
trigger:
|
||||||
|
- platform: homeassistant
|
||||||
|
event: start
|
||||||
|
|
||||||
trigger:
|
condition:
|
||||||
- platform: homeassistant
|
- condition: state
|
||||||
event: start
|
entity_id: input_boolean.vacation_mode
|
||||||
|
state: "on"
|
||||||
|
|
||||||
condition:
|
action:
|
||||||
- condition: state
|
- choose:
|
||||||
entity_id: input_boolean.vacation_mode
|
- conditions:
|
||||||
state: "on"
|
- condition: template
|
||||||
|
value_template: >
|
||||||
action:
|
{% set dt = states('input_datetime.vacation_end') %}
|
||||||
- choose:
|
{{ dt not in ['unknown','unavailable',''] and
|
||||||
|
now() >= as_datetime(dt) }}
|
||||||
- conditions:
|
sequence:
|
||||||
- condition: template
|
- service: input_boolean.turn_off
|
||||||
value_template: >
|
target:
|
||||||
{% set dt = states('input_datetime.vacation_end') %}
|
entity_id:
|
||||||
{{ dt not in ['unknown','unavailable',''] and
|
- input_boolean.vacation_mode
|
||||||
now() >= as_datetime(dt) }}
|
- input_boolean.presence_simulation
|
||||||
sequence:
|
default:
|
||||||
- service: input_boolean.turn_off
|
- service: input_boolean.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id:
|
entity_id: input_boolean.presence_simulation
|
||||||
- input_boolean.vacation_mode
|
|
||||||
- input_boolean.presence_simulation
|
|
||||||
|
|||||||
Reference in New Issue
Block a user