#automation not working with error : String does not match the pattern of LEGACY_SYNTAX

1 messages · Page 1 of 1 (latest)

past hull
#

Hi,
I haven't noticed since a while, but I have an automation, that calculate weather that is not working anymore. I could not say since when.

I have problem to identify the root cause.
When editing in VSCode, I have error on line - plateform: time - String does not match the pattern of LEGACY_SYNTAX
I also see in log :
2025-06-27 00:02:23.545 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ weather_fc['weather.home'].forecast[0].wind_gust_speed }}) renders=2> Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 644, in async_render render_result = _render_with_context(self.template, compiled, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2969, in _render_with_context return template.render(**kwargs) ~~~~~~~~~~~~~~~^^^^^^^^^^ ... ~~~^^^^^^^^^^ jinja2.exceptions.UndefinedError: 'weather_fc' is undefined The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 761, in async_render_to_info render_info._result = self.async_render( # noqa: SLF001 ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ variables, strict=strict, log_fn=log_fn, **kwargs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 646, in async_render raise TemplateError(err) from err homeassistant.exceptions.TemplateError: UndefinedError: 'weather_fc' is undefined

unreal moth
#

Hello @past hull,
That's not an error. It is VSCode telling you you are using a legacy version of syntax.
Check the docs or search the forums for what to change, or don't bother changing if it works and the warning doesn't bother you.

safe bane
#

Isn't this more than a warning?
UndefinedError: 'weather_fc' is undefined

past hull
#

ok for the error in vsCode, but i still have a problem with a card. The value is never displayed. I always have a "loading ring"

#

and code for this is just
`- sensor:

  • name: "wind_gust"
    unit_of_measurement: "km/h"
    state: >
    {{ state_attr('sensor.solarws_windspeed_meter', 'max_value') }}`
unreal moth
marsh drift
#

What does {{ state_attr('sensor.solarws_windspeed_meter', 'max_value') }} give you when you enter it in Dev tools => Template?

And out of the box, the card you use doesn't support to display attributes?

past hull
#

it returns "NULL"