presence simulation
This commit is contained in:
@@ -0,0 +1,127 @@
|
|||||||
|
alias: Presence Simulation - Tidsblokke med rum
|
||||||
|
description: Simulerer tilstedeværelse i forskellige rum med musik
|
||||||
|
trigger:
|
||||||
|
- platform: time
|
||||||
|
at: "07:00:00" # Morgen
|
||||||
|
- platform: time
|
||||||
|
at: "12:00:00" # Middag
|
||||||
|
- platform: time
|
||||||
|
at: "18:00:00" # Aften
|
||||||
|
condition:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_boolean.presence_simulation
|
||||||
|
state: "on"
|
||||||
|
- condition: time
|
||||||
|
after: "07:00:00"
|
||||||
|
before: "22:30:00"
|
||||||
|
action:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: time
|
||||||
|
after: "07:00:00"
|
||||||
|
before: "12:00:00"
|
||||||
|
sequence:
|
||||||
|
# Morgen: Bad + forgang
|
||||||
|
- service: homeassistant.turn_on
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- binary_sensor.bad_motion_sensor_motion
|
||||||
|
- binary_sensor.forgang_sensor_motion
|
||||||
|
- delay:
|
||||||
|
seconds: "{{ range(5,20)|random }}"
|
||||||
|
- service: homeassistant.turn_off
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- binary_sensor.bad_motion_sensor_motion
|
||||||
|
- binary_sensor.forgang_sensor_motion
|
||||||
|
# Musik chance
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ range(0,10)|random < 2 }}" # 20% chance
|
||||||
|
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
|
||||||
|
|
||||||
|
- conditions:
|
||||||
|
- condition: time
|
||||||
|
after: "12:00:00"
|
||||||
|
before: "18:00:00"
|
||||||
|
sequence:
|
||||||
|
# Middag: Køkken + indkørsel
|
||||||
|
- service: homeassistant.turn_on
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- binary_sensor.indkorsel_sensor_motion
|
||||||
|
- binary_sensor.hue_motion_sensor_2_motion
|
||||||
|
- delay:
|
||||||
|
seconds: "{{ range(5,20)|random }}"
|
||||||
|
- service: homeassistant.turn_off
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- binary_sensor.indkorsel_sensor_motion
|
||||||
|
- binary_sensor.hue_motion_sensor_2_motion
|
||||||
|
# Musik chance
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ range(0,10)|random < 3 }}" # 30% chance
|
||||||
|
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
|
||||||
|
|
||||||
|
- conditions:
|
||||||
|
- condition: time
|
||||||
|
after: "18:00:00"
|
||||||
|
before: "22:30:00"
|
||||||
|
sequence:
|
||||||
|
# Aften: Stue + hue sensors
|
||||||
|
- service: homeassistant.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
|
||||||
|
- delay:
|
||||||
|
seconds: "{{ range(5,20)|random }}"
|
||||||
|
- service: homeassistant.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
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ range(0,10)|random < 5 }}" # 50% chance
|
||||||
|
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
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
alias: Start Vacation Mode
|
||||||
|
description: Aktiverer presence simulation ved feriestart og planlægger slutdato
|
||||||
|
trigger:
|
||||||
|
- platform: time
|
||||||
|
at: "2026-03-28 14:00:00" # Ferie start
|
||||||
|
action:
|
||||||
|
- service: input_boolean.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.presence_simulation
|
||||||
|
# Planlæg slutdato automatisk
|
||||||
|
- delay:
|
||||||
|
days: 7
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.presence_simulation
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
alias: Vacation Mode - Recovery efter restart
|
||||||
|
trigger:
|
||||||
|
- platform: homeassistant
|
||||||
|
event: start
|
||||||
|
|
||||||
|
condition:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_boolean.vacation_mode
|
||||||
|
state: "on"
|
||||||
|
|
||||||
|
action:
|
||||||
|
- choose:
|
||||||
|
# Hvis slutdato allerede er passeret → sluk med det samme
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ now() >= states('input_datetime.vacation_end') | as_datetime }}"
|
||||||
|
sequence:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id:
|
||||||
|
- input_boolean.vacation_mode
|
||||||
|
- input_boolean.presence_simulation
|
||||||
|
|
||||||
|
# Ellers → gør ingenting (time trigger tager over)
|
||||||
|
- conditions: []
|
||||||
|
sequence: []
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
alias: Vacation Mode - Start
|
||||||
|
trigger:
|
||||||
|
- platform: state
|
||||||
|
entity_id: input_boolean.vacation_mode
|
||||||
|
to: "on"
|
||||||
|
|
||||||
|
action:
|
||||||
|
# Sæt slutdato = nu + 7 dage
|
||||||
|
- service: input_datetime.set_datetime
|
||||||
|
target:
|
||||||
|
entity_id: input_datetime.vacation_end
|
||||||
|
data:
|
||||||
|
datetime: >
|
||||||
|
{{ (now() + timedelta(days=7)).strftime('%Y-%m-%d %H:%M:%S') }}
|
||||||
|
|
||||||
|
# Start presence simulation
|
||||||
|
- service: input_boolean.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.presence_simulation
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
alias: Vacation Mode - Manuel stop
|
||||||
|
trigger:
|
||||||
|
- platform: state
|
||||||
|
entity_id: input_boolean.vacation_mode
|
||||||
|
to: "off"
|
||||||
|
|
||||||
|
action:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.presence_simulation
|
||||||
|
|
||||||
|
- service: media_player.media_stop
|
||||||
|
target:
|
||||||
|
entity_id: media_player.kokken
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
first_run:
|
||||||
|
initial: off
|
||||||
|
first_run_eve:
|
||||||
|
initial: off
|
||||||
|
first_run_stue:
|
||||||
|
initial: off
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
vacation_mode:
|
||||||
|
name: Vacation Mode
|
||||||
|
icon: mdi:beach
|
||||||
|
|
||||||
|
presence_simulation:
|
||||||
|
name: Presence Simulation
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
vacation_end:
|
||||||
|
name: Vacation End
|
||||||
|
has_date: true
|
||||||
|
has_time: true
|
||||||
|
|
||||||
Reference in New Issue
Block a user