Skip to content

Commit

Permalink
Use action: instead of service:
Browse files Browse the repository at this point in the history
  • Loading branch information
basnijholt committed Oct 16, 2024
1 parent 94636eb commit 896d09e
Show file tree
Hide file tree
Showing 26 changed files with 273 additions and 273 deletions.
16 changes: 8 additions & 8 deletions automations/adaptive_lighting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
choose:
- conditions: "{{ sleep_mode == 'off' }}"
sequence:
- service: switch.turn_off
- action: switch.turn_off
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_bedroom_led
Expand All @@ -29,18 +29,18 @@

- conditions: "{{ sleep_mode == 'half' }}"
sequence:
- service: switch.turn_off
- action: switch.turn_off
entity_id:
- switch.adaptive_lighting_sleep_mode_living_room
- service: switch.turn_on
- action: switch.turn_on
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_bedroom_led
- switch.adaptive_lighting_sleep_mode_baby_room

- conditions: "{{ sleep_mode == 'total' }}"
sequence:
- service: switch.turn_on
- action: switch.turn_on
entity_id:
- switch.adaptive_lighting_sleep_mode_bedroom
- switch.adaptive_lighting_sleep_mode_bedroom_led
Expand All @@ -63,12 +63,12 @@
- delay: "01:00:00"
- condition: template
value_template: "{{ light in state_attr('switch', 'manual_control') }}"
- service: adaptive_lighting.set_manual_control
- action: adaptive_lighting.set_manual_control
data:
entity_id: "{{ switch }}"
lights: "{{ light }}"
manual_control: false
- service: notify.iphone_bas
- action: notify.iphone_bas
data:
title: "Adaptive Ligthing: manual_control reset"
message: "{{ light }} is reset to not 'manually controlled'"
Expand All @@ -83,12 +83,12 @@
light: "{{ trigger.event.data.entity_id }}"
conditions: "{{ 'hall' not in light and 'stairs' not in light }}"
actions:
- service: system_log.write
- action: system_log.write
data:
message: "{{ light }} is manually controlled"
level: error
logger: yolo.yolo
- service: notify.iphone_bas
- action: notify.iphone_bas
data:
title: "Adaptive Ligthing: manual_control"
message: "{{ light }} is now 'manually controlled', context={{ trigger.event.context }}"
8 changes: 4 additions & 4 deletions automations/alarm_clock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
entity_id: input_boolean.alarm_clock
state: "on"
actions:
- service: input_boolean.turn_off
- action: input_boolean.turn_off
entity_id: input_boolean.alarm_clock
- service: input_boolean.turn_on
- action: input_boolean.turn_on
entity_id: input_boolean.wake_up_with_spotify
- service: input_boolean.turn_on
- action: input_boolean.turn_on
entity_id: input_boolean.wake_up_light
- service: input_select.select_option
- action: input_select.select_option
entity_id: input_select.sleep_mode
data:
option: "off"
54 changes: 27 additions & 27 deletions automations/apple_watch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
entity_id: media_player.tv
state: "on"
actions:
service: media_player.media_play_pause
action: media_player.media_play_pause
target:
entity_id: |
media_player.{{ 'xbox' if is_state_attr('media_player.tv', 'source', 'XBOX') else 'tv'}}
Expand All @@ -31,7 +31,7 @@
event_data:
actionName: Minimal lights bedroom
actions:
service: light.turn_on
action: light.turn_on
data:
entity_id:
- light.philips_go
Expand All @@ -46,7 +46,7 @@
event_data:
actionName: Fix TV sound
actions:
service: script.fix_sound
action: script.fix_sound

- alias: "Apple Watch: set sleep mode"
mode: parallel
Expand All @@ -58,7 +58,7 @@
actions:
- variables:
iphone: "notify.mobile_app_{{ trigger.event.data.sourceDeviceName.replace('-', '_') }}"
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
message: "Apple Watch: set sleep mode."
data:
Expand Down Expand Up @@ -86,7 +86,7 @@
continue_on_timeout: false
- variables:
event: "{{ wait.trigger.event.data.action.lower().split('_')[1] }}"
- service: input_select.select_option
- action: input_select.select_option
data:
entity_id: input_select.sleep_mode
option: "{{ event }}"
Expand All @@ -101,7 +101,7 @@
actions:
- variables:
iphone: "notify.mobile_app_{{ trigger.event.data.sourceDeviceName.replace('-', '_') }}"
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
message: "Apple Watch: set lights"
data:
Expand Down Expand Up @@ -162,7 +162,7 @@
'SET_LIGHTS_TOILET': 'light.toilet',
'SET_LIGHTS_KITCHEN': 'light.kitchen_lights',
}[wait.trigger.event.data.action] }}
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
message: "Apple Watch: choose option"
data:
Expand Down Expand Up @@ -217,44 +217,44 @@
- choose:
- conditions: "{{ option == 'LIGHTS_OFF' }}"
sequence:
service: light.turn_off
action: light.turn_off
data:
entity_id: "{{ light }}"
- conditions: "{{ option == 'LIGHTS_ON' }}"
sequence:
service: script.turn_on_lights
action: script.turn_on_lights
data:
entity_id: "{{ light }}"
- conditions: "{{ option == 'LIGHTS_FIFTY' }}"
sequence:
service: light.turn_on
action: light.turn_on
data:
entity_id: "{{ light }}"
brightness_pct: 50
- conditions: "{{ option == 'LIGHTS_HUNDRED' }}"
sequence:
service: light.turn_on
action: light.turn_on
data:
entity_id: "{{ light }}"
brightness_pct: 100
- conditions: "{{ option == 'LIGHTS_ONE' }}"
sequence:
service: light.turn_on
action: light.turn_on
data:
entity_id: "{{ light }}"
brightness_pct: 1
- conditions: "{{ option == 'LIGHTS_WHITE' and light == 'light.living_room_lights'}}"
sequence:
service: script.white_lights_living_room
action: script.white_lights_living_room
- conditions: "{{ option == 'LIGHTS_WHITE' and light == 'light.bedroom_lights'}}"
sequence:
service: script.white_lights_living_room
action: script.white_lights_living_room
- conditions: "{{ option == 'LIGHTS_COZY' and light == 'light.living_room_lights'}}"
sequence:
service: script.cozy_lights_living_room
action: script.cozy_lights_living_room
- conditions: "{{ option == 'LIGHTS_COZY' and light == 'light.bedroom_lights'}}"
sequence:
service: script.cozy_lights_bedroom
action: script.cozy_lights_bedroom

- alias: "Apple Watch: temperature report"
mode: parallel
Expand All @@ -266,7 +266,7 @@
actions:
- variables:
iphone: "notify.mobile_app_{{ trigger.event.data.sourceDeviceName.replace('-', '_') }}"
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
title: "Temperature"
message: >
Expand All @@ -286,7 +286,7 @@
actions:
- variables:
iphone: "notify.iphone_bas"
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
title: Portfolio value
message: >
Expand All @@ -302,7 +302,7 @@
actions:
- variables:
iphone: "notify.mobile_app_{{ trigger.event.data.sourceDeviceName.replace('-', '_') }}"
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
message: "Apple Watch: vacuum"
data:
Expand Down Expand Up @@ -354,7 +354,7 @@
continue_on_timeout: false
- variables:
location: "{{ wait.trigger.event.data.action.lower().split('vacuum_')[1] }}"
- service: script.vacuum_command
- action: script.vacuum_command
data:
option: "{{ location }}"

Expand All @@ -365,17 +365,17 @@
event_data:
actionName: Movie time
actions:
- service: light.turn_on
- action: light.turn_on
data:
entity_id:
- light.living_room_lights
brightness: 5
color_name: red
- service: light.turn_off
- action: light.turn_off
data:
entity_id:
- light.marble
- service: light.turn_on
- action: light.turn_on
data:
entity_id:
- light.tv_led
Expand All @@ -388,7 +388,7 @@
event_data:
actionName: Reset adaptive lighting
actions:
service: script.reset_adaptive_lighting
action: script.reset_adaptive_lighting

- alias: "Apple Watch: set temperature"
mode: parallel
Expand All @@ -400,7 +400,7 @@
actions:
- variables:
iphone: "notify.mobile_app_{{ trigger.event.data.sourceDeviceName.replace('-', '_') }}"
- service: "{{ iphone }}"
- action: "{{ iphone }}"
data:
message: "Apple Watch: set temperature"
data:
Expand Down Expand Up @@ -452,7 +452,7 @@
continue_on_timeout: false
- variables:
temperature: "{{ wait.trigger.event.data.action.split('T')[1] | int }}"
- service: climate.set_temperature
- action: climate.set_temperature
data:
entity_id: climate.thermostat
temperature: "{{ temperature }}"
Expand All @@ -474,7 +474,7 @@
other_person: "{% if phone == 'basnijholt' %}Marcella{% else %}Bas{% endif %}"
device_tracker: "device_tracker.{{ other_person }}_iphone"
actions:
service: "notify.mobile_app_{{ phone }}_iphone"
action: "notify.mobile_app_{{ phone }}_iphone"
data:
message: "{{ other_person }} is {{ distance('device_tracker.basnijholt_iphone', 'device_tracker.marcella_iphone') | round(2) }} km away"
data:
Expand Down
8 changes: 4 additions & 4 deletions automations/arriving.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
- "{{ is_state_attr('media_player.spotify', 'source', 'basnijholt-iphone') }}"
- "{{ is_state('media_player.spotify', 'playing') }}"
actions:
- service: notify.iphone_bas
- action: notify.iphone_bas
data:
title: "Arriving"
message: "Switched music from phone to speakers"
- service: media_player.turn_on
- action: media_player.turn_on
entity_id: media_player.kef_ls50
- service: media_player.select_source
- action: media_player.select_source
entity_id: media_player.kef_ls50
data:
source: Spotify
- service: media_player.select_source
- action: media_player.select_source
entity_id: media_player.spotify
data:
source: KEF LS50
6 changes: 3 additions & 3 deletions automations/bike.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
to: "on"
from: "off"
actions:
- service: input_datetime.set_datetime
- action: input_datetime.set_datetime
data:
entity_id: input_datetime.bike_charger_on
timestamp: "{{ now().timestamp() }}"
- service: input_datetime.set_datetime
- action: input_datetime.set_datetime
data:
entity_id: input_datetime.bike_charger_off
timestamp: "{{ now().timestamp() + 3600 * 6 }}"
Expand All @@ -35,6 +35,6 @@
conditions: template
value_template: "{{ states('sensor.time') == states('input_datetime.bike_charger_off')[0:5] }}"
actions:
service: switch.turn_off
action: switch.turn_off
data:
entity_id: switch.bike_charger
Loading

0 comments on commit 896d09e

Please sign in to comment.