lbbrhzn / ocpp

Home Assistant integration for electric vehicle chargers that support the Open Charge Point Protocol (OCPP).
MIT License
216 stars 67 forks source link

BG SyncEV Rebooting Constantly #1153

Closed M450NC closed 2 weeks ago

M450NC commented 4 months ago

I have a BG SyncEV charger. I have set up the OCPP server URL on the charger and I am able to briefly control the charger via home assistant however the charger seems to be constantly reconnecting/rebooting and everything goes unavailable and then comes back.

image

I enabled debug logging and here are some of the latest logs in home-assistant.log:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 327, in call
    response = await self._get_specific_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ocpp/api.py", line 958, in _get_specific_response
    resp = await super()._get_specific_response(unique_id, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 361, in _get_specific_response
    response = await asyncio.wait_for(self._response_queue.get(), timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/ocpp/api.py", line 459, in post_connect
    await self.get_supported_features()
  File "/config/custom_components/ocpp/api.py", line 571, in get_supported_features
    resp = await self.call(req)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 331, in call
    raise asyncio.TimeoutError(
TimeoutError: Waited 30s for response on [2,"98f5355a-2e81-4326-bfdc-8fbe619242fc","GetConfiguration",{"key":["SupportedFeatureProfiles"]}].
2024-05-06 10:51:25.350 ERROR (DbWorker_0) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/queues.py", line 158, in get
    await getter
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 327, in call
    response = await self._get_specific_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ocpp/api.py", line 958, in _get_specific_response
    resp = await super()._get_specific_response(unique_id, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 361, in _get_specific_response
    response = await asyncio.wait_for(self._response_queue.get(), timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/ocpp/api.py", line 459, in post_connect
    await self.get_supported_features()
  File "/config/custom_components/ocpp/api.py", line 571, in get_supported_features
    resp = await self.call(req)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 331, in call
    raise asyncio.TimeoutError(
TimeoutError: Waited 30s for response on [2,"e0f04f80-b43e-48a6-852b-65ec1e4468fe","GetConfiguration",{"key":["SupportedFeatureProfiles"]}].
2024-05-06 10:51:25.352 ERROR (DbWorker_0) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/queues.py", line 158, in get
    await getter
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 327, in call
    response = await self._get_specific_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ocpp/api.py", line 958, in _get_specific_response
    resp = await super()._get_specific_response(unique_id, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 361, in _get_specific_response
    response = await asyncio.wait_for(self._response_queue.get(), timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/ocpp/api.py", line 459, in post_connect
    await self.get_supported_features()
  File "/config/custom_components/ocpp/api.py", line 571, in get_supported_features
    resp = await self.call(req)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 331, in call
    raise asyncio.TimeoutError(
TimeoutError: Waited 30s for response on [2,"f6ed8618-e0c2-4684-addc-104a84ffec78","GetConfiguration",{"key":["SupportedFeatureProfiles"]}].
2024-05-06 10:51:31.831 INFO (MainThread) [ocpp] BS512S213: send [2,"9e9671ed-978d-491c-ae0c-510169235ee2","GetConfiguration",{"key":["SupportedFeatureProfiles"]}]
2024-05-06 10:51:32.329 INFO (MainThread) [ocpp] BS512S213: receive message [3,"9e9671ed-978d-491c-ae0c-510169235ee2",{"configurationKey":[{"key":"SupportedFeatureProfiles","readonly":true}]}]
2024-05-06 10:51:32.330 INFO (MainThread) [ocpp] BS512S213: send [2,"6f853898-36ff-4350-89e9-c644ac2aa3fa","GetConfiguration",{"key":["SupportedFeatureProfiles"]}]
2024-05-06 10:51:32.331 ERROR (MainThread) [custom_components.ocpp] Unexpected exception in connection to 'BS512S213': ''value''
Traceback (most recent call last):
  File "/config/custom_components/ocpp/api.py", line 1026, in run
    await asyncio.gather(*self.tasks)
  File "/config/custom_components/ocpp/api.py", line 459, in post_connect
    await self.get_supported_features()
  File "/config/custom_components/ocpp/api.py", line 572, in get_supported_features
    feature_list = (resp.configuration_key[0][om.value.value]).split(",")
                    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'value'
2024-05-06 10:51:32.332 DEBUG (MainThread) [custom_components.ocpp] Closing websocket to 'BS512S213'
2024-05-06 10:51:44.141 INFO (MainThread) [custom_components.ocpp] Charger BS512S213 disconnected from 0.0.0.0:9000.
2024-05-06 10:51:44.899 WARNING (SyncWorker_50) [homeassistant.helpers.frame] Detected that custom integration 'hass_agent' calls async_create_task from a thread at custom_components/hass_agent/__init__.py, line 147: hass.async_create_task(handle_apis_changed(hass, entry, apis)), please report it to the author of the 'hass_agent' custom integration
2024-05-06 10:51:44.902 ERROR (SyncWorker_50) [homeassistant.util.logging] Exception in updated when handling msg on 'hass.agent/devices/MasonsPC': '{"serial_number":"2d6266bb-fc1d-4c18-9f9c-950abd3ca754","device":{"identifiers":"hass.agent-MasonsPC","manufacturer":"LAB02 Research","model":"Microsoft Windows NT 10.0.22631.0","name":"MasonsPC","sw_version":"2022.14.0"},"apis":{"notifications":true,"media_player":true}}'
Traceback (most recent call last):
  File "/config/custom_components/hass_agent/__init__.py", line 147, in updated
    hass.async_create_task(handle_apis_changed(hass, entry, apis))
  File "/usr/src/homeassistant/homeassistant/core.py", line 816, in async_create_task
    self.verify_event_loop_thread("async_create_task")
  File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
    frame.report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'hass_agent' calls async_create_task from a thread at custom_components/hass_agent/__init__.py, line 147: hass.async_create_task(handle_apis_changed(hass, entry, apis)). Please report it to the author of the 'hass_agent' custom integration.

2024-05-06 10:51:47.295 INFO (MainThread) [custom_components.ocpp] Websocket Subprotocol matched: ocpp1.6
2024-05-06 10:51:47.295 INFO (MainThread) [custom_components.ocpp] Charger websocket path=/BS512S213
2024-05-06 10:51:47.296 INFO (MainThread) [custom_components.ocpp] Charger BS512S213 reconnected to 0.0.0.0:9000.
2024-05-06 10:51:47.296 DEBUG (MainThread) [custom_components.ocpp] Reconnect websocket to BS512S213
2024-05-06 10:51:48.323 INFO (MainThread) [ocpp] BS512S213: receive message [2,"3409","BootNotification",{"chargePointVendor":"BG Sync EV","chargePointModel":"EVT77G-01","chargePointSerialNumber":"BS512S213","chargeBoxSerialNumber":"3030012205205633","firmwareVersion":"AC7K-88071-V3.06"}]
2024-05-06 10:51:48.324 DEBUG (MainThread) [custom_components.ocpp] Received boot notification for BS512S213: {'charge_point_vendor': 'BG Sync EV', 'charge_point_model': 'EVT77G-01', 'charge_point_serial_number': 'BS512S213', 'charge_box_serial_number': '3030012205205633', 'firmware_version': 'AC7K-88071-V3.06'}
2024-05-06 10:51:48.324 DEBUG (MainThread) [custom_components.ocpp] Updating device info charger: {'charge_point_vendor': 'BG Sync EV', 'charge_point_model': 'EVT77G-01', 'charge_point_serial_number': 'BS512S213', 'charge_box_serial_number': '3030012205205633', 'firmware_version': 'AC7K-88071-V3.06'}
2024-05-06 10:51:48.352 INFO (MainThread) [ocpp] BS512S213: send [3,"3409",{"currentTime":"2024-05-06T09:51:48Z","interval":3600,"status":"Accepted"}]
2024-05-06 10:51:48.938 INFO (MainThread) [ocpp] BS512S213: receive message [2,"3410","StatusNotification",{"connectorId":1,"errorCode":"NoError","status":"Unavailable"}]
2024-05-06 10:51:48.950 INFO (MainThread) [ocpp] BS512S213: send [3,"3410",{}]
2024-05-06 10:51:49.657 INFO (MainThread) [ocpp] BS512S213: receive message [2,"3411","Heartbeat",{}]
2024-05-06 10:51:49.666 INFO (MainThread) [ocpp] BS512S213: send [3,"3411",{"currentTime":"2024-05-06T09:51:49Z"}]
2024-05-06 10:52:02.332 INFO (MainThread) [ocpp] BS512S213: send [2,"2c864b06-1e07-4165-a14c-e891d7f6bfea","GetConfiguration",{"key":["SupportedFeatureProfiles"]}]
2024-05-06 10:52:03.276 INFO (MainThread) [ocpp] BS512S213: receive message [3,"2c864b06-1e07-4165-a14c-e891d7f6bfea",{"configurationKey":[{"key":"SupportedFeatureProfiles","readonly":true}]}]
2024-05-06 10:52:03.276 INFO (MainThread) [ocpp] BS512S213: send [2,"0bfd97af-85a3-4721-ab07-d34354ab1482","GetConfiguration",{"key":["SupportedFeatureProfiles"]}]
2024-05-06 10:52:03.277 ERROR (MainThread) [custom_components.ocpp] Unexpected exception in connection to 'BS512S213': ''value''
Traceback (most recent call last):
  File "/config/custom_components/ocpp/api.py", line 1026, in run
    await asyncio.gather(*self.tasks)
  File "/config/custom_components/ocpp/api.py", line 459, in post_connect
    await self.get_supported_features()
  File "/config/custom_components/ocpp/api.py", line 572, in get_supported_features
    feature_list = (resp.configuration_key[0][om.value.value]).split(",")
                    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'value'
2024-05-06 10:52:03.278 DEBUG (MainThread) [custom_components.ocpp] Closing websocket to 'BS512S213'
2024-05-06 10:52:14.580 INFO (MainThread) [custom_components.ocpp] Charger BS512S213 disconnected from 0.0.0.0:9000.
2024-05-06 10:52:15.261 WARNING (SyncWorker_61) [homeassistant.helpers.frame] Detected that custom integration 'hass_agent' calls async_create_task from a thread at custom_components/hass_agent/__init__.py, line 147: hass.async_create_task(handle_apis_changed(hass, entry, apis)), please report it to the author of the 'hass_agent' custom integration
2024-05-06 10:52:15.264 ERROR (SyncWorker_61) [homeassistant.util.logging] Exception in updated when handling msg on 'hass.agent/devices/MasonsPC': '{"serial_number":"2d6266bb-fc1d-4c18-9f9c-950abd3ca754","device":{"identifiers":"hass.agent-MasonsPC","manufacturer":"LAB02 Research","model":"Microsoft Windows NT 10.0.22631.0","name":"MasonsPC","sw_version":"2022.14.0"},"apis":{"notifications":true,"media_player":true}}'
Traceback (most recent call last):
  File "/config/custom_components/hass_agent/__init__.py", line 147, in updated
    hass.async_create_task(handle_apis_changed(hass, entry, apis))
  File "/usr/src/homeassistant/homeassistant/core.py", line 816, in async_create_task
    self.verify_event_loop_thread("async_create_task")
  File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
    frame.report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'hass_agent' calls async_create_task from a thread at custom_components/hass_agent/__init__.py, line 147: hass.async_create_task(handle_apis_changed(hass, entry, apis)). Please report it to the author of the 'hass_agent' custom integration.

2024-05-06 10:52:18.252 INFO (MainThread) [custom_components.ocpp] Websocket Subprotocol matched: ocpp1.6
2024-05-06 10:52:18.252 INFO (MainThread) [custom_components.ocpp] Charger websocket path=/BS512S213
2024-05-06 10:52:18.252 INFO (MainThread) [custom_components.ocpp] Charger BS512S213 reconnected to 0.0.0.0:9000.
2024-05-06 10:52:18.252 DEBUG (MainThread) [custom_components.ocpp] Reconnect websocket to BS512S213
2024-05-06 10:52:19.280 INFO (MainThread) [ocpp] BS512S213: receive message [2,"3412","BootNotification",{"chargePointVendor":"BG Sync EV","chargePointModel":"EVT77G-01","chargePointSerialNumber":"BS512S213","chargeBoxSerialNumber":"3030012205205633","firmwareVersion":"AC7K-88071-V3.06"}]
2024-05-06 10:52:19.281 DEBUG (MainThread) [custom_components.ocpp] Received boot notification for BS512S213: {'charge_point_vendor': 'BG Sync EV', 'charge_point_model': 'EVT77G-01', 'charge_point_serial_number': 'BS512S213', 'charge_box_serial_number': '3030012205205633', 'firmware_version': 'AC7K-88071-V3.06'}
2024-05-06 10:52:19.281 DEBUG (MainThread) [custom_components.ocpp] Updating device info charger: {'charge_point_vendor': 'BG Sync EV', 'charge_point_model': 'EVT77G-01', 'charge_point_serial_number': 'BS512S213', 'charge_box_serial_number': '3030012205205633', 'firmware_version': 'AC7K-88071-V3.06'}
2024-05-06 10:52:19.309 INFO (MainThread) [ocpp] BS512S213: send [3,"3412",{"currentTime":"2024-05-06T09:52:19Z","interval":3600,"status":"Accepted"}]
2024-05-06 10:52:19.891 INFO (MainThread) [ocpp] BS512S213: receive message [2,"3413","StatusNotification",{"connectorId":1,"errorCode":"NoError","status":"Unavailable"}]
2024-05-06 10:52:19.897 INFO (MainThread) [ocpp] BS512S213: send [3,"3413",{}]

Thanks in advance for any assistance, I'm fairly new to this so please let me know if you require anything else.

drc38 commented 4 months ago

The charger is not ocpp compliant, as it does not report back any SupportedFeatureProfiles

M450NC commented 4 months ago

The charger is not ocpp compliant, as it does report back any SupportedFeatureProfiles

Thank you for the quick reply. That's a shame. Is there work around possible for this or no chance with controlling this charger with home assistant?

drc38 commented 4 months ago

Look through #899 for various hacks that can be used on non-compliant units

ganterd commented 4 months ago

I have the same charger, and had the same issue. I had to modify the code a bit to extend a timeout, and ignore the SupportedFeatures issue.

I'm not able to post a diff at the moment, but when I get a chance I'll do it.

hermanhobnob commented 3 months ago

Oddly I've been charging with a BG SyncEV and this addon quite happily for a few months now. I've reboots a few times a day in the logs but they never seem to have caused an actual problem getting my 12:30am - 4:30am charge every day. However today something's gone wrong after updating HA and I had to edit the config to remove a hertz field which has apparently disappeared. It's late here and I'm basically confused and not sure if anything is working on not, but I just wanted to say until today I've been charging quite happily for a few months without any serious issues. The reboot notifications were annoying but that's about it. I'll check in again once I've worked out what (if anything) is going on.

kerdridge76 commented 3 months ago

I have the same charger, and had the same issue. I had to modify the code a bit to extend a timeout, and ignore the SupportedFeatures issue.

I'm not able to post a diff at the moment, but when I get a chance I'll do it.

Hi, i have a A-Tronix wallbox and ocpp 0.5.1. works but Updates greater 0.5.1 are rebooting too. Sorry for my incredible english.

kerdridge76 commented 3 months ago

downgrade smaller 0.5.2 are not available at HACS

hermanhobnob commented 3 months ago

Just l came back to say I'm running version 0.5.2 and my car charged fine last night so I don't seem to have a problem apart from reboot notifications every few hours which I've set up a automation to ignore. I am however now reluctant to upgrade 😁

Siumba commented 3 months ago

I have the same issue on 0.5.2 or higher. Every few hours the charger seems to reboot. I downgraded to 0.5.1 (downloaded a release and copied the files over manually in the custom_components folder, and on 0.5.1 I haven't seen one reboot yet. Something seems to be off in the higher versions.

EDIT: after using 0.5.1 for a while I still get regular reboots every few hours.

SAUhrich commented 3 months ago

I have the same charger, and had the same issue. I had to modify the code a bit to extend a timeout, and ignore the SupportedFeatures issue.

I'm not able to post a diff at the moment, but when I get a chance I'll do it.

Hi, I'm still trying to deal with this issue, if you can, please post specifically which files you modified and what parameters you changed? I've been trying for a couple of weeks to solve this. It seems like it is a timeout issue here as well, ocpp will talk to my charger properly for around 1 min, then disconnect, and then around 30 seconds later it will reconnect, reporting that the charger rebooted.

ArtjomE commented 1 month ago

Hi, I have a Vestel EVC04 Charger. Overall, it works well, but I receive the same error message "Ocpp integration: Charger 7000262321000253 rebooted" every minute while charging. When it's in the "not connected" state, the message appears sporadically every few hours.

OCCP Version v0.5.8 Vestel EVC04 Firmware: v3.150.0-1.0.144.0-v7.0.14

Screenshot 2024-07-22 170118

Crown3r commented 4 weeks ago

Same here! Does somebody have found a workaround or something?