Is there any easy way to check for the existence of a specific calendar event before creating a duplicate? I have an automation which creates an event in my local ‘maintenance’ calendar for next year when a boiler service is completed.
alias: 30. Maintenance Dates from Calendars
description: >-
1. write from text.boiler_next_maintenance_date (check emsesp
boiler/maintenancedate) to calendar. 2. Write from
date.vallox_next_filter_change_date (check
vallox/date.vallox_filter_change_date) to calendar
triggers:
- entity_id:
- text.boiler_next_maintenance_date
id: boiler
trigger: state
- entity_id:
- date.vallox_filter_change_date
id: vallox
trigger: state
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- boiler
sequence:
- action: calendar.create_event
data:
summary: Boiler - next service
start_date_time: >-
{{states('text.boiler_next_maintenance_date')[6:12]}}-{{states('text.boiler_next_maintenance_date')[3:5]}}-{{states('text.boiler_next_maintenance_date')[0:2]}}
08:00:00
end_date_time: >-
{{states('text.boiler_next_maintenance_date')[6:12]}}-{{states('text.boiler_next_maintenance_date')[3:5]}}-{{states('text.boiler_next_maintenance_date')[0:2]}}
16:00:00
target:
entity_id: calendar.maintenance_plan
- conditions:
- condition: trigger
id:
- vallox
sequence:
- action: calendar.create_event
data:
summary: Vallox - next filter replacement
start_date_time: >-
{{(states('date.vallox_filter_change_date')[0:4]|int+1)}}{{(states('date.vallox_filter_change_date')[4:8])}}{{(states('date.vallox_filter_change_date')[8:10])}}
08:00:00
end_date_time: >-
{{(states('date.vallox_filter_change_date')[0:4]|int+1)}}{{(states('date.vallox_filter_change_date')[4:8])}}{{(states('date.vallox_filter_change_date')[8:10])}}
16:00:00
target:
entity_id: calendar.maintenance_plan
mode: single
The problem with this is that if the state of text.boiler_next_maintenance_date changes for any reason other that entering a new service date into the boiler, for example a restart of the ESP providing the data, it creates a new event. Over the course of the last year I managed to create 73 identical entries for the next service on 5th January 2026. Any ideas, please?