psa_car_controller icon indicating copy to clipboard operation
psa_car_controller copied to clipboard

Addon keeps shutting down

Open FilipeOS opened this issue 10 months ago • 2 comments

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):

  • OS: HOME ASSISTANT
  • Brand and model of car PEUGEOT E2008
  • Application version (commit number, branch or tag) 3.5.0 (addon)
  • Log from http://server_address:port/log and browser console log
 File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
   response = self.full_dispatch_request()
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1952, in full_dispatch_request
   rv = self.handle_user_exception(e)
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1821, in handle_user_exception
   reraise(exc_type, exc_value, tb)
 File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise
   raise value
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request
   rv = self.dispatch_request()
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request
   return self.view_functions[rule.endpoint](**req.view_args)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/api.py", line 48, in get_vehicle_info
   response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 107, in get_vehicle_info
   res = self.api().get_vehicle_status(car.vehicle_id)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
   (data) = self.get_vehicle_status_with_http_info(id, **kwargs)  # noqa: E501
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
   return self.api_client.call_api(
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/oauth.py", line 107, in call_api
   return self._ApiClient__call_api(resource_path, method,
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 147, in __call_api
   self.update_params_for_auth(header_params, query_params, auth_settings)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 504, in update_params_for_auth
   auth_setting = self.configuration.auth_settings().get(auth)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/configuration.py", line 241, in auth_settings
   'value': 'Bearer ' + self.access_token
TypeError: can only concatenate str (not "NoneType") to str
2024-04-08 22:34:11,316 :: INFO :: 192.168.XXX.YYY - - [08/Apr/2024 22:34:11] "GET /get_vehicleinfo/XXXXXHTTP/1.1" 500 -
2024-04-08 22:35:11,207 :: INFO :: <Request 'http://192.168.XXX.YYY:5001/charge_control?vin=XXXXX' [GET]>
2024-04-08 22:35:11,209 :: ERROR :: Charge control not setup check your PSACC configuration and logs
2024-04-08 22:35:11,212 :: INFO :: 192.168.XXX.YYY - - [08/Apr/2024 22:35:11] "GET /charge_control?vin=XXXXXHTTP/1.1" 200 -
2024-04-08 22:35:11,323 :: ERROR :: Exception on /get_vehicleinfo/XXXXX[GET]
Traceback (most recent call last):
 File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
   response = self.full_dispatch_request()
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1952, in full_dispatch_request
   rv = self.handle_user_exception(e)
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1821, in handle_user_exception
   reraise(exc_type, exc_value, tb)
 File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise
   raise value
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request
   rv = self.dispatch_request()
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request
   return self.view_functions[rule.endpoint](**req.view_args)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/api.py", line 48, in get_vehicle_info
   response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 107, in get_vehicle_info
   res = self.api().get_vehicle_status(car.vehicle_id)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
   (data) = self.get_vehicle_status_with_http_info(id, **kwargs)  # noqa: E501
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
   return self.api_client.call_api(
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/oauth.py", line 107, in call_api
   return self._ApiClient__call_api(resource_path, method,
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 147, in __call_api
   self.update_params_for_auth(header_params, query_params, auth_settings)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 504, in update_params_for_auth
   auth_setting = self.configuration.auth_settings().get(auth)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/configuration.py", line 241, in auth_settings
   'value': 'Bearer ' + self.access_token
TypeError: can only concatenate str (not "NoneType") to str
2024-04-08 22:35:11,326 :: INFO :: 192.168.XXX.YYY - - [08/Apr/2024 22:35:11] "GET /get_vehicleinfo/XXXXX HTTP/1.1" 500 -
2024-04-08 22:36:11,209 :: INFO :: <Request 'http://192.168.XXX.YYY:5001/charge_control?vin=XXXXX' [GET]>
2024-04-08 22:36:11,211 :: ERROR :: Charge control not setup check your PSACC configuration and logs
2024-04-08 22:36:11,212 :: INFO :: 192.168.XXX.YYY - - [08/Apr/2024 22:36:11] "GET /charge_control?vin=XXXXX HTTP/1.1" 200 -
2024-04-08 22:36:11,307 :: ERROR :: Exception on /get_vehicleinfo/VR3UKZKXZLJ831384 [GET]
Traceback (most recent call last):
 File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app
   response = self.full_dispatch_request()
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1952, in full_dispatch_request
   rv = self.handle_user_exception(e)
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1821, in handle_user_exception
   reraise(exc_type, exc_value, tb)
 File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise
   raise value
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request
   rv = self.dispatch_request()
 File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request
   return self.view_functions[rule.endpoint](**req.view_args)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/web/view/api.py", line 48, in get_vehicle_info
   response=json.dumps(APP.myp.get_vehicle_info(vin, from_cache).to_dict(), default=str),
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psacc/application/psa_client.py", line 107, in get_vehicle_info
   res = self.api().get_vehicle_status(car.vehicle_id)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1229, in get_vehicle_status
   (data) = self.get_vehicle_status_with_http_info(id, **kwargs)  # noqa: E501
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api/vehicles_api.py", line 1293, in get_vehicle_status_with_http_info
   return self.api_client.call_api(
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/oauth.py", line 107, in call_api
   return self._ApiClient__call_api(resource_path, method,
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 147, in __call_api
   self.update_params_for_auth(header_params, query_params, auth_settings)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/api_client.py", line 504, in update_params_for_auth
   auth_setting = self.configuration.auth_settings().get(auth)
 File "/usr/local/lib/python3.9/dist-packages/psa_car_controller/psa/connected_car_api/configuration.py", line 241, in auth_settings
   'value': 'Bearer ' + self.access_token
TypeError: can only concatenate str (not "NoneType") to str
2024-04-08 22:36:11,310 :: INFO :: 192.168.XXX.YYY - - [08/Apr/2024 22:36:11] "GET /get_vehicleinfo/XXXXX HTTP/1.1" 500 -

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'

FilipeOS avatar Apr 08 '24 21:04 FilipeOS

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

Slin-nilS avatar Apr 14 '24 11:04 Slin-nilS

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

FilipeOS avatar Apr 14 '24 18:04 FilipeOS