Closed jcristof closed 7 months ago
Found the problem, the WSS_URL used by My Fisker app is:
"wss://gw.cec-prd.fiskerinc.com/mobile"
I guess they are different depending on region. Changing that in const.py made it work. I guess region could be added as a configuration option.
Added region selector in v0.0.7
Thank you for working on a Home Assistant integration!
I've tried installing version 0.0.6 via HACS, but it seems my account is returning unexpectedly empty data for the profiles request, causing a parsing error.
I added some debug logging and here's what I'm seeing:
024-02-16 20:27:41.906 DEBUG (MainThread) [custom_components.my_fisker.config_flow] api.GetProfiles() 2024-02-16 20:27:42.415 DEBUG (MainThread) [custom_components.my_fisker.api] Start GenerateVerifyRequest() 2024-02-16 20:27:42.415 DEBUG (MainThread) [custom_components.my_fisker.api] GenerateVerifyRequest(): messageData={'data': {'token': ''}, 'handler': 'verify'}
2024-02-16 20:27:42.742 DEBUG (MainThread) [custom_components.my_fisker.api] Received response:
{"handler":"verify","data":{"authenticated":true}}
2024-02-16 20:27:42.742 DEBUG (MainThread) [custom_components.my_fisker.api] Sending 'GenerateProfilesRequest'
2024-02-16 20:27:42.742 DEBUG (MainThread) [custom_components.my_fisker.api] Start GenerateProfilesRequest()
2024-02-16 20:27:42.743 DEBUG (MainThread) [custom_components.my_fisker.api] GenerateProfilesRequest(): messageData={'handler': 'profiles'}
2024-02-16 20:27:43.153 DEBUG (MainThread) [custom_components.my_fisker.api] Received response:
{"handler":"profiles","data":[]}
2024-02-16 20:27:43.307 DEBUG (MainThread) [custom_components.my_fisker.api] Start ParseProfilesResponse()
2024-02-16 20:27:43.308 INFO (MainThread) [custom_components.my_fisker.api] data: {'handler': 'profiles', 'data': []}
2024-02-16 20:27:43.308 ERROR (MainThread) [custom_components.my_fisker.config_flow] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/my_fisker/config_flow.py", line 75, in async_step_user
self._userInput["vin"] = await validate_login(
^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/my_fisker/config_flow.py", line 47, in validate_login
vin = await api.GetProfiles()
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/my_fisker/api.py", line 67, in GetProfiles
self.data["profiles"] = self.ParseProfilesResponse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/my_fisker/api.py", line 149, in ParseProfilesResponse
item1 = data["data"][0]["vin"]