I have this template Sensor:
template:
- trigger:
- platform: time_pattern
minutes: /1
action:
- service: calendar.get_events
data:
duration:
hours: 24
minutes: 0
seconds: 0
start_date_time: "{{ today_at() + timedelta(days=1) }}"
target:
entity_id:
- calendar.my_calendar
response_variable: scheduled_events_frei_ferien
- variables:
all_events: >
{{ scheduled_events_frei_ferien["calendar.my_calendar"].events
| rejectattr('start', 'eq', today_at().date() | string ) | list }}
filtered_events_frei: >
{{ all_events | selectattr('summary', 'search', 'frei', ignorecase=true) | list }}
filtered_events_ferien: >
{{ all_events | selectattr('summary', 'search', 'ferien', ignorecase=true) | list }}
sensor:
....
filtered_events_ferien: I would like to found any entries where start with “Ferien”
Ferien: yes
Ferien: abc: yes
ABC: Ferien: no
The same for frei, and if is possible in all_events the same but start with ferien and frei.
Is it possible to work with an regex in the template? I have try somethink like “^frei.*” but it will by found all entries with frei.