wez / govee2mqtt

Govee2MQTT: Connect Govee lights and devices to Home Assistant
MIT License
426 stars 24 forks source link

govee::undoc_api::DeviceSettings supportBleBroadV3: unknown field #218

Closed yorickvP closed 3 months ago

yorickvP commented 3 months ago

Govee Device SKU

H6056

Govee2MQTT Version

2024.06.12-202b5295

Describe the issue

When starting with the undocumented API, parsing an API response fails.

Startup Diagnostics

❯ govee --mqtt-host localhost --govee-email my@email.com --govee-password 1234password serve
[2024-06-12T16:08:26 INFO  govee::commands::serve] Starting service. version 2024.06.12-202b5295
[2024-06-12T16:08:26 INFO  govee::commands::serve] Querying undocumented API for device + room list
Error: request https://app2.govee.com/device/rest/devices/v1/list status 200: OK

Caused by:
    0: parsing https://app2.govee.com/device/rest/devices/v1/list response
    1: govee::undoc_api::DevicesResponse devices[0].deviceExt.deviceSettings: govee::undoc_api::DeviceSettings govee::undoc_api::DeviceSettings supportBleBroadV3: unknown field `supportBleBroadV3`, expected one of `wifiName`, `address`, `bleName`, `topic`, `wifiMac`, `pactType`, `pactCode`, `dspVersionSoft`, `wifiSoftVersion`, `wifiHardVersion`, `ic`, `ic_sub_1`, `ic_sub_2`, `secretCode`, `boilWaterCompletedNotiOnOff`, `boilWaterExceptionNotiOnOff`, `completionNotiOnOff`, `autoShutDownOnOff`, `waterShortageOnOff`, `airQualityOnOff`, `mcuSoftVersion`, `mcuHardVersion`, `sku`, `device`, `deviceName`, `versionHard`, `versionSoft`, `playState`, `temMin`, `temMax`, `temWarning`, `fahOpen`, `temCali`, `humMin`, `humMax`, `humWarning`, `humCali`, `netWaring`, `uploadRate`, `battery`, `time`, `wifiLevel`, `pm25Min`, `pm25Max`, `pm25Warning`, `subDevices`, `bdType`, `filterExpireOnOff`, `shapes` at line 1 column 359. Input: {"wifiName":"insert_wifi_name","address":"CF:32:34:38:52:53","bleName":"Govee_H6056_5253","topic":"CENSORED","wifiMac":"60:74:F4:EC:EB:FA","pactType":2,"pactCode":1,"wifiSoftVersion":"2.05.16","wifiHardVersion":"1.02.00","ic":0,"boilWaterCompletedNotiOnOff":1,"completionNotiOnOff":1,"autoShutDownOnOff":1,"supportBleBroadV3":true,"sku":"H6056","device":"F9:AC:CF:32:34:38:52:53","deviceName":"RGBIC TV Light Bars","versionHard":"3.02.01","versionSoft":"1.10.02","playState":false} while processing embedded json text {"wifiName":"insert_wifi_name","address":"CF:32:34:38:52:53","bleName":"Govee_H6056_5253","topic":"CENSORED","wifiMac":"60:74:F4:EC:EB:FA","pactType":2,"pactCode":1,"wifiSoftVersion":"2.05.16","wifiHardVersion":"1.02.00","ic":0,"boilWaterCompletedNotiOnOff":1,"completionNotiOnOff":1,"autoShutDownOnOff":1,"supportBleBroadV3":true,"sku":"H6056","device":"F9:AC:CF:32:34:38:52:53","deviceName":"RGBIC TV Light Bars","versionHard":"3.02.01","versionSoft":"1.10.02","playState":false} at line 1 column 778. Input: {"devices":[{"groupId":0,"device":"F9:AC:CF:32:34:38:52:53","sku":"H6056","spec":"","versionHard":"3.02.01","versionSoft":"1.10.02","deviceName":"RGBIC TV Light Bars","deviceExt":{"deviceSettings":"{\"wifiName\":\"insert_wifi_name\",\"address\":\"CF:32:34:38:52:53\",\"bleName\":\"Govee_H6056_5253\",\"topic\":\"CENSORED\",\"wifiMac\":\"60:74:F4:EC:EB:FA\",\"pactType\":2,\"pactCode\":1,\"wifiSoftVersion\":\"2.05.16\",\"wifiHardVersion\":\"1.02.00\",\"ic\":0,\"boilWaterCompletedNotiOnOff\":1,\"completionNotiOnOff\":1,\"autoShutDownOnOff\":1,\"supportBleBroadV3\":true,\"sku\":\"H6056\",\"device\":\"F9:AC:CF:32:34:38:52:53\",\"deviceName\":\"RGBIC TV Light Bars\",\"versionHard\":\"3.02.01\",\"versionSoft\":\"1.10.02\",\"playState\":false}","lastDeviceData":"{\"online\":false}","extResources":"{\"skuUrl\":\"https://d1f2504ijhdyjw.cloudfront.net/sku-img/ce4d2c645d0a94ce994bdd8e13044985-add_list_type_device_6056.png\",\"headOnImg\":\"https://d1f2504ijhdyjw.cloudfront.net/sku-img/14f4fde7773117ad3088874870b0da7e-new_light_title_6056_on.png\",\"headOnImgNew\":\"\",\"headOffImg\":\"https://d1f2504ijhdyjw.cloudfront.net/sku-img/14f4fde7773117ad3088874870b0da7e-new_light_title_6056_off.png\",\"headOffImgNew\":\"\",\"ext\":\"\",\"ic\":0}"},"pactType":2,"pactCode":1,"share":0,"deviceId":21726576,"gidConfirmed":true,"goodsType":52,"attributesId":22,"supportScene":0}],"groups":[{"groupId":20075995,"groupName":"Bedroom"},{"groupId":20075996,"groupName":"Living Room"}],"sort":[{"columnId":0,"deviceIdStr":[21726576]}],"sortTime":1718199251317,"message":"","status":200}

Additional Logs

No response

Home Assistant Logs

No response

Anything else?

No response

yorickvP commented 3 months ago
diff --git a/src/undoc_api.rs b/src/undoc_api.rs
index d583e32..ac7d0e8 100644
--- a/src/undoc_api.rs
+++ b/src/undoc_api.rs
@@ -763,6 +763,7 @@ pub struct DeviceEntry {
     pub support_scene: bool,
     pub version_hard: String,
     pub version_soft: String,
+    pub gid_confirmed: Option<bool>,
 }

 impl DeviceEntry {
@@ -862,6 +863,7 @@ pub struct DeviceSettings {

     /// eg: Glide Hexa. Value is base64 encoded data
     pub shapes: Option<String>,
+    pub support_ble_broad_v3: Option<bool>,
 }

 #[derive(Deserialize, Debug, Clone)]