fix presence
This commit is contained in:
@@ -1,44 +1,60 @@
|
||||
alias: Presence Simulation - Tidsblokke med rum
|
||||
description: Simulerer tilstedeværelse i forskellige rum med musik
|
||||
alias: Presence Simulation - Tidsblokke (robust)
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
- platform: time
|
||||
at: "07:00:00" # Morgen
|
||||
at: "07:00:00"
|
||||
- platform: time
|
||||
at: "12:00:00" # Middag
|
||||
at: "12:00:00"
|
||||
- platform: time
|
||||
at: "18:00:00" # Aften
|
||||
at: "18:00:00"
|
||||
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: input_boolean.presence_simulation
|
||||
state: "on"
|
||||
- condition: time
|
||||
after: "07:00:00"
|
||||
before: "22:30:00"
|
||||
|
||||
action:
|
||||
- variables:
|
||||
rand_delay: "{{ range(300,1200) | random }}" # 5-20 min
|
||||
rand_music: "{{ range(0,100) | random }}"
|
||||
|
||||
- choose:
|
||||
|
||||
# 🌅 Morgen
|
||||
- conditions:
|
||||
- condition: time
|
||||
after: "07:00:00"
|
||||
after: "06:59:00"
|
||||
before: "12:00:00"
|
||||
sequence:
|
||||
# Morgen: Bad + forgang
|
||||
- service: homeassistant.turn_on
|
||||
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- binary_sensor.bad_motion_sensor_motion
|
||||
- binary_sensor.forgang_sensor_motion
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
- delay:
|
||||
seconds: "{{ range(5,20)|random }}"
|
||||
- service: homeassistant.turn_off
|
||||
seconds: "{{ rand_delay }}"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- binary_sensor.bad_motion_sensor_motion
|
||||
- binary_sensor.forgang_sensor_motion
|
||||
# Musik chance
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ range(0,10)|random < 2 }}" # 20% chance
|
||||
value_template: "{{ rand_music < 20 }}"
|
||||
sequence:
|
||||
- service: media_player.play_media
|
||||
target:
|
||||
@@ -46,35 +62,44 @@ action:
|
||||
data:
|
||||
media_content_type: music
|
||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||
|
||||
- delay:
|
||||
minutes: "{{ range(5,15)|random }}"
|
||||
seconds: "{{ range(300,900) | random }}"
|
||||
|
||||
- service: media_player.media_stop
|
||||
target:
|
||||
entity_id: media_player.kokken
|
||||
|
||||
# 🌤️ Middag
|
||||
- conditions:
|
||||
- condition: time
|
||||
after: "12:00:00"
|
||||
after: "11:59:00"
|
||||
before: "18:00:00"
|
||||
sequence:
|
||||
# Middag: Køkken + indkørsel
|
||||
- service: homeassistant.turn_on
|
||||
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- binary_sensor.indkorsel_sensor_motion
|
||||
- binary_sensor.hue_motion_sensor_2_motion
|
||||
- light.kokken
|
||||
- light.indkoersel
|
||||
|
||||
- delay:
|
||||
seconds: "{{ range(5,20)|random }}"
|
||||
- service: homeassistant.turn_off
|
||||
seconds: "{{ rand_delay }}"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- binary_sensor.indkorsel_sensor_motion
|
||||
- binary_sensor.hue_motion_sensor_2_motion
|
||||
# Musik chance
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ range(0,10)|random < 3 }}" # 30% chance
|
||||
value_template: "{{ rand_music < 30 }}"
|
||||
sequence:
|
||||
- service: media_player.play_media
|
||||
target:
|
||||
@@ -82,37 +107,49 @@ action:
|
||||
data:
|
||||
media_content_type: music
|
||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||
|
||||
- delay:
|
||||
minutes: "{{ range(5,15)|random }}"
|
||||
seconds: "{{ range(300,900) | random }}"
|
||||
|
||||
- service: media_player.media_stop
|
||||
target:
|
||||
entity_id: media_player.kokken
|
||||
|
||||
# 🌙 Aften
|
||||
- conditions:
|
||||
- condition: time
|
||||
after: "18:00:00"
|
||||
after: "17:59:00"
|
||||
before: "22:30:00"
|
||||
sequence:
|
||||
# Aften: Stue + hue sensors
|
||||
- service: homeassistant.turn_on
|
||||
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- binary_sensor.stue_motion_bevaegelse
|
||||
- binary_sensor.hue_motion_sensor_2_motion_2
|
||||
- binary_sensor.hue_motion_sensor_1_motion_2
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
|
||||
- delay:
|
||||
seconds: "{{ range(5,20)|random }}"
|
||||
- service: homeassistant.turn_off
|
||||
seconds: "{{ rand_delay }}"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- binary_sensor.stue_motion_bevaegelse
|
||||
- binary_sensor.hue_motion_sensor_2_motion_2
|
||||
- binary_sensor.hue_motion_sensor_1_motion_2
|
||||
# Musik chance
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ range(0,10)|random < 5 }}" # 50% chance
|
||||
value_template: "{{ rand_music < 50 }}"
|
||||
sequence:
|
||||
- service: media_player.play_media
|
||||
target:
|
||||
@@ -120,8 +157,10 @@ action:
|
||||
data:
|
||||
media_content_type: music
|
||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||
|
||||
- delay:
|
||||
minutes: "{{ range(5,15)|random }}"
|
||||
seconds: "{{ range(300,1200) | random }}"
|
||||
|
||||
- service: media_player.media_stop
|
||||
target:
|
||||
entity_id: media_player.kokken
|
||||
|
||||
Reference in New Issue
Block a user