VWsFriend icon indicating copy to clipboard operation
VWsFriend copied to clipboard

VWsFriend stops working after a few days

Open Tapter opened this issue 3 weeks ago • 1 comments

I've now updated to 0.24.10 and it started to work again correctly after the login procedure change. However, three times in a row, it again stops after around 2-3 days. After the below exception occurs, nothing is updated anymore:

sqlalchemy.exc.InvalidRequestError: Can't operate on closed transaction inside context manager.  Please complete the context manager before emitting further commands.
   raise exc.InvalidRequestError(
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/engine/util.py\", line 111, in _trans_ctx_check"
   TransactionalContext._trans_ctx_check(session)
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py\", line 929, in __init__"
           ^^^^^^^^^^^^^^^^^^^
   trans = SessionTransaction(
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/orm/session.py\", line 1879, in _autobegin_t"
   session._autobegin_t()
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/orm/state.py\", line 927, in _modified_event"
    state._modified_event(dict_, self, previous)"
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/orm/attributes.py\", line 1520, in fire_replace_event"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    value = self.fire_replace_event(state, dict_, value, old, initiator)"
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/orm/attributes.py\", line 1477, in set"
   self.impl.set(
  File \"/opt/venv/lib/python3.12/site-packages/sqlalchemy/orm/attributes.py\", line 540, in __set__"
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    self.chargingSession.charger = chargerFromLatLonWithGeofence(weConnect=self.vehicle.weConnectVehicle.weConnect, session=self.session,"
  File \"/opt/venv/lib/python3.12/site-packages/vwsfriend/agents/charge_agent.py\", line 385, in updatePosition"
   self.updatePosition()
  File \"/opt/venv/lib/python3.12/site-packages/vwsfriend/agents/charge_agent.py\", line 224, in __onChargingStateChange"
    observer(element=self, flags=self.onCompleteNotifyFlags)"
  File \"/opt/venv/lib/python3.12/site-packages/weconnect/addressable.py\", line 96, in updateComplete"
 [Previous line repeated 3 more times]
   child.updateComplete()
  File \"/opt/venv/lib/python3.12/site-packages/weconnect/addressable.py\", line 533, in updateComplete"
   child.updateComplete()
  File \"/opt/venv/lib/python3.12/site-packages/weconnect/addressable.py\", line 533, in updateComplete"
   child.updateComplete()
  File \"/opt/venv/lib/python3.12/site-packages/weconnect/addressable.py\", line 533, in updateComplete"
   self.updateComplete()
  File \"/opt/venv/lib/python3.12/site-packages/weconnect/weconnect.py\", line 199, in update"
    weConnect.update(updateCapabilities=True, updatePictures=True, force=True, selective=[Domain.ACCESS,"
  File \"/opt/venv/lib/python3.12/site-packages/vwsfriend/vwsfriend_base.py\", line 519, in main"
            ^^^^^^
   sys.exit(main())
  File \"/opt/venv/bin/vwsfriend\", line 8, in <module>"

Tapter avatar Dec 07 '25 20:12 Tapter

Now it won't even start up anymore:

2025-12-12T12:05:34+0100:INFO:weconnect:Server asks for new authorization 
2025-12-12T12:05:35+0100:WARNING:vwsfriend_base:There was a problem when communicating with WeConnect. If this problem persists please open a bug report: Could not find state token in authorization page, will retry after 300s
.. and after a while ..
2025-12-12T23:52:40+0100:INFO:vwsfriend_base:vwsfriend 0.24.10 (using WeConnect-python 0.60.11, WeConnect-mqtt 0.49.5) 
2025-12-12T23:52:40+0100:INFO:session_manager:Could not use token from file /tmp/weconnect.token ([Errno 2] No such file or directory: '/tmp/weconnect.token') 
2025-12-12T23:52:41+0100:CRITICAL:vwsfriend_base:There was a problem when communicating with WeConnect. If this problem persists please open a bug report: No Location header in redirect 

Restarting did not help, but cleaning the container did. It seems there were some leftovers that prevented the container from continuing? Could it have somethign to do with that /tmp/weconnect.token ?

Tapter avatar Dec 12 '25 23:12 Tapter