From 008ae353fdf07001ff12b24758b3935f852a871b Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 16 Oct 2024 15:14:30 -0700 Subject: [PATCH] Replace `platform: state` with `trigger: state` --- automations/arriving.yaml | 2 +- automations/bike.yaml | 2 +- automations/climate.yaml | 2 +- automations/leaving.yaml | 2 +- automations/light.yaml | 28 ++++++++++++++-------------- automations/lovelace.yaml | 2 +- automations/media_player.yaml | 6 +++--- automations/music.yaml | 4 ++-- automations/notifications.yaml | 4 ++-- automations/security.yaml | 10 +++++----- automations/sleep_mode.yaml | 10 +++++----- automations/test.yaml | 4 ++-- automations/utilities.yaml | 4 ++-- automations/vacation_mode.yaml | 4 ++-- automations/vacuum.yaml | 6 +++--- automations/work.yaml | 4 ++-- 16 files changed, 47 insertions(+), 47 deletions(-) diff --git a/automations/arriving.yaml b/automations/arriving.yaml index 516dc30d..2b8a83f3 100644 --- a/automations/arriving.yaml +++ b/automations/arriving.yaml @@ -12,7 +12,7 @@ # XXX: sometimes triggers when leaving! - alias: "Arriving: switch music from iPhone to speakers if no one is home" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_front_door from: "off" to: "on" diff --git a/automations/bike.yaml b/automations/bike.yaml index 98f5e4fe..ad3e7e9e 100755 --- a/automations/bike.yaml +++ b/automations/bike.yaml @@ -13,7 +13,7 @@ - alias: "Bike: started charging" triggers: - platform: state + trigger: state entity_id: switch.bike_charger to: "on" from: "off" diff --git a/automations/climate.yaml b/automations/climate.yaml index ab4074a0..c87c9216 100755 --- a/automations/climate.yaml +++ b/automations/climate.yaml @@ -94,7 +94,7 @@ - alias: "Climate: warning when heating on and living room door open" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_bedroom to: "on" for: "00:05:00" diff --git a/automations/leaving.yaml b/automations/leaving.yaml index 2b96e3cd..9b46c7c2 100644 --- a/automations/leaving.yaml +++ b/automations/leaving.yaml @@ -90,7 +90,7 @@ event: 1002 # single click actions: - wait_for_trigger: # when the door closes, turn off everything - platform: state + trigger: state entity_id: binary_sensor.openclose_front_door from: "on" to: "off" diff --git a/automations/light.yaml b/automations/light.yaml index ad514a58..57fddee3 100755 --- a/automations/light.yaml +++ b/automations/light.yaml @@ -25,7 +25,7 @@ - alias: "Light: turn on living room" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_living_room to: "on" conditions: @@ -91,7 +91,7 @@ - alias: "Light: toggle dinner area lights" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_dinner_area conditions: - condition: state @@ -116,7 +116,7 @@ - condition: time after: "18:00:00" triggers: - platform: state + trigger: state entity_id: light.dinner_area to: "off" actions: @@ -133,7 +133,7 @@ - alias: "Light: turn on kitchen counter if sleep mode is off" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_kitchen to: "on" conditions: @@ -148,7 +148,7 @@ - alias: "Light: turn off kitchen counter" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_kitchen to: "off" actions: @@ -171,7 +171,7 @@ - alias: "Light: turn on bathroom" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_bathroom to: "on" conditions: "{{ states('input_select.sleep_mode') != 'total' }}" @@ -183,7 +183,7 @@ - alias: "Light: turn off bathroom" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_bathroom to: "off" actions: @@ -230,7 +230,7 @@ - alias: "Light: turn off hall" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_hall from: "on" to: "off" @@ -250,7 +250,7 @@ - alias: "Light: automatically turn on the bedroom" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_master_bedroom to: "on" variables: @@ -281,7 +281,7 @@ - alias: "Light: automatically turn off the bedroom" initial_state: "on" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_master_bedroom to: "off" for: "00:08:00" @@ -337,7 +337,7 @@ - alias: "Light: turn off bedroom after 2 hours of inactivity" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_master_bedroom from: "on" to: "off" @@ -358,7 +358,7 @@ - alias: 'Light: Update input_select when bedroom lights turned off' description: "Set the input_select.last_script_bedroom such that colored lights will be chosen" triggers: - platform: state + trigger: state entity_id: light.bedroom_lights to: 'off' actions: @@ -469,7 +469,7 @@ - alias: "Light: toggle guest room" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_guest_room conditions: - condition: state @@ -490,7 +490,7 @@ - alias: "Light: toggle baby room" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_baby_room actions: - service: light.turn_{{ trigger.to_state.state }} diff --git a/automations/lovelace.yaml b/automations/lovelace.yaml index 59dd7b82..d7ac7ed0 100755 --- a/automations/lovelace.yaml +++ b/automations/lovelace.yaml @@ -11,7 +11,7 @@ - alias: "Lovelace: convert lovelace.json to lovelace-ui.yaml" initial_state: "on" triggers: - platform: state + trigger: state entity_id: sensor.lovelace actions: - service: shell_command.convert_lovelace diff --git a/automations/media_player.yaml b/automations/media_player.yaml index 7a5e9df6..1bd570a0 100644 --- a/automations/media_player.yaml +++ b/automations/media_player.yaml @@ -41,7 +41,7 @@ - alias: "Media player: turn off speakers when turning off TV" triggers: - platform: state + trigger: state entity_id: media_player.tv to: "off" conditions: @@ -60,7 +60,7 @@ - alias: "Media player: if speakers off and TV on, turn on the speaker on TV state change" triggers: - platform: state + trigger: state entity_id: media_player.tv conditions: # Happens e.g., when speakers auto-shutdown and the TV is on but idle - condition: state @@ -128,7 +128,7 @@ - alias: "Media player: automatically turn off TV and Xbox after two hours of inactivity" triggers: - platform: state + trigger: state entity_id: binary_sensor.motion_sensor_living_room_klok to: "off" for: "02:00:00" diff --git a/automations/music.yaml b/automations/music.yaml index fc76ca21..8ff16502 100644 --- a/automations/music.yaml +++ b/automations/music.yaml @@ -11,7 +11,7 @@ - alias: "Music: start playlist" initial_state: "on" triggers: - platform: state + trigger: state entity_id: input_boolean.start_the_music from: "off" to: "on" @@ -25,7 +25,7 @@ - alias: "Music: switch music from iPhone to speakers if coming home" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_front_door from: "off" to: "on" diff --git a/automations/notifications.yaml b/automations/notifications.yaml index fe65ec9d..edaedb96 100644 --- a/automations/notifications.yaml +++ b/automations/notifications.yaml @@ -11,7 +11,7 @@ - alias: "Notifications: Marcella arrived at Rotterdam Centraal" triggers: - platform: state + trigger: state entity_id: device_tracker.marcella_iphone to: rotterdam_centraal actions: @@ -22,7 +22,7 @@ - alias: "Notifications: front door has opened" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_front_door to: "on" conditions: diff --git a/automations/security.yaml b/automations/security.yaml index 4f8933e7..44871164 100644 --- a/automations/security.yaml +++ b/automations/security.yaml @@ -10,7 +10,7 @@ #- from github.com/basnijholt/home-assistant-config - alias: "Security: motion detected but we are not home" triggers: - platform: state + trigger: state entity_id: binary_sensor.motion_detected from: "off" to: "on" @@ -47,7 +47,7 @@ - alias: "Security: front door has been open for more than 5 minutes" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_front_door from: "off" to: "on" @@ -60,7 +60,7 @@ - alias: "Security: utility room door has been open for more than 5 minutes" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_front_door from: "off" to: "on" @@ -95,7 +95,7 @@ - alias: "Security: bathroom door has opened" triggers: - platform: state + trigger: state entity_id: binary_sensor.openclose_bathroom to: "on" conditions: @@ -122,7 +122,7 @@ - alias: "Security: activity in master bedroom" triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_in_master_bedroom to: "on" conditions: diff --git a/automations/sleep_mode.yaml b/automations/sleep_mode.yaml index 75a33fd5..1eed1c01 100755 --- a/automations/sleep_mode.yaml +++ b/automations/sleep_mode.yaml @@ -29,7 +29,7 @@ - alias: "Night mode: turn off automatic bedroom lights" triggers: - platform: state + trigger: state entity_id: input_select.sleep_mode from: "off" actions: @@ -38,7 +38,7 @@ - alias: "Night mode: set low temperature when sleep mode turns on" triggers: - platform: state + trigger: state entity_id: input_select.sleep_mode from: "off" actions: @@ -49,7 +49,7 @@ When it is half sleeping mode and there is no activity in the house for more than an hour go to total sleeping mode. triggers: - platform: state + trigger: state entity_id: binary_sensor.activity_outside_bedroom to: "off" for: "01:00:00" @@ -71,7 +71,7 @@ description: > Set the living room lights to sleep mode only when no-one is there anymore. triggers: - platform: state + trigger: state entity_id: input_select.sleep_mode to: "total" actions: @@ -79,7 +79,7 @@ - conditions: "{{ is_state('binary_sensor.activity_in_living_room', 'on') }}" sequence: - wait_for_trigger: - platform: state + trigger: state entity_id: binary_sensor.activity_in_living_room from: "on" to: "off" diff --git a/automations/test.yaml b/automations/test.yaml index 3e4e12fa..02cd5cef 100644 --- a/automations/test.yaml +++ b/automations/test.yaml @@ -29,7 +29,7 @@ - alias: "Test: time" triggers: - platform: state + trigger: state entity_id: sensor.time actions: - variables: @@ -42,7 +42,7 @@ - alias: "Test: flash lights" triggers: - platform: state + trigger: state entity_id: sensor.time variables: # 'light.bathroom_ceiling', lights: 'light.bed_led,light.philips_go,light.bed_reading_up,light.hall_3,light.toilet,light.ceiling_kitchen,light.bamboo,light.lampan,light.sphere_2,light.sphere_1,light.hall_2,light.bed_reading_down,light.corner_living_room,light.tv_led,light.stairs_up,light.stairs_down,light.ceiling_bedroom,light.ceiling_living_room,light.hall_1,light.bed_reading' diff --git a/automations/utilities.yaml b/automations/utilities.yaml index 966f34e9..e5d274ef 100755 --- a/automations/utilities.yaml +++ b/automations/utilities.yaml @@ -28,7 +28,7 @@ - alias: "Utilities: washing machine notification" triggers: - platform: state + trigger: state entity_id: binary_sensor.washing_machine from: "off" to: "on" @@ -40,7 +40,7 @@ - alias: "Utilities: dishwasher notification" triggers: - platform: state + trigger: state entity_id: binary_sensor.dishwasher from: "off" to: "on" diff --git a/automations/vacation_mode.yaml b/automations/vacation_mode.yaml index c72a9a14..2c3a4dcb 100755 --- a/automations/vacation_mode.yaml +++ b/automations/vacation_mode.yaml @@ -11,7 +11,7 @@ - alias: "Vacation mode: auto turn on" initial_state: "on" triggers: - platform: state + trigger: state entity_id: group.persons from: home to: not_home @@ -31,7 +31,7 @@ - alias: "Vacation mode: auto turn off" initial_state: "on" triggers: - platform: state + trigger: state entity_id: group.persons from: not_home to: home diff --git a/automations/vacuum.yaml b/automations/vacuum.yaml index 7189348a..8797ff13 100755 --- a/automations/vacuum.yaml +++ b/automations/vacuum.yaml @@ -10,7 +10,7 @@ #- from github.com/basnijholt/home-assistant-config - alias: "Vacuum: started cleaning" triggers: - platform: state + trigger: state entity_id: vacuum.valetudo_vacuum from: docked to: cleaning @@ -26,7 +26,7 @@ - alias: "Vacuum: stopped cleaning" triggers: - platform: state + trigger: state entity_id: vacuum.valetudo_vacuum from: returning to: docked @@ -98,7 +98,7 @@ - alias: "Vacuum: reset to standard mode" triggers: - platform: state + trigger: state entity_id: vacuum.living_room to: docked actions: diff --git a/automations/work.yaml b/automations/work.yaml index 2ed16651..8147dd90 100755 --- a/automations/work.yaml +++ b/automations/work.yaml @@ -10,7 +10,7 @@ #- from github.com/basnijholt/home-assistant-config - alias: "Work: go home notification" triggers: - platform: state + trigger: state entity_id: binary_sensor.worked_enough_today from: "off" to: "on" @@ -43,7 +43,7 @@ - alias: "Work: Bas left work notification for Marcella" triggers: - platform: state + trigger: state entity_id: person.bas from: "Work" conditions: