Skip to content

No data from and to vehicle - need to restart homeassistant to get it working again #375

@mszwelch

Description

@mszwelch

The problem

Since a few weeks I don't get data from the vehicle after some time (hours). The only way to recover is to restart homeassistant.

In home-assistant.log I can't see particular issues but only errors that are a consequence I believe. I put an example of a log entry of the time when a script should set a charging break - please see in the logs section.

Please note: all other entities are wrong (=old). The log only shows something that I can see that might be of help.

What version of MBAPI2020 do use?

v0.29.4

What was the last working version of MBAPI2020?

No response

What type of installation are you running?

Home Assistant OS

Diagnostics information

config_entry-mbapi2020-01JR0A2K3F02J5EYP2ZD706N98 (5).json

Example YAML snippet

Anything in the logs that might be useful for us?

log entries when the system is in state of not receiving or sending data:

2025-09-21 18:14:05.952 ERROR (MainThread) [homeassistant.components.automation.soc_haus_unterschritten] SOC Haus unterschritten : Error executing script. Unexpected error for call_service at pos 2: 'NoneType' object has no attribute 'send_bytes'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 524, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1012, in _async_step_call_service
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2835, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2878, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/services.py", line 105, in charging_break_clocktimer_configure
    await domain[_get_config_entryid(call.data.get(CONF_VIN))].client.charging_break_clocktimer_configure(
    ...<13 lines>...
    )
  File "/config/custom_components/mbapi2020/client.py", line 960, in charging_break_clocktimer_configure
    await self.execute_car_command(message)
  File "/config/custom_components/mbapi2020/client.py", line 1648, in execute_car_command
    await self.websocket.call(message.SerializeToString(), car_command=True)
  File "/config/custom_components/mbapi2020/websocket.py", line 252, in call
    await self._connection.send_bytes(message)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send_bytes'
2025-09-21 18:14:05.975 ERROR (MainThread) [homeassistant.components.automation.soc_haus_unterschritten] While executing automation automation.soc_haus_unterschritten
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 717, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        variables, trigger_context, started_action
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1836, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    self._handle_exception(
    ~~~~~~~~~~~~~~~~~~~~~~^
        ex, continue_on_error, self._log_exceptions or log_exceptions
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 556, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 524, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1012, in _async_step_call_service
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2835, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2878, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mbapi2020/services.py", line 105, in charging_break_clocktimer_configure
    await domain[_get_config_entryid(call.data.get(CONF_VIN))].client.charging_break_clocktimer_configure(
    ...<13 lines>...
    )
  File "/config/custom_components/mbapi2020/client.py", line 960, in charging_break_clocktimer_configure
    await self.execute_car_command(message)
  File "/config/custom_components/mbapi2020/client.py", line 1648, in execute_car_command
    await self.websocket.call(message.SerializeToString(), car_command=True)
  File "/config/custom_components/mbapi2020/websocket.py", line 252, in call
    await self._connection.send_bytes(message)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send_bytes'

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions