Refactor check_day_camp script for improved readability and structure

This commit is contained in:
2025-06-25 15:29:01 -04:00
parent 74155403a3
commit 4eecbe4589

View File

@@ -1,21 +1,30 @@
- check_day_camp: check_day_camp:
sequence: alias: Check Day Camp
- choose: sequence:
- conditions: - choose:
- condition: template - conditions:
value_template: > - condition: template
{{ states('calendar.family_events') == 'on' and value_template: >-
'camp' in (state_attr('calendar.family_events', 'message') | default('') | lower) and {{ states('calendar.family_events') == 'on'
'no' not in (state_attr('calendar.family_events', 'message') | default('') | lower) }} and 'camp' in (state_attr('calendar.family_events', 'message')
sequence: | default('')
- service: input_boolean.turn_on | lower)
target: and 'no' not in (state_attr('calendar.family_events', 'message')
entity_id: input_boolean.day_camp_today | default('')
default: | lower) }}
- service: input_boolean.turn_off sequence:
target: - service: input_boolean.turn_on
entity_id: input_boolean.day_camp_today target:
- service: system_log.write entity_id: input_boolean.day_camp_today
data: default:
message: "Calendar Check: State={{ states('calendar.family_events') }}, Message={{ state_attr('calendar.family_events', 'message') | default('') }}" - service: input_boolean.turn_off
level: debug target:
entity_id: input_boolean.day_camp_today
- service: system_log.write
data:
message: >
Calendar Check: State={{ states('calendar.family_events') }},
Message={{ state_attr('calendar.family_events', 'message')
| default('') }}
level: debug