Bonjour à tous
J’ai essayé d’utiliser cette intégration pour avoir la remontée des vacances scolaires et l’utiliser pour mes automations.
Sauf qu’au redémarrage de HA, j’ai des erreurs :
Et voici les erreurs dans le journal
Source: config.py:942
S'est produit pour la première fois: 16:33:06 (1 occurrences)
Dernier enregistrement: 16:33:06
Invalid config for 'sensor' from integration 'rest' at sensors.yaml, line 9: invalid template (TemplateSyntaxError: unexpected char "'" at 563) for dictionary value 'resource_template', got '{% set location = \'Toulouse\' %}\n{% set rows = \'1\'%}\n{% set aujourdhui = now().strftime(\'%Y-%m-%d\')%}\n{% set dayOfYear = now().strftime(\'%j\') %}\n{% set year = now().strftime(\'%Y\') | int %}\n{% set lastYear = year - 1 %}\n{% set nextYear = year + 1 %}\n{% if dayOfYear > \'244\' %}\n{% set schoolYear = (year | string) + "-" + (nextYear | string) %}\n{%- else -%}\n{% set schoolYear = (lastYear | string) + "-" + (year | string) %}\n{%- endif %}\nhttps://data.education.gouv.fr/api/..., please check the docs at https://www.home-assistant.io/integrations/rest
Source: helpers/template.py:633
S'est produit pour la première fois: 16:34:15 (2 occurrences)
Dernier enregistrement: 16:34:15
Error while processing template: Template<template=({% set aujourdhui = now().strftime('%Y-%m-%d')%} {% if aujourdhui < state_attr('sensor.vacances_scolaires', 'start_date') or aujourdhui > state_attr('sensor.vacances_scolaires', 'end_date') %} false {% else %} true {% endif %}) renders=2>
Error while processing template: Template<template=({% set demain = (as_timestamp(now()) + (24*3600)) | timestamp_custom('%Y-%m-%d', True) %} {% if demain < state_attr('sensor.vacances_scolaires', 'start_date') or demain > state_attr('sensor.vacances_scolaires', 'end_date') %} false {% else %} true {% endif %}) renders=2>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 631, in async_render
render_result = _render_with_context(self.template, compiled, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2733, in _render_with_context
return template.render(**kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 2, in top-level template code
TypeError: '<' not supported between instances of 'str' and 'NoneType'
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 748, 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 633, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: '<' not supported between instances of 'str' and 'NoneType'
Source: components/template/template_entity.py:203
intégration: Template (documentation, problèmes)
S'est produit pour la première fois: 16:34:15 (2 occurrences)
Dernier enregistrement: 16:34:15
TemplateError('TypeError: '<' not supported between instances of 'str' and 'NoneType'') while processing template 'Template<template=({% set aujourdhui = now().strftime('%Y-%m-%d')%} {% if aujourdhui < state_attr('sensor.vacances_scolaires', 'start_date') or aujourdhui > state_attr('sensor.vacances_scolaires', 'end_date') %} false {% else %} true {% endif %}) renders=4>' for attribute '_state' in entity 'binary_sensor.vacances_scolaires_aujourdhui'
TemplateError('TypeError: '<' not supported between instances of 'str' and 'NoneType'') while processing template 'Template<template=({% set demain = (as_timestamp(now()) + (24*3600)) | timestamp_custom('%Y-%m-%d', True) %} {% if demain < state_attr('sensor.vacances_scolaires', 'start_date') or demain > state_attr('sensor.vacances_scolaires', 'end_date') %} false {% else %} true {% endif %}) renders=4>' for attribute '_state' in entity 'binary_sensor.vacances_scolaires_demain'
Je ne comprends pas du tout d’où pourrait provenir le problème, merci d’avance à ceux qui pourront m’aider
Si @Giga77 passe par là ou @Thomas_Mary , je les en remercie par avance