-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
When force update is received the gateway should relogin and update state immediately. IMHO this should apply to all commands to ensure they get executed even if gateway has been logged out.
I suggest adding a async force_login method that can be awaited explicitly to ensure that gateway is logged in.
Scenario
- Another device has logged in and the gateway is logged out.
- I set refresh mode to FORCE for a vehicle from Homeassistant to update vehicle state
- I would like the gateway to
- Relogin immediately without delay
- Update vehicle state
saic-mqtt-gateway | 2025-11-17 12:48:19,081 [ERROR]: API Client was logged out, waiting for a new login - handlers.message
saic-mqtt-gateway | Traceback (most recent call last):
saic-mqtt-gateway | File "/usr/src/app/handlers/message.py", line 44, in __polling
saic-mqtt-gateway | all_messages = await self.__get_all_alarm_messages()
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/handlers/message.py", line 109, in __get_all_alarm_messages
saic-mqtt-gateway | raise e
saic-mqtt-gateway | File "/usr/src/app/handlers/message.py", line 91, in __get_all_alarm_messages
saic-mqtt-gateway | message_list = await self.saicapi.get_alarm_list(
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/message/__init__.py", line 21, in get_alarm_list
saic-mqtt-gateway | return await self.get_message_list(
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/message/__init__.py", line 42, in get_message_list
saic-mqtt-gateway | return await self.execute_api_call_with_optional_result(
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 148, in execute_api_call_with_optional_result
saic-mqtt-gateway | return await self.__execute_api_call(
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 205, in __execute_api_call
saic-mqtt-gateway | raise e
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 203, in __execute_api_call
saic-mqtt-gateway | return await self.__deserialize(req, response, out_type, allow_null_body)
saic-mqtt-gateway | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 355, in __deserialize
saic-mqtt-gateway | raise se
saic-mqtt-gateway | File "/usr/src/app/.venv/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 302, in __deserialize
saic-mqtt-gateway | raise SaicLogoutException(response.text, return_code)
saic-mqtt-gateway | saic_ismart_client_ng.exceptions.SaicLogoutException: return code: 401, message: {"code":401,"message":null}
saic-mqtt-gateway | 2025-11-17 12:48:19,084 [WARNING]: API Client got logged out, logging back in 900 seconds - handlers.relogin
saic-mqtt-gateway | 2025-11-17 12:48:19,099 [INFO]: Added job "Re-login the API client after a set delay" to job store "default" - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:48:19,102 [INFO]: Job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:49:18 CET)" executed successfully - apscheduler.executors.default
saic-mqtt-gateway | 2025-11-17 12:48:19,104 [DEBUG]: Looking for jobs to run - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:48:19,106 [DEBUG]: Next wakeup is due at 2025-11-17 12:49:18.909549+01:00 (in 59.802720 seconds) - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:49:18,911 [DEBUG]: Looking for jobs to run - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:49:18,913 [DEBUG]: Next wakeup is due at 2025-11-17 12:50:18.909549+01:00 (in 59.995855 seconds) - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:49:18,915 [INFO]: Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:50:18 CET)" (scheduled at 2025-11-17 12:49:18.909549+01:00) - apscheduler.executors.default
saic-mqtt-gateway | 2025-11-17 12:49:18,915 [WARNING]: Not checking for new messages as we are waiting to log back in - handlers.message
saic-mqtt-gateway | 2025-11-17 12:49:18,916 [INFO]: Job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:50:18 CET)" executed successfully - apscheduler.executors.default
saic-mqtt-gateway | 2025-11-17 12:50:18,911 [DEBUG]: Looking for jobs to run - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:50:18,913 [DEBUG]: Next wakeup is due at 2025-11-17 12:51:18.909549+01:00 (in 59.996386 seconds) - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:50:18,914 [INFO]: Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:51:18 CET)" (scheduled at 2025-11-17 12:50:18.909549+01:00) - apscheduler.executors.default
saic-mqtt-gateway | 2025-11-17 12:50:18,914 [WARNING]: Not checking for new messages as we are waiting to log back in - handlers.message
saic-mqtt-gateway | 2025-11-17 12:50:18,915 [INFO]: Job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:51:18 CET)" executed successfully - apscheduler.executors.default
saic-mqtt-gateway | 2025-11-17 12:50:21,878 [INFO]: Setting refresh mode to force due to MQTT direct set refresh mode command execution - vehicle
saic-mqtt-gateway | 2025-11-17 12:50:21,879 [DEBUG]: Publishing to MQTT topic saic/***/vehicles/***/refresh/mode with payload force - publisher.mqtt_publisher
saic-mqtt-gateway | 2025-11-17 12:50:21,880 [DEBUG]: Refresh mode set to RefreshMode.FORCE due to MQTT direct set refresh mode command execution - vehicle
saic-mqtt-gateway | 2025-11-17 12:50:21,881 [DEBUG]: Publishing to MQTT topic saic/***/vehicles/***/refresh/mode/result with payload Success - publisher.mqtt_publisher
saic-mqtt-gateway | 2025-11-17 12:51:18,912 [DEBUG]: Looking for jobs to run - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:51:18,914 [DEBUG]: Next wakeup is due at 2025-11-17 12:52:18.909549+01:00 (in 59.995285 seconds) - apscheduler.scheduler
saic-mqtt-gateway | 2025-11-17 12:51:18,915 [INFO]: Running job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:52:18 CET)" (scheduled at 2025-11-17 12:51:18.909549+01:00) - apscheduler.executors.default
saic-mqtt-gateway | 2025-11-17 12:51:18,916 [WARNING]: Not checking for new messages as we are waiting to log back in - handlers.message
saic-mqtt-gateway | 2025-11-17 12:51:18,916 [INFO]: Job "Check for new messages (trigger: interval[0:01:00], next run at: 2025-11-17 12:52:18 CET)" executed successfully - apscheduler.executors.default
Metadata
Metadata
Assignees
Labels
No labels