mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-09-07 02:18:43 +00:00
Use condition shorthand notations
This commit is contained in:
@@ -32,9 +32,7 @@ variables:
|
||||
person_entity: !input person_entity
|
||||
person_name: "{{ states[person_entity].name }}"
|
||||
|
||||
condition:
|
||||
condition: template
|
||||
value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
|
||||
condition: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
|
||||
|
||||
action:
|
||||
domain: mobile_app
|
||||
|
||||
@@ -16,17 +16,11 @@ trigger:
|
||||
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload_json.click == 'single' }}"
|
||||
- conditions: "{{ trigger.payload_json.click == 'single' }}"
|
||||
sequence: !input click
|
||||
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload_json.click == 'double' }}"
|
||||
- conditions: "{{ trigger.payload_json.click == 'double' }}"
|
||||
sequence: !input double_click
|
||||
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.payload_json.action == 'hold' }}"
|
||||
- conditions: "{{ trigger.payload_json.action == 'hold' }}"
|
||||
sequence: !input hold
|
||||
|
||||
@@ -32,9 +32,7 @@ variables:
|
||||
person_entity: !input person_entity
|
||||
person_name: "{{ states[person_entity].name }}"
|
||||
|
||||
condition:
|
||||
condition: template
|
||||
value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
|
||||
condition: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"
|
||||
|
||||
action:
|
||||
domain: mobile_app
|
||||
|
||||
@@ -19,9 +19,7 @@ script:
|
||||
tapo_bedroom_toggle:
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ state_attr('camera.bedroom_hd', 'privacy_mode') == 'off' }}"
|
||||
- conditions: "{{ state_attr('camera.bedroom_hd', 'privacy_mode') == 'off' }}"
|
||||
sequence:
|
||||
- service: script.tapo_bedroom_off
|
||||
|
||||
|
||||
@@ -122,8 +122,7 @@ script:
|
||||
sequence:
|
||||
- condition: and
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ states('sensor.multisensor_6_temperature')|float > states('input_number.toshiba_trigger_temp')|float }}"
|
||||
- condition: "{{ states('sensor.multisensor_6_temperature')|float > states('input_number.toshiba_trigger_temp')|float }}"
|
||||
- condition: numeric_state
|
||||
entity_id: sensor.dark_sky_apparent_temperature
|
||||
above: 23
|
||||
|
||||
@@ -60,10 +60,7 @@ automation:
|
||||
trigger:
|
||||
- platform: mqtt
|
||||
topic: z2m_deconz/trust_remote
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.payload_json.action == "on" }}
|
||||
condition: "{{ trigger.payload_json.action == 'on' }}"
|
||||
action:
|
||||
- service: light.turn_on
|
||||
data_template:
|
||||
@@ -88,10 +85,7 @@ automation:
|
||||
trigger:
|
||||
- platform: mqtt
|
||||
topic: z2m_deconz/trust_remote
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{{ trigger.payload_json.action == "off" }}
|
||||
condition: "{{ trigger.payload_json.action == 'off' }}"
|
||||
action:
|
||||
- service: light.turn_off
|
||||
data_template:
|
||||
|
||||
@@ -155,9 +155,7 @@ automation:
|
||||
platform: state
|
||||
entity_id: media_player.nvidia_shield
|
||||
to: "off"
|
||||
condition:
|
||||
condition: template
|
||||
value_template: "{{ is_state_attr('media_player.living_room_tv', 'source', 'Shield') }}"
|
||||
condition: "{{ is_state_attr('media_player.living_room_tv', 'source', 'Shield') }}"
|
||||
action:
|
||||
- service: media_player.turn_off
|
||||
entity_id: media_player.living_room_tv
|
||||
@@ -172,9 +170,7 @@ automation:
|
||||
platform: state
|
||||
entity_id: media_player.nvidia_shield
|
||||
to: 'playing'
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ state_attr('media_player.nvidia_shield', 'source') == 'Google Cast' }}"
|
||||
condition: "{{ state_attr('media_player.nvidia_shield', 'source') == 'Google Cast' }}"
|
||||
action:
|
||||
- service: script.sonos_join_tv
|
||||
- service: logbook.log
|
||||
|
||||
@@ -119,8 +119,7 @@ automation:
|
||||
- platform: state
|
||||
entity_id: group.bedroom_windows
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ now().hour >= states('input_datetime.alarm_time')[0:2]|int }}"
|
||||
- "{{ now().hour >= states('input_datetime.alarm_time')[0:2]|int }}"
|
||||
- condition: not
|
||||
conditions:
|
||||
- condition: state
|
||||
|
||||
@@ -44,9 +44,7 @@ script:
|
||||
alias: Climate · Heating · Toggle radiator
|
||||
sequence:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_state(entity_id, 'off') }}"
|
||||
- conditions: "{{ is_state(entity_id, 'off') }}"
|
||||
sequence:
|
||||
- service: script.maybe_turn_radiator_on
|
||||
data_template:
|
||||
|
||||
@@ -5,9 +5,7 @@ automation:
|
||||
event_type: ios.action_fired
|
||||
action:
|
||||
choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.actionName == 'alarm_off' }}"
|
||||
- conditions: "{{ trigger.event.data.actionName == 'alarm_off' }}"
|
||||
sequence:
|
||||
- service: notify.telegram
|
||||
data:
|
||||
@@ -18,9 +16,7 @@ automation:
|
||||
data:
|
||||
option: "day"
|
||||
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.actionName == 'wind_down' }}"
|
||||
- conditions: "{{ trigger.event.data.actionName == 'wind_down' }}"
|
||||
sequence:
|
||||
- service: notify.telegram
|
||||
data:
|
||||
@@ -31,9 +27,7 @@ automation:
|
||||
data:
|
||||
option: "bed"
|
||||
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.event.data.actionName == 'bedtime' }}"
|
||||
- conditions: "{{ trigger.event.data.actionName == 'bedtime' }}"
|
||||
sequence:
|
||||
- service: notify.telegram
|
||||
data:
|
||||
|
||||
Reference in New Issue
Block a user