Auto-off feature

This commit is contained in:
Martin Bauer 2020-01-17 22:38:03 +01:00
parent 8f1415ec77
commit 6b8d149993
3 changed files with 108 additions and 4 deletions

View File

@ -36,10 +36,30 @@ def get_config():
'key_yellow': '[scene] schlafzimmer_ganz_hell',
'key_blue': '[scene] schlafzimmer_blau',
'key_tv': '[timed_light_off] 30',
'key_video': '[timed_light_off] 15',
'key_music': '[timed_light_off] 10',
'key_pictures': '[timed_light_off] 5',
'key_tv': [service('script.turn_on', 'script.timed_sleep',
variables={'media_content_id': 'spotify:playlist:37i9dQZF1DXbcPC6Vvqudd', # Regen
'light_off_secs': 15 * 60,
'music_off_secs': 45 * 60,
'shuffle': 1,
})],
'key_video': [service('script.turn_on', 'script.timed_sleep',
variables={'media_content_id': 'Good Night',
'light_off_secs': 15 * 60,
'music_off_secs': 45 * 60,
'shuffle': 0,
})],
'key_music': [service('script.turn_on', 'script.timed_sleep',
variables={'media_content_id': 'spotify:playlist:37i9dQZF1DXbcPC6Vvqudd', # Regen
'light_off_secs': 5 * 60,
'music_off_secs': 20 * 60,
'shuffle': 1,
})],
'key_pictures': [service('script.turn_on', 'script.timed_sleep',
variables={'media_content_id': 'Good Night',
'light_off_secs': 5 * 60,
'music_off_secs': 20 * 60,
'shuffle': 0,
})],
'key_power': [ # Music & Lights off
service('media_player.media_pause', 'media_player.bedroompi'),

View File

@ -492,6 +492,27 @@
state: 'off'
light.schlafzimmer_schrank:
state: 'off'
- name: Schlafzimmer Einschlaflicht
id: schlafzimmer_einschlaflicht
entities:
light.schlafzimmer_deckenlampe:
state: false
light.schlafzimmer_schrank:
state: false
light.bett_martin:
state: true
brightness: 70
xy_color:
- 0.502
- 0.414
light.bett_rebecca:
state: true
brightness: 70
xy_color:
- 0.502
- 0.414
light.schlafzimmer_fluter:
state: false
- name: Schlafzimmer Orange
id: schlafzimmer_orange
entities:

View File

@ -0,0 +1,63 @@
#timed_sleep_rain:
# alias: "Einschlafen mit Regen"
# sequence:
# - service: media_player.play_media
# data:
# entity_id: media_player.bedroompi
# media_content_id: spotify:playlist:37i9dQZF1DXbcPC6Vvqudd
# media_content_type: music
# - service: scene.turn_on
# data:
# entity_id: scene.schlafzimmer_einschlaflicht
# - service: squeezebox_telnet.squeezebox_call_method
# data:
# command: sleep
# parameters:
# - 2700
# - service: light.turn_off
# data:
# transition: 900
# entity_id: group.bedroom
#
#
#timed_sleep_music:
# alias: "Einschlafen mit Musik"
# sequence:
# - service: media_player.play_media
# data:
# entity_id: media_player.bedroompi
# media_content_id: "Good Night"
# media_content_type: music
# - service: scene.turn_on
# data:
# entity_id: scene.schlafzimmer_einschlaflicht
# - service: light.turn_off
# data:
# transition: 900
# entity_id: group.bedroom
timed_sleep:
alias: "Einschlafen mit Licht und Musik auto-aus"
sequence:
- service: media_player.shuffle_set
data_template:
entity_id: "media_player.bedroompi"
shuffle: >
{% if shuffle %}True{% else %}False{% endif %}
- service: media_player.play_media
data_template:
entity_id: "media_player.bedroompi"
media_content_id: "{{media_content_id}}"
media_content_type: "music"
- service: scene.turn_on
data:
entity_id: scene.schlafzimmer_einschlaflicht
- service: light.turn_off
data_template:
transition: "{{light_off_secs}}"
entity_id: group.bedroom
- service: media_player.squeezebox_call_method
data_template:
entity_id: "media_player.bedroompi"
command: "sleep {{music_off_secs}}"