AutomationDataset/oscarb/oscarb_automations.yaml

592 lines
16 KiB
YAML

- id: ktgrzl14
alias: Turn office lights on when computer is active
triggers:
- trigger: state
entity_id: binary_sensor.macbook_pro
to: 'on'
conditions:
- condition: state
entity_id: binary_sensor.macbook_pro_at_desk
state: 'on'
actions:
- action: light.turn_on
data:
entity_id: group.office
- id: zcbujwFc
alias: Turn office lights off when computer is inactive
triggers:
- trigger: state
entity_id: binary_sensor.macbook_pro
to: 'off'
conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.macbook_pro_at_desk
state: 'on'
- condition: time
after: '15:30:00'
actions:
- action: light.turn_off
data:
entity_id:
- office.office_spotlights
- office.office_desk_lamp
- id: 5kRhfCr6
alias: Hallway motion turns on tablet
triggers:
- trigger: state
entity_id: binary_sensor.hallway_motion_sensor
from: 'off'
to: 'on'
conditions: []
actions:
- action: homeassistant.turn_on
target:
entity_id:
- switch.magic_mirror
- switch.hallway_sideboard_light
- switch.hallway_christmas_tree_mini
- id: 100JZqsD
alias: Hallway motion absence turns off tablet
triggers:
- trigger: state
entity_id: binary_sensor.hallway_motion_sensor
from: 'on'
to: 'off'
for:
minutes: 2
conditions: []
actions:
- action: homeassistant.turn_off
entity_id:
- switch.magic_mirror
- switch.hallway_sideboard_light
- id: qPY0qTsQ
alias: Bathroom motion turns on bathroom ceiling lamp dimmed
triggers:
- trigger: state
entity_id: binary_sensor.mqtt_bathroom_motion
from: 'off'
to: 'on'
conditions:
- condition: time
after: '22:00'
before: 08:00
actions:
- action: light.turn_on
data:
brightness: 1
entity_id: light.bathroom_ceiling
- id: Etd7vGR0
alias: Bathroom motion turns on bathroom ceiling lamp strong
triggers:
- trigger: state
entity_id: binary_sensor.mqtt_bathroom_motion
from: 'off'
to: 'on'
conditions:
- condition: time
after: 08:00
before: '22:00'
actions:
- action: light.turn_on
data:
brightness: 255
entity_id: light.bathroom_ceiling
- id: WRU2Iewy
alias: Bathroom motion sensor disabled turns off light
triggers:
- trigger: state
entity_id: binary_sensor.mqtt_bathroom_motion
from: 'on'
to: 'off'
conditions: []
actions:
- action: light.turn_off
data:
entity_id: light.bathroom_ceiling
- id: w5g7FTpO
alias: Turn on office lights when PC turns on
description: ''
triggers:
- trigger: state
entity_id: switch.computer_power
from: 'off'
to: 'on'
conditions: []
actions:
- action: light.turn_on
data: {}
entity_id: group.office
- id: nzf1opOZ
alias: Turn off office lights when PC turns off
description: ''
triggers:
- trigger: state
entity_id: switch.computer_power
from: 'on'
to: 'off'
conditions: []
actions:
- action: light.turn_off
data: {}
entity_id: group.office
- id: fRLa11Es
alias: TV volume control
triggers:
- trigger: state
entity_id: input_number.tv_volume
actions:
- action: media_player.volume_set
target:
entity_id: media_player.tv
data:
volume_level: '{{ trigger.to_state.state | float / 60 }}'
- id: eFPBd9m3
alias: TV device trigger (turn on)
triggers:
- trigger: device
device_id: 3db85e45506d5575e3ab481d650bf776
domain: philips_js
type: turn_on
actions:
- action: script.turn_tv_on
- id: MMpEZi5k
alias: Kids room button clicked
triggers:
- trigger: event
event_type: flic
event_data:
name: kids room
action: PUSH
actions:
- action: light.turn_off
entity_id: light.kids_room_ceiling
- action: switch.turn_off
entity_id: switch.kids_room_star
- action: switch.turn_off
entity_id: switch.kids_room_reading_lamp
- delay: 2
- action: switch.turn_off
entity_id: switch.kids_room_butterfly
- action: timer.start
entity_id: timer.kids_room_sleep_timer
- action: script.cast_goodnight_playlist
- id: 3xnyaeC7
alias: Flic Twist ⚫️
triggers:
- trigger: event
event_type: flic
event_data:
name: office
actions:
- choose:
- conditions: '{{ trigger.event.data.action == ''PUSH'' }}'
sequence:
- action: switch.toggle
target:
entity_id: switch.speakers
- conditions: '{{ trigger.event.data.action == ''DOUBLE_PUSH'' }}'
sequence:
- action: persistent_notification.create
data:
title: DOUBLE PUSH
message: TEST
- id: KhwCeo0X
alias: Stop kids room playback when sleep timer finishes
triggers:
- trigger: event
event_type: timer.finished
event_data:
entity_id: timer.kids_room_sleep_timer
actions:
- action: media_player.media_stop
target:
entity_id: media_player.kids_room_speaker
- id: eJqn2aZN
alias: Turn light on/off when pressing remote
mode: parallel
triggers:
- trigger: state
entity_id: event.kids_room_remote
variables:
button1: switch.kids_room_butterfly
button2: switch.kids_room_star
button3: switch.kids_room_reading_lamp
- trigger: state
entity_id:
- event.bedroom_remote_1
- event.bedroom_remote_2
variables:
button1: light.bedroom_bedside_table_1
button2: light.bedroom_bedside_table_2
button3: light.bedroom_sideboard
- trigger: state
entity_id: event.christmas_remote
variables:
button1:
- switch.living_room_christmas_tree
- switch.hallway_christmas_tree_mini
button2: switch.balcony_lights
button3:
- switch.kitchen_advent_candlestick
- switch.bedroom_advent_candlestick
conditions:
- condition: state
alias: Ensure LilyGO was not recently restarted
entity_id: binary_sensor.omg_lilygo_rtl_433_esp_sys_connectivity
state: 'on'
for:
minutes: 1
actions:
- action: "{% if trigger.to_state.attributes.event_type == 'on' %}\n homeassistant.turn_on\n\
{% else %}\n homeassistant.turn_off\n{% endif %}\n"
target:
entity_id: "{% from 'utilities.jinja' import flatten %} {% if trigger.to_state.attributes.group\
\ %}\n {{ flatten(button1, button2, button3) }}\n{% else %}\n {% set i =\
\ trigger.to_state.attributes.unit % 3 %}\n {{ [button1, button2, button3][i]\
\ }}\n{% endif %}\n"
- id: z3gStMbe
alias: Initiate Christmas feelings on Christmas Eve morning
triggers:
- trigger: sun
event: sunrise
conditions:
- condition: template
alias: Christmas
value_template: '{{ now().month == 12 and now().day == 24 }}'
actions:
- action: script.initiate_christmas_feeling
- id: Gh8A5yyM
alias: Turn on/off speakers when audio available
triggers:
- trigger: state
entity_id: binary_sensor.speakers_audio_available
to: 'on'
for: 00:00:02
- trigger: state
entity_id: binary_sensor.speakers_audio_available
to: 'off'
for: 00:05:00
actions:
- action: "{% if trigger.to_state.state == 'on' %}\n homeassistant.turn_on\n{%\
\ else %}\n homeassistant.turn_off\n{% endif %}\n"
target:
entity_id: switch.speakers
- id: BZqOlbuJ
alias: Music button clicked
triggers:
- trigger: event
event_type: flic
event_data:
name: Music
actions:
- action: "{% if trigger.event.data.action == 'PUSH' %}\n media_player.media_next_track\n\
{% elif trigger.event.data.action == 'DOUBLE_PUSH' %}\n media_player.media_play_pause\n\
{% endif %}\n"
target:
entity_id: media_player.spotify_paq
- id: '1704037367965'
alias: Adjust desk office brightness using Tradfri wireless dimmer
description: ''
use_blueprint:
path: dieneuser/zha-remote-tradfri-wireless-dimmer-ictc-g-1-for-light.yaml
input:
remote: 5093364d7cf432e4ada7f489d8fd0d30
light: light.office_desk
- id: '1704206458274'
alias: IKEA E1743 Trådfri on/off switch - Cabinet Light
description: ''
use_blueprint:
path: oscarb/ikea_tradfri_e1743_light.yaml
input:
light: light.cabinet
remote: 9e898747b9d814c5d3b5b904ac8a9a59
- id: '1707650578350'
alias: Trådfri remote - office desk
description: ''
use_blueprint:
path: oscarb/ikea_tradfri_e1743_light.yaml
input:
light: light.office_desk
remote: 9e898747b9d814c5d3b5b904ac8a9a59
- id: '1714303256311'
alias: IKEA TRADFRI Remote - Kids room
description: Control lights in kids room with IKEA Tradfri remote
use_blueprint:
path: niro1987/zha_ikea_tradfri_5button_remote_custom.yaml
input:
remote: 2629c586f4e4647f1ecdd1be567ca8ba
power_short:
- action: light.toggle
metadata: {}
data: {}
target:
entity_id: light.kids_room_ceiling
dimup_short:
- action: switch.toggle
metadata: {}
data: {}
target:
entity_id: switch.kids_room_star
colorup_short:
- action: switch.toggle
metadata: {}
data: {}
target:
entity_id: switch.kids_room_reading_lamp
colordown_short:
- action: switch.toggle
metadata: {}
data: {}
target:
entity_id: switch.kids_room_butterfly
dimdown_short:
- action: script.group_toggle
metadata: {}
data:
group: group.kids_room
- id: '1714317708649'
alias: Philips Tap Dial - Spotify volume
description: ''
use_blueprint:
path: Ddemooij1984/philips_tap_dial_switch volume-and-actions.yaml
input:
remote: de15c1b3e9b21af302b60512baa104a7
turnwheel_left:
- action: media_player.volume_down
metadata: {}
data: {}
target:
entity_id: media_player.spotify_paq
turnwheel_right:
- action: media_player.volume_up
metadata: {}
data: {}
target:
entity_id: media_player.spotify_paq
- id: '1722513643379'
alias: Increase bathroom brightness with remote
description: ''
triggers:
- trigger: device
device_id: de92640f89b2ee6968d48f4ab01827eb
domain: zha
type: remote_button_short_press
subtype: turn_on
conditions: []
actions:
- action: light.turn_on
metadata: {}
data:
brightness_pct: 100
target:
entity_id: light.bathroom_ceiling
mode: single
- id: '1722513747771'
alias: Decrease bathroom brightness using remote
description: ''
triggers:
- trigger: device
device_id: de92640f89b2ee6968d48f4ab01827eb
domain: zha
type: remote_button_short_press
subtype: turn_off
conditions:
- condition: numeric_state
entity_id: light.bathroom_ceiling
attribute: brightness
above: 1
actions:
- action: light.turn_on
metadata: {}
data:
brightness: 1
target:
entity_id: light.bathroom_ceiling
mode: single
- id: isRB46wN
alias: Turn Christmas lights on when dark outside
triggers:
- trigger: numeric_state
entity_id: sun.sun
attribute: elevation
below: -3.0
conditions:
- condition: state
entity_id: input_boolean.is_christmas_time
state: 'on'
actions:
- action: homeassistant.turn_on
target:
entity_id: group.christmas_lights
- id: zQqB7S81
alias: Turn Christmas lights off when bright outside
triggers:
- trigger: sun
event: sunrise
conditions:
- condition: state
entity_id: input_boolean.is_christmas_time
state: 'on'
actions:
- action: homeassistant.turn_off
target:
entity_id: group.christmas_lights
- id: V14JZxnL
alias: Turn off Christmas lights at night
triggers:
- trigger: time
at: 00:30
conditions:
- condition: state
entity_id: input_boolean.is_christmas_time
state: 'on'
actions:
- action: homeassistant.turn_off
target:
entity_id: group.christmas_lights
- id: nte2ttE1
alias: Turn off bedroom advent candlestick when charging phone by night
triggers:
- trigger: state
entity_id:
- binary_sensor.bedside_charger_1_charging
- binary_sensor.bedside_charger_2_charging
from: 'off'
to: 'on'
conditions:
- condition: time
after: '21:00:00'
actions:
- action: homeassistant.turn_off
target:
entity_id: switch.bedroom_advent_candlestick
- id: tiykEfAD
alias: Reset selected rooms when docked
trigger:
platform: state
entity_id: vacuum.robocop
to: docked
action:
- action: input_boolean.turn_off
target:
label_id: selective_room_cleaning
- id: gt4n94pi
alias: Clean home when being told so
triggers:
- trigger: conversation
command:
- (clean|vacuum) (the|my) (home|apartment)
actions:
- action: vacuum.start
target:
entity_id: vacuum.robocop
- id: 6NYdgMcf
alias: Clean room
description: Start Roborock room cleaning triggered from Assist
triggers:
- trigger: conversation
command:
- (clean|vacuum) (the) {rooms}
actions:
- action: python_script.vacuum_room
target:
entity_id: vacuum.robocop
data_template:
area: '{{ trigger.slots.rooms }}'
- id: 5zdAw089
alias: Send notification when vacuum ecnounters an error
variables:
notify_service: '{{ states(''input_text.notify_service_mobile_oscar'') }}'
triggers:
- trigger: state
entity_id: vacuum.robocop
to: error
actions:
- action: '{{ notify_service }}'
data_template:
title: '{% set current_clean_area = states(''sensor.robocop_current_clean_area'')
| round(0, 0) ~ '' '' ~ state_attr(''sensor.robocop_current_clean_area'',
''unit_of_measurement'') %} {% set current_clean_duration = int(states(''sensor.robocop_current_clean_duration''))
// 60 ~ '' min'' %} Robocop - {{ state_attr(''vacuum.robocop'', ''status'')
}} ({{ current_clean_area }}, {{ current_clean_duration }})
'
message: '❌ {{ state_attr(''vacuum.robocop'', ''error'') }}
'
data:
channel: Vacuum
clickAction: app://com.xiaomi.smarthome
notification_icon: mdi:robot-vacuum
actions:
- action: resume_vacuum
title: Resume
- id: dMSwlTgC
alias: Resume cleaning on notification action
triggers:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: resume_vacuum
conditions: []
actions:
- action: vacuum.start
target:
entity_id: vacuum.robocop
- id: TaAgXTBO
alias: Send notification when vacuum returns to base with action to go to waste
bin
variables:
apartment_size: secret apartment_size
notify_service: '{{ states(''input_text.notify_service_mobile_oscar'') }}'
triggers:
- trigger: state
entity_id: sensor.robocop_total_clean_area
conditions:
- condition: template
value_template: "{{ trigger.from_state is not none and\n trigger.to_state is\
\ not none and\n trigger.from_state.state not in [\"unavailable\"] and\n \
\ trigger.to_state.state | float(0) > trigger.from_state.state | float(0)\n\
}}\n"
actions:
- action: '{{ notify_service }}'
data_template:
title: '{% set clean_area = states(''sensor.robocop_last_clean_area'') | round(0,
0) ~ '' '' ~ state_attr(''sensor.robocop_last_clean_area'', ''unit_of_measurement'')
%} {% set clean_duration = int(states(''sensor.robocop_last_clean_duration''))
// 60 ~ '' min'' %} Robocop - Clean-up complete: {{ clean_area }}, {{ clean_duration
}}
'
message: "{% set clean_area_old = trigger.from_state.state | int %} {% set clean_area_new\
\ = trigger.to_state.state | int %} {% if clean_area_new // (apartment_size\
\ * 2) > clean_area_old // (apartment_size * 2) -%}\n ⚠️ Empty dustbin and\
\ clean filter.\n{%- elif clean_area_new // apartment_size > clean_area_old\
\ // apartment_size -%}\n ⚠️ Empty dustbin.\n{%- endif %} {%- if is_state('binary_sensor.robocop_mop_attached',\
\ 'on') -%}\n ⚠️ Remove water tank.\n{%- endif %} Finished cleaning, returning\
\ to base.\n"
data:
channel: Vacuum
clickAction: app://com.xiaomi.smarthome
notification_icon: mdi:robot-vacuum
actions:
- action: send_robocop_to_waste_bin
title: Go to waste bin
- action: URI
title: Manual
uri: secret roborock_manual
- id: jgu5sWGm
alias: Send Robocop to waste bin on notification action
triggers:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: send_robocop_to_waste_bin
conditions: []
actions:
- action: script.send_robocop_to_waste_bin
data: {}