radical-squared / aquatemp

Home Assistant AquaTemp Heat Pump Climate Entity
33 stars 9 forks source link

AquaTemp Integration not returning any devices #82

Closed Know1 closed 5 months ago

Know1 commented 6 months ago

I have setup a new aquatemp/pool heater and have it connecting fine to the mobile app (Android) I created a second user that will be used for HomeAssistant, to avoid the logout issue, and shared the device to them and signed into the app confirming I could see the pool heater and operate it correctly.

I then setup Aquatemp integration via HACS as per the docs and it all went smoothly except no devices or entities were populated. image Configuring confirms the creds work image image

So I enabled debug logs and can confirm the login looks correct just it's not returning any devices

2024-03-14 14:39:02.898 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-03-14 14:39:02.899 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration aqua_temp which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-03-14 14:39:07.551 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hacs' accesses hass.components.frontend. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to import functions used from frontend directly at custom_components/hacs/frontend.py, line 68: hass.components.frontend.async_register_built_in_panel(, please create a bug report at https://github.com/hacs/integration/issues
2024-03-14 14:49:51.590 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] Initializing API, Throw Error: True
2024-03-14 14:49:51.590 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] No token available, Login AquaTemp API and fetching devices
2024-03-14 14:49:52.864 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] Request to https://cloud.linked-go.com:449/crmservice/api/app/user/login, Body: {'userName': 'hacs@********.com', 'password': '********'}, Result: {'sessionid': None, 'error_code': '0', 'error_msg': 'Success', 'error_msg_code': '', 'totalSize': None, 'totalPage': None, 'nextPage': None, 'objectResult': {'userId': '1752623043488665601', 'userName': 'h****s@********.com', 'nickName': 'hacs', 'realName': None, 'userPassword': None, 'x-token': '***********', 'user_id': '1752623043488665601', 'user_name': 'h****s@********.com', 'nick_name': 'hacs', 'real_name': None, 'user_type': 'Customer', 'accessKey': '********'}, 'isReusltSuc': True}
2024-03-14 14:49:53.162 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] Request to https://cloud.linked-go.com:449/crmservice/api/app/user/getUserInfo, Body: None, Result: {'sessionid': None, 'error_code': '0', 'error_msg': 'Success', 'error_msg_code': '', 'totalSize': None, 'totalPage': None, 'nextPage': None, 'objectResult': {'birthday': None, 'img': None, 'address': None, 'nickName': 'hacs', 'user_name': None, 'sex': None, 'userName': None, 'userId': '1752623043488665601', 'realName': None, 'phone': '', 'user_id': '1752623043488665601', 'nick_name': 'hacs', 'email': 'h****s@********.com'}, 'isReusltSuc': True}
2024-03-14 14:49:53.460 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] Request to https://cloud.linked-go.com:449/crmservice/api/app/device/deviceList, Body: {'productIds': ['1132174963097280512', '1245226668902080512', '1186904563333062656', '1158905952238313472', '1442284873216843776', '1548963836789501952'], 'pageIndex': 1, 'pageSize': 999}, Result: {'sessionid': None, 'error_code': '0', 'error_msg': 'Success', 'error_msg_code': '', 'totalSize': None, 'totalPage': None, 'nextPage': None, 'objectResult': [], 'isReusltSuc': True}
2024-03-14 14:49:53.764 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] Request to https://cloud.linked-go.com:449/crmservice/api/app/device/getMyTobeAppectDeviceShareDataList, Body: {'productIds': ['1132174963097280512', '1245226668902080512', '1186904563333062656', '1158905952238313472', '1442284873216843776', '1548963836789501952'], 'toUser': '1752623043488665601'}, Result: {'sessionid': None, 'error_code': '0', 'error_msg': 'Success', 'error_msg_code': '', 'totalSize': None, 'totalPage': None, 'nextPage': None, 'objectResult': [], 'isReusltSuc': True}
2024-03-14 14:49:54.071 DEBUG (MainThread) [custom_components.aqua_temp.managers.aqua_temp_api] Request to https://cloud.linked-go.com:449/crmservice/api/app/device/getMyAppectDeviceShareDataList, Body: {'productIds': ['1132174963097280512', '1245226668902080512', '1186904563333062656', '1158905952238313472', '1442284873216843776', '1548963836789501952'], 'toUser': '1752623043488665601', 'pageIndex': 1, 'pageSize': 999}, Result: {'sessionid': None, 'error_code': '0', 'error_msg': 'Success', 'error_msg_code': '', 'totalSize': None, 'totalPage': None, 'nextPage': None, 'objectResult': [], 'isReusltSuc': True}
2024-03-14 14:49:54.071 DEBUG (MainThread) [custom_components.aqua_temp.managers.flow_manager] User inputs are valid
2024-03-14 14:49:57.454 INFO (MainThread) [custom_components.aqua_temp.managers.flow_manager] Config flow started, Step: user, Input: None

In an effort to confirm I dumped network traffic from my phone and confirmed the host and port being accessed are still correct/unchanged but because of Android security I can't see what URLs are being hit or the cleartext data being returned, just TLS encrypted packets image

I also looked at your and the original dst6se repos to try figure out what URLs it was calling and knocked up some raw curl calls and confirmed that yes it does appear to login correctly and no it's not returning any devices.

curl -s -H "Content-Type: application/json" -H "x-token: ********" -X POST https://cloud.linked-go.com:449/crmservice/api/app/device/deviceList
{
    "sessionid": null,
    "error_code": "0",
    "error_msg": "Success",
    "error_msg_code": "",
    "totalSize": null,
    "totalPage": null,
    "nextPage": null,
    "objectResult": [],
    "isReusltSuc": true
}

I suspect because it's a relatively new model (heater was installed Feb 2024) there's new code or similar, but without being able to test the API I can't confirm. Hopefully you're able to point me in the right direction.

Thanks

Know1 commented 5 months ago

OK after some messing around with an old Android I have grabbed the App traffic. I think the key piece missing is "productId": "1656269521923575808"

If I look at the array on line 27 of custom_components/aqua_temp/common/consts.py it's not in there. Temp Sensor (and App) is AquaTemp but the heater is an AstralPool Viron iHP 283 if it matters.

Not sure what normal codes looks like but this is what it wanted (yes the req really was "protocalCodes") { "deviceCode": "", "protocalCodes": [ "Power", "Mode", "Manual-mute", "T02", "2074", "2075", "2076", "2077", "H03", "Set_Temp", "R08", "R09", "R10", "R11", "R01", "R02", "R03", "T03", "1158", "1159", "F17", "H02", "2064" ] }

Response was of the form { "sessionid": null, "error_code": "0", "error_msg": "Success", "error_msg_code": "", "totalSize": null, "totalPage": null, "nextPage": null, "objectResult": [ { "value": "0", "code": "Power" }, { "value": "1", "code": "Mode" }, { "value": "0", "code": "Manual-mute" }, { "value": "18.2", "code": "T02" }, { "value": "0000000000000000", "code": "2074" }, { "value": "0000000000000000", "code": "2075" }, { "value": "0000000000000000", "code": "2076" }, { "value": "0000000000000000", "code": "2077" }, { "value": "0", "code": "H03" }, { "value": "32.0", "code": "Set_Temp" }, { "value": "8.0", "code": "R08" }, { "value": "35.0", "code": "R09" }, { "value": "15.0", "code": "R10" }, { "value": "40.0", "code": "R11" }, { "value": "27.0", "code": "R01" }, { "value": "32.0", "code": "R02" }, { "value": "27.0", "code": "R03" }, { "value": "18.4", "code": "T03" }, { "value": "0", "code": "1158" }, { "value": "0", "code": "1159" }, { "value": "0", "code": "F17" }, { "value": "1", "code": "H02" }, { "value": "0", "code": "2064" } ], "isReusltSuc": true }

I'll have a play around and see if it's enough to just update the array or more is required, but hopefully it helps. Thanks

Know1 commented 5 months ago

Also not sure if there's a later App or what but the various request now also pass in the body this list of ProductIDs "productIds": [ "1132174963097280512", "1656269521923575808", "1663080854333558784", "1596427678569979904", "1674238226096406528", "1650063968998252544", "1668781858447085568", "1186904563333062656", "1158905952238313472", "1442284873216843776", "1732565142225256450", "1548963836789501952", "1669159229372477440", "1650758828508766208", "1664085465655808000" ]

I've bolded the ones not in source which includes mine.

Know1 commented 5 months ago

Confirmed just needed to update productIds in consts.py and integreation can now discover the newer device.

Submitting PR to include newer productIds