diff --git a/scripts.yaml b/scripts.yaml index 6643e09..deff887 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -1,22 +1,21 @@ - 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: > - {{ 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('') | lower) and + 'no' not in (state_attr('calendar.family_events', 'message') | default('') | lower) }} sequence: - service: input_boolean.turn_on target: entity_id: input_boolean.day_camp_today - default: - - service: input_boolean.turn_off - target: - entity_id: input_boolean.day_camp_today \ No newline at end of file + default: + - service: input_boolean.turn_off + 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 \ No newline at end of file