Hey everyone,
I’m getting an error in visual studio code for my template which is used as part of a delayed notifications solution to hold notifications for me whilst in a do not disturb state and it still works and historically has since I first implemented it but now I’m getting the following error:
“String does not match the pattern of “LEGACY_SYNTAX^”.yaml-schema: http://schemas.home-assistant.io/integration-template”
I’ve tried going to this link but it doesn’t appear to exist. Is this a visual studio code error or have templates changed the way they’re setup?
Here’s the template:
- trigger:
- platform: event
event_type:
- message_create
- message_delete
- message_delete_all
sensor:
- name: Delayed Notifications
unique_id: delayed_notifications_sensor
state: "{{ now().timestamp() | timestamp_custom() }}"
attributes:
messages: >
{% set msgs = this.attributes.get('messages', []) %}
{% if trigger.event.event_type == 'message_create' %}
{% set new = [{
"id": trigger.event.data.id | default('TS' ~ now().timestamp()),
"title": trigger.event.data.title | default(''),
"message": trigger.event.data.message | default(''),
"time": now().isoformat() }] %}
{{ (msgs + new) | unique(attribute='id') | list }}
{% elif trigger.event.event_type == 'message_delete' %}
{% if trigger.event.data.id is defined %}
{% set msgs = msgs | rejectattr('id', 'eq', trigger.event.data.id) | list %}
{% elif trigger.event.data.index is defined and trigger.event.data.index | is_number %}
{% set t = trigger.event.data.index | int(0) - 1 %}
{% if 0 <= t < msgs|count %}
{% set msgs = msgs | rejectattr('id', 'eq', msgs[t].id) | list %}
{% endif %}
{% endif %}
{{ msgs }}
{% else %}
{{ [] }}
{% endif %}