Refactor check_day_camp script to simplify event condition checks and streamline input_boolean handling

This commit is contained in:
2025-06-25 15:11:53 -04:00
parent d207664e15
commit 705f800803

View File

@@ -1,17 +1,10 @@
- check_day_camp: - check_day_camp:
sequence: sequence:
- service: calendar.list_events
data:
start_date: "{{ now().date() }}"
end_date: "{{ (now() + timedelta(days=1)).date() }}"
target:
entity_id: calendar.family_events
response_variable: events
- choose: - choose:
- conditions: - conditions:
- condition: template - condition: template
value_template: > value_template: >
{{ events.events | default([]) | selectattr('summary', 'search', 'Camp') | rejectattr('summary', 'search', 'No') | list | count > 0 }} {{ states('calendar.family_events') == 'on' and 'Camp' in (state_attr('calendar.family_events', 'message') | default('')) and 'No' not in (state_attr('calendar.family_events', 'message') | default('')) }}
sequence: sequence:
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target: