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