flobz / psa_car_controller

Control psa car with connected_car v4 API.
GNU General Public License v3.0
385 stars 196 forks source link

Addon keeps shutting down #843

Open FilipeOS opened 3 months ago

FilipeOS commented 3 months ago

Describe the bug Addon is crashing since the 3.5.0 update, all the time, everyday. 1

To Reproduce Steps to reproduce the behavior:

  1. what command did you use NOTHING
  2. when the bug append ? AFTER UPDATE OF ADDON
  3. Does it persist after restarting the program? YES
  4. Does it persist after recreate config by going to http://server_address:port/config? YES

Config file Give the anonymize content of the config file

Environment (please complete the following information):

Additional context AFTER I RESTART ADDON, IT STARTS BUT ASK ME TO REDO THE CONFIG

2024-04-08 22:30:56.760 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ states.sensor.psa.attributes["energy"][0]["charging"]["status"] }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 303, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'energy'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'energy'
2024-04-08 22:30:56.769 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'energy'') while processing template 'Template<template=({{ states.sensor.psa.attributes["energy"][0]["charging"]["status"] }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_charging_status'
2024-04-08 22:30:56.770 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=('{{ states.sensor.peugeot_e2008.attributes["battery"]["voltage"] * 4 }}') renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 303, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'None' has no attribute 'attributes'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'attributes'
2024-04-08 22:30:56.779 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'attributes'') while processing template 'Template<template=('{{ states.sensor.peugeot_e2008.attributes["battery"]["voltage"] * 4 }}') renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_battery_voltage'
2024-04-08 22:30:56.780 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].level }}'
2024-04-08 22:30:56.781 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'energy')[0].level }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 0

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 0
2024-04-08 22:30:56.788 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].level }}'
2024-04-08 22:30:56.789 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({{ state_attr('sensor.psa', 'energy')[0].level }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_battery_level'
2024-04-08 22:30:56.791 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'energy')[0]['battery']['health']['resistance'] }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 303, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 0

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 0
2024-04-08 22:30:56.796 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({{ state_attr('sensor.psa', 'energy')[0]['battery']['health']['resistance'] }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_battery_soc'
2024-04-08 22:30:56.798 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ states.sensor.psa.attributes["timed_odometer"]["mileage"] }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 303, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'timed_odometer'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'timed_odometer'
2024-04-08 22:30:56.807 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'timed_odometer'') while processing template 'Template<template=({{ states.sensor.psa.attributes["timed_odometer"]["mileage"] }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_mileage'
2024-04-08 22:30:56.809 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ states.sensor.psa.attributes["energy"][0]["autonomy"] }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 303, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'energy'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'energy'
2024-04-08 22:30:56.817 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'energy'') while processing template 'Template<template=({{ states.sensor.psa.attributes["energy"][0]["autonomy"] }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_range'
2024-04-08 22:30:56.818 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'air_conditioning' when rendering '{{ state_attr('sensor.psa', 'preconditionning').air_conditioning.status }}'
2024-04-08 22:30:56.819 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'preconditionning').air_conditioning.status }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'None' has no attribute 'air_conditioning'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'air_conditioning'
2024-04-08 22:30:56.829 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'air_conditioning' when rendering '{{ state_attr('sensor.psa', 'preconditionning').air_conditioning.status }}'
2024-04-08 22:30:56.831 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'air_conditioning'') while processing template 'Template<template=({{ state_attr('sensor.psa', 'preconditionning').air_conditioning.status }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_preconditioning_status'
2024-04-08 22:30:56.833 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].charging.charging_mode }}'
2024-04-08 22:30:56.833 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'energy')[0].charging.charging_mode }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 0

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 0
2024-04-08 22:30:56.844 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].charging.charging_mode }}'
2024-04-08 22:30:56.844 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({{ state_attr('sensor.psa', 'energy')[0].charging.charging_mode }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_charging_mode'
2024-04-08 22:30:56.846 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].charging.charging_rate }}'
2024-04-08 22:30:56.846 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'energy')[0].charging.charging_rate }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 0

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 0
2024-04-08 22:30:56.853 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].charging.charging_rate }}'
2024-04-08 22:30:56.854 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({{ state_attr('sensor.psa', 'energy')[0].charging.charging_rate }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_charge_rate'
2024-04-08 22:30:56.857 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'air' when rendering '{{ state_attr("sensor.psa", "environment").air.temp }}'
2024-04-08 22:30:56.858 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr("sensor.psa", "environment").air.temp }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'None' has no attribute 'air'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'air'
2024-04-08 22:30:56.866 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'air' when rendering '{{ state_attr("sensor.psa", "environment").air.temp }}'
2024-04-08 22:30:56.867 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'air'') while processing template 'Template<template=({{ state_attr("sensor.psa", "environment").air.temp }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.psa_temperature'
2024-04-08 22:30:56.868 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'type' when rendering '{{ state_attr('sensor.psa', 'ignition').type }}'
2024-04-08 22:30:56.868 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'type' when rendering '{{ state_attr('sensor.psa', 'ignition').type }}'
2024-04-08 22:30:56.929 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].charging.plugged }}'
2024-04-08 22:30:56.930 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'energy')[0].charging.plugged }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: None has no element 0

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: None has no element 0
2024-04-08 22:30:56.937 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: None has no element 0 when rendering '{{ state_attr('sensor.psa', 'energy')[0].charging.plugged }}'
2024-04-08 22:30:56.937 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({{ state_attr('sensor.psa', 'energy')[0].charging.plugged }}) renders=4>' for attribute '_state' in entity 'binary_sensor.psa_plugged_in'
2024-04-08 22:30:56.938 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'moving' when rendering '{{ state_attr('sensor.psa', 'kinetic').moving }}'
2024-04-08 22:30:56.939 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'geometry' when rendering '{{ state_attr('sensor.psa', 'last_position').geometry.coordinates[1] }}'
2024-04-08 22:30:56.940 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'last_position').geometry.coordinates[1] }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'None' has no attribute 'geometry'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'geometry'
2024-04-08 22:30:56.945 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'geometry' when rendering '{{ state_attr('sensor.psa', 'last_position').geometry.coordinates[0] }}'
2024-04-08 22:30:56.946 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ state_attr('sensor.psa', 'last_position').geometry.coordinates[0] }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 586, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2545, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.12/site-packages/jinja2/sandbox.py", line 326, in getattr
    value = getattr(obj, attribute)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2580, in _fail_with_undefined_error
    raise ex
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2577, in _fail_with_undefined_error
    return super()._fail_with_undefined_error(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'None' has no attribute 'geometry'

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 712, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 588, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'geometry'
2024-04-08 22:30:56.954 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'moving' when rendering '{{ state_attr('sensor.psa', 'kinetic').moving }}'
2024-04-08 22:30:56.954 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'geometry' when rendering '{{ state_attr('sensor.psa', 'last_position').geometry.coordinates[1] }}'
2024-04-08 22:30:56.955 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'geometry' when rendering '{{ state_attr('sensor.psa', 'last_position').geometry.coordinates[0] }}'
2024-04-08 22:30:56.956 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'geometry'') while processing template 'Template<template=({{ state_attr('sensor.psa', 'last_position').geometry.coordinates[1] }}) renders=4>' for attribute 'latitude' in entity 'binary_sensor.psa_position'
2024-04-08 22:30:56.956 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'geometry'') while processing template 'Template<template=({{ state_attr('sensor.psa', 'last_position').geometry.coordinates[0] }}) renders=4>' for attribute 'longitude' in entity 'binary_sensor.psa_position'
Slin-nilS commented 2 months ago

I could be that I had the same issue. I fixed it with this steps for me:

  1. Load a Backup from v3.4.1
  2. Update again to the v3.5.0
FilipeOS commented 2 months ago

I did that but it keeps shutting down my HA randomly when it's active... since this last HA update 1 week ago