cdpuk / ha-bestway

Home Assistant integration for Bestway / Lay-Z-Spa hot tubs
MIT License
59 stars 15 forks source link

User account does not exist #21

Closed luotinen closed 1 year ago

luotinen commented 1 year ago

I registered a Bestway account in Finland and it works over the phone using the app. However, the integration reports "User account does not exist" under same credentials. I tried both the EU and US access points for the API. Most likely the nordic countries have their own AP.

Then following the instructions, I made another account in Germany, which definitely is in EU. However, I get the same error, "User account does not exist". And with the new account it works fine using the app on the phone.

  1. How can I determine the nordic API server location?
  2. Can I extract logs or help in some other way?
luotinen commented 1 year ago

I tried one more time, this time making the account in USA and selecting the US server => "User account does not exist" and it works perfectly using the mobile app.

cdpuk commented 1 year ago

Can I just check that it's the Bestway app you're using? (not the Lay-Z-Spa app)

It's possible the app is directing your requets to yet another local API but it's quite hard to tell. A packet capture would probably reveal the DNS requests and therefore the endpoint to hit, but that's a relatively complicated thing to set up if you're new to that sort of thing.

Alternatively a bit more internet research might find someone that's worked it out.

Happy to keep this on the backlog but it's not something I'll be prioritising as it's likely to be quite fiddly to investigate from the UK.

quazzie commented 1 year ago

Same here in Sweden. "User account does not exist". Tried to setup a wireshark capture from my unifi access point to try to capture my phones traffic but all i saw was some tls and quic captures that where encrypted. Could not locate a dns name or ip. But i am a very novice wireshark user..

quazzie commented 1 year ago

Collected some information via Http Toolkit. All http calls from app goes to: https://usapi.gizwits.com/app/*

First request gets some server info:

METHOD: GET
URL
https://usapi.gizwits.com/app/domains?tz=Europe/Stockholm
HEADERS
connection:
keep-alive
content-length:
0
host:
usapi.gizwits.com
language:
zh-CN
user-agent:
GizWifiSDK (v21.22091313)

Response:
{
  "push": "eupush.gizwits.com",
  "api": "euapi.gizwits.com",
  "site": "eusite.gizwits.com"
}

Hope it helps. If you need more please tell.

quazzie commented 1 year ago

Even more info /app/bindings, there is a "host" key that may be of value:

METHOD: GET
URL
https://usapi.gizwits.com/app/bindings?show_disabled=0&limit=200&skip=0
HEADERS
connection: keep-alive
content-length: 0
content-type: application/json
host: usapi.gizwits.com
language: zh-CN
user-agent: GizWifiSDK (v21.22091313)
x-gizwits-application-id: *****c045528b073876c34c7348
x-gizwits-user-token: ****************

Response:
{
  "devices": [
    {
      "protoc": 3,
      "ws_port": 8080,
      "port_s": 8883,
      "gw_did": null,
      "host": "usm2m.gizwits.com",
      "sleep_duration": 3600,
      "port": 1883,
      "mcu_soft_version": "P182D102",
      "product_key": "*****03419b9c2a09c71584c***",
      "state_last_timestamp": 1686044406,
      "role": "owner",
      "is_sandbox": false,
      "type": "normal",
      "product_name": "Airjet",
      "is_disabled": false,
      "mcu_hard_version": "P180D100",
      "wifi_soft_version": "0402003A",
      "dev_alias": "Milan",
      "mesh_id": null,
      "is_online": true,
      "dev_label": [],
      "wss_port": 8880,
      "remark": "21",
      "did": "********0iuHj7man4*****",
      "mac": "bc**4d**e7**",
      "passcode": "**********",
      "wifi_hard_version": "00ESP826",
      "is_low_power": false
    }
  ]
}
quazzie commented 1 year ago

Weird! Now the "US" option worked when adding integration.

cdpuk commented 1 year ago

The SDK docs suggest that the EU and US endpoints are the only ones, as reflected in the integration. Has @luotinen made any progress? https://docs.gizwits.com/en-us/UserManual/GlobalDeployment.html

This may need closing until someone can get a capture from an affected location and demonstrate what might need changing.

cdpuk commented 1 year ago

Closing until someone can perform further investigation to identify a cause