mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -7,12 +7,16 @@ trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_either
|
||||
to: "on"
|
||||
# Bed in master bedroom is occupied
|
||||
- platform: state
|
||||
entity_id: input_boolean.master_bed_occupied
|
||||
to: "on"
|
||||
# Radio playing
|
||||
- platform: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
to: "playing"
|
||||
- platform: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
to: "idle"
|
||||
# Light on
|
||||
- platform: state
|
||||
|
||||
@@ -13,6 +13,10 @@ trigger:
|
||||
entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_right
|
||||
to: "off"
|
||||
for: "00:05:00"
|
||||
# Bed in master bedroom is occupied
|
||||
- platform: state
|
||||
entity_id: input_boolean.master_bed_occupied
|
||||
to: "on"
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.master_bedroom_door_contact
|
||||
|
||||
@@ -10,6 +10,10 @@ trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.bed_presence_c175a4_bed_occupied_right
|
||||
to: "on"
|
||||
# Bed in master bedroom is occupied
|
||||
- platform: state
|
||||
entity_id: input_boolean.master_bed_occupied
|
||||
to: "on"
|
||||
|
||||
condition:
|
||||
- condition: state
|
||||
|
||||
@@ -28,7 +28,7 @@ action:
|
||||
- action: media_player.volume_set
|
||||
data:
|
||||
#entity_id: media_player.ma_home_assistant_voice_097b44_media_player
|
||||
entity_id: media_player.ma_master_bedroom_clock
|
||||
entity_id: media_player.ma_bedroom_hub
|
||||
volume_level: 0.90
|
||||
|
||||
- action: input_select.select_option
|
||||
@@ -40,7 +40,7 @@ action:
|
||||
- action: music_assistant.play_media
|
||||
target:
|
||||
#entity_id: media_player.ma_home_assistant_voice_097b44_media_player
|
||||
entity_id: media_player.ma_master_bedroom_clock
|
||||
entity_id: media_player.ma_bedroom_hub
|
||||
data:
|
||||
media_type: playlist
|
||||
#media_id: library://playlist/7
|
||||
|
||||
@@ -8,10 +8,10 @@ trigger:
|
||||
to: "on"
|
||||
# Radio playing
|
||||
- platform: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
to: "playing"
|
||||
- platform: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
to: "idle"
|
||||
# Light on
|
||||
- platform: state
|
||||
|
||||
@@ -29,8 +29,8 @@ action:
|
||||
- media_player.bathroom_mini
|
||||
- media_player.front_room_hub
|
||||
- media_player.kitchen
|
||||
- media_player.girls_room_hub
|
||||
- media_player.master_bedroom_clock
|
||||
- media_player.girls_room_clock
|
||||
- media_player.bedroom_hub
|
||||
volume_level: 0.7
|
||||
- delay: "00:00:03"
|
||||
- action: tts.speak
|
||||
|
||||
@@ -2,7 +2,7 @@ alias: Continue Girls Room Noise
|
||||
id: automation_continue_girls_room_noise
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: media_player.girls_room_hub
|
||||
entity_id: media_player.girls_room_clock
|
||||
from: "playing"
|
||||
condition:
|
||||
- condition: state
|
||||
|
||||
@@ -35,11 +35,11 @@ condition:
|
||||
attribute: source
|
||||
state: "YouTube"
|
||||
- condition: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
attribute: source
|
||||
state: "PBS Kids"
|
||||
- condition: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
attribute: source
|
||||
state: "YouTube"
|
||||
|
||||
@@ -94,23 +94,23 @@ action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
state: "playing"
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
attribute: source
|
||||
state: "YouTube"
|
||||
- condition: state
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
attribute: source
|
||||
state: "PBS Kids"
|
||||
sequence:
|
||||
- action: media_player.select_source
|
||||
data:
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
source: Home
|
||||
- action: media_player.turn_off
|
||||
data:
|
||||
entity_id: media_player.master_bedroom_clock
|
||||
entity_id: media_player.bedroom_hub
|
||||
|
||||
Reference in New Issue
Block a user