DarkFox-homeassistant/packages/automation/device_sleep.yaml

221 lines
5.4 KiB
YAML

automation:
# Whole Apartment #
- alias: Away
trigger:
platform: state
entity_id: binary_sensor.martin_presence_delayed
to: 'off'
action:
- service: script.playlist_end
- service: switch.turn_off
data:
entity_id: switch.space_heater
# Bathroom #
- alias: Bathroom Speaker active trigger
trigger:
platform: state
entity_id: input_select.room_state_bathroom
to: 'active'
action:
service: media_player.volume_mute
data:
entity_id: media_player.bathroom_speaker
is_volume_muted: false
- alias: Bathroom Speaker inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_bathroom
to: 'off'
action:
service: media_player.volume_mute
data:
entity_id: media_player.bathroom_speaker
is_volume_muted: true
- alias: Bathroom Speaker play inactive
trigger:
platform: state
entity_id: media_player.bathroom_speaker
to: 'playing'
condition:
condition: state
entity_id: input_select.room_state_bathroom
state: 'off'
action:
service: media_player.volume_mute
data:
entity_id: media_player.bathroom_speaker
is_volume_muted: true
# Bedroom #
- alias: Bedroom Speaker active trigger
trigger:
platform: state
entity_id: input_select.room_state_bedroom
to: 'active'
action:
service: switch.turn_on
data:
entity_id: switch.bedroom_speaker_switch
- alias: Bedroom Speaker inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_bedroom
to: 'off'
action:
service: switch.turn_off
data:
entity_id: switch.bedroom_speaker_switch
- alias: Bedroom projector inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_bedroom
to: 'off'
action:
service: media_player.turn_off
data:
entity_id: media_player.projector
# Kitchen #
- alias: Kitchen Speaker active trigger
trigger:
platform: state
entity_id: input_select.room_state_kitchen
to: 'active'
action:
service: media_player.volume_mute
data:
entity_id: media_player.kitchen_speaker
is_volume_muted: false
- alias: Kitchen Speaker inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_kitchen
to: 'off'
action:
service: media_player.volume_mute
data:
entity_id: media_player.kitchen_speaker
is_volume_muted: true
- alias: Kitchen Speaker play inactive
trigger:
platform: state
entity_id: media_player.kitchen_speaker
to: 'playing'
condition:
condition: state
entity_id: input_select.room_state_kitchen
state: 'off'
action:
service: media_player.volume_mute
data:
entity_id: media_player.kitchen_speaker
is_volume_muted: true
# Office #
- alias: Office Speaker active trigger
trigger:
platform: state
entity_id: input_select.room_state_office
to: 'active'
action:
service: switch.turn_on
data:
entity_id: switch.office_desk_speaker_switch
- alias: Office Speaker inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_office
to: 'off'
action:
service: switch.turn_off
data:
entity_id: switch.office_desk_speaker_switch
- alias: Projector Soundbar inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_office
to: 'off'
action:
service: switch.turn_off
data:
entity_id: switch.projector_soundbar_power
- alias: Office space heater turn on
trigger:
platform: state
entity_id: input_select.room_state_office
to: 'active'
condition:
condition: numeric_state
entity_id: 'sensor.office_temperature'
below: '21'
action:
service: switch.turn_on
data:
entity_id: switch.space_heater
# Livingroom #
- alias: Livingroom Speaker trigger
trigger:
platform: state
entity_id: input_select.room_state_livingroom
to: 'active'
action:
service: media_player.volume_mute
data:
entity_id: media_player.tv_soundbar
is_volume_muted: false
- alias: Livingroom inactive trigger
trigger:
platform: state
entity_id: input_select.room_state_livingroom
to: 'off'
action:
- service: switch.turn_off
data:
entity_id: switch.living_room_tv_power
- service: media_player.volume_mute
data:
entity_id: media_player.tv_soundbar
is_volume_muted: true
- alias: Livingroom Speaker play inactive
trigger:
platform: state
entity_id: media_player.livingroom_speaker
to: 'playing'
condition:
condition: state
entity_id: input_select.room_state_livingroom
state: 'off'
action:
service: media_player.volume_mute
data:
entity_id: media_player.livingroom_speaker
is_volume_muted: true
# Home #
- alias: Home inactive trigger
trigger:
platform: state
entity_id: binary_sensor.martin_presence
to: 'off'
action:
service: switch.turn_off
data:
entity_id:
- switch.living_room_tv_power
- switch.tv_soundbar_soundpal
- switch.space_heater