Refactor check_day_camp script to improve event condition checks and enhance calendar event retrieval

This commit is contained in:
2025-06-25 15:12:40 -04:00
parent 705f800803
commit ddd8dc1421

View File

@@ -1,10 +1,17 @@
- check_day_camp:
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:
- conditions:
- condition: template
value_template: >
{{ 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('')) }}
{{ events.events | default([]) | selectattr('summary', 'search', 'Camp') | rejectattr('summary', 'search', 'No') | list | count > 0 }}
sequence:
- service: input_boolean.turn_on
target: