webdjoe / pyvesync

pyvesync is a python library to manage Etekcity & Levoit smart devices
MIT License
168 stars 77 forks source link

No outlets visible after update #191

Closed narbehaj closed 1 year ago

narbehaj commented 1 year ago

I tried the following but I see no devices in the outlets list.

debug mode:

In [9]: manager = VeSync("MY_EMAIL", "PASS", "Europe/Berlin", debug=True, redact=True)

In [10]: manager.login()
2023-06-14 11:30:22,247 - DEBUG - =======call_api=============================
2023-06-14 11:30:22,247 - DEBUG - [post] calling '/cloud/v1/user/login' api
2023-06-14 11:30:22,247 - DEBUG - API call URL:
  https://smartapi.vesync.com/cloud/v1/user/login
2023-06-14 11:30:22,247 - DEBUG - API call headers:
  null
2023-06-14 11:30:22,247 - DEBUG - API call json:
  {"timeZone": "Europe/Berlin", "acceptLanguage": "en", "appVersion": "2.8.6", "phoneBrand": "SM N9000", "phoneOS": "Android", "traceId": "1686735023", "email": "##_REDACTED_##", "password": "##_REDACTED_##", "devToken": "", "userType": "1", "method": "login"}
2023-06-14 11:30:22,762 - DEBUG - API response:

  {"traceId": "1686735022", "code": 0, "msg": "request success", "result": {"isRequiredVerify": true, "accountID": "##_REDACTED_##", "avatarIcon": "https://image.vesync.com/defaultImages/user/avatar_nor.png", "birthday": "", "gender": "", "acceptLanguage": "en", "userType": "1", "nickName": "username", "mailConfirmation": true, "termsStatus": true, "gdprStatus": true, "countryCode": "DE", "registerAppVersion": "4.3.31", "registerTime": "2023-06-13 16:39:21", "verifyEmail": "##_REDACTED_##", "heightCm": 0.0, "weightTargetSt": 0.0, "heightUnit": "FT", "heightFt": 0.0, "weightTargetKg": 0.0, "weightTargetLb": 0.0, "weightUnit": "LB", "targetBfr": 0.0, "displayFlag": [], "real_weight_kg": 0.0, "real_weight_lb": 0.0, "real_weight_unit": "lb", "heart_rate_zones": 0.0, "run_step_long_cm": 0.0, "walk_step_long_cm": 0.0, "step_target": 0.0, "sleep_target_mins": 0.0, "token": "##_REDACTED_##"}}

2023-06-14 11:30:22,765 - DEBUG - Login successful
2023-06-14 11:30:22,765 - DEBUG - token my-token
2023-06-14 11:30:22,765 - DEBUG - account_id 99999

In [13]: manager.update()
2023-06-14 11:30:50,432 - DEBUG - =======call_api=============================
2023-06-14 11:30:50,432 - DEBUG - [post] calling '/cloud/v1/deviceManaged/devices' api
2023-06-14 11:30:50,432 - DEBUG - API call URL:
  https://smartapi.vesync.com/cloud/v1/deviceManaged/devices
2023-06-14 11:30:50,432 - DEBUG - API call headers:
  {"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"}
2023-06-14 11:30:50,433 - DEBUG - API call json:
  {"timeZone": "Europe/Berlin", "acceptLanguage": "en", "accountID": "##_REDACTED_##", "token": "##_REDACTED_##", "appVersion": "2.8.6", "phoneBrand": "SM N9000", "phoneOS": "Android", "traceId": "1686735052", "method": "devices", "pageNo": "1", "pageSize": "100"}
2023-06-14 11:30:50,940 - DEBUG - API response:

  {"traceId": "1686735052", "code": 0, "msg": "request success", "module": null, "stacktrace": null, "result": {"total": 1, "pageSize": 100, "pageNo": 1, "list": [{"deviceRegion": "EU", "isOwner": true, "authKey": null, "deviceName": "mydevice", "deviceImg": "https://image.vesync.com/defaultImages/deviceDefaultImages/wifibtonboardingnotify_airpurifier_core300s_eu_240.png", "cid": "##_REDACTED_##", "deviceStatus": "on", "connectionStatus": "online", "connectionType": "WiFi+BTOnboarding+BTNotify", "deviceType": "Core300S", "type": "wifi-air", "uuid": "##_REDACTED_##", "configModule": "WiFiBTOnboardingNotify_AirPurifier_Core300S_EU", "macID": "##_REDACTED_##", "mode": null, "speed": null, "currentFirmVersion": null, "subDeviceNo": null, "subDeviceType": null, "deviceFirstSetupTime": "Jun 13, 2023 4:43:04 PM", "subDeviceList": null, "extension": {"airQuality": -1, "airQualityLevel": 1, "mode": "auto", "fanSpeedLevel": "1"}, "deviceProp": null}]}}

2023-06-14 11:30:50,942 - DEBUG - New device list initialized
2023-06-14 11:30:50,942 - DEBUG - Start updating the device details one by one
2023-06-14 11:30:50,942 - DEBUG - =======call_api=============================
2023-06-14 11:30:50,942 - DEBUG - [post] calling '/cloud/v2/deviceManaged/bypassV2' api
2023-06-14 11:30:50,942 - DEBUG - API call URL:
  https://smartapi.vesync.com/cloud/v2/deviceManaged/bypassV2
2023-06-14 11:30:50,943 - DEBUG - API call headers:
  {"Content-Type": "application/json; charset=UTF-8", "User-Agent": "okhttp/3.12.1"}
2023-06-14 11:30:50,943 - DEBUG - API call json:
  {"timeZone": "Europe/Berlin", "acceptLanguage": "en", "accountID": "##_REDACTED_##", "token": "##_REDACTED_##", "appVersion": "2.8.6", "phoneBrand": "SM N9000", "phoneOS": "Android", "traceId": "1686735050", "method": "bypassV2", "debugMode": false, "deviceRegion": "US", "cid": "##_REDACTED_##", "configModule": "WiFiBTOnboardingNotify_AirPurifier_Core300S_EU", "payload": {"method": "getPurifierStatus", "source": "APP", "data": {}}}
2023-06-14 11:30:51,608 - DEBUG - API response:

  {"traceId": "1686735052", "code": 0, "msg": "request success", "module": null, "stacktrace": null, "result": {"traceId": "1686735052", "code": 0, "result": {"enabled": true, "filter_life": 100, "mode": "auto", "level": 1, "air_quality": 1, "air_quality_value": 4, "display": true, "child_lock": false, "configuration": {"display": true, "display_forever": true, "auto_preference": {"type": "default", "room_size": 100}}, "device_error_code": 0}}}

In [14]: manager.outlets
Out[14]: []
webdjoe commented 1 year ago

It looks like your device list only has the core300s air purifier. Are the outlets showing up in the app?

narbehaj commented 1 year ago

I can see the 300s in the app, but wondering why it's not in the manager.outlets list which is empty

sdrapha commented 1 year ago

the 300s is not an outlet. Try manager.fans instead. or manager.fans[0]

narbehaj commented 1 year ago

Perfect and thanks for this API!