Refactor check_day_camp script for improved readability and structure
This commit is contained in:
21
scripts.yaml
21
scripts.yaml
@@ -1,12 +1,17 @@
|
|||||||
- check_day_camp:
|
check_day_camp:
|
||||||
|
alias: Check Day Camp
|
||||||
sequence:
|
sequence:
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >-
|
||||||
{{ states('calendar.family_events') == 'on' and
|
{{ states('calendar.family_events') == 'on'
|
||||||
'camp' in (state_attr('calendar.family_events', 'message') | default('') | lower) and
|
and 'camp' in (state_attr('calendar.family_events', 'message')
|
||||||
'no' not in (state_attr('calendar.family_events', 'message') | default('') | lower) }}
|
| default('')
|
||||||
|
| lower)
|
||||||
|
and 'no' not in (state_attr('calendar.family_events', 'message')
|
||||||
|
| default('')
|
||||||
|
| lower) }}
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_boolean.turn_on
|
- service: input_boolean.turn_on
|
||||||
target:
|
target:
|
||||||
@@ -15,7 +20,11 @@
|
|||||||
- service: input_boolean.turn_off
|
- service: input_boolean.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.day_camp_today
|
entity_id: input_boolean.day_camp_today
|
||||||
|
|
||||||
- service: system_log.write
|
- service: system_log.write
|
||||||
data:
|
data:
|
||||||
message: "Calendar Check: State={{ states('calendar.family_events') }}, Message={{ state_attr('calendar.family_events', 'message') | default('') }}"
|
message: >
|
||||||
|
Calendar Check: State={{ states('calendar.family_events') }},
|
||||||
|
Message={{ state_attr('calendar.family_events', 'message')
|
||||||
|
| default('') }}
|
||||||
level: debug
|
level: debug
|
||||||
Reference in New Issue
Block a user