wez / govee2mqtt

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

Support for H7037 - Outdoor String Lights v2 #272

Open MRobi1 opened 2 weeks ago

MRobi1 commented 2 weeks ago

Govee Device SKU

H7037

Govee2MQTT Version

2024.07.13-82ddc6e9

Describe the issue

Wondering if support could be added for the H7037 Outdoor String Lights 2.

image It gets detected by the addon, but no controls are available.

Startup Diagnostics

[2024-08-26T13:33:34 INFO  govee::commands::serve] H7037_6F80 (0B:86:C9:F0:85:C6:6F:80 H7037)
[2024-08-26T13:33:34 INFO  govee::commands::serve]   Undoc: room=None supports_iot=true ble_only=false
[2024-08-26T13:33:34 WARN  govee::commands::serve]   Unknown device type. Cannot map to Home Assistant.
[2024-08-26T13:33:34 INFO  govee::commands::serve] 

Additional Logs

No response

Home Assistant Logs

No response

Anything else?

No response

iamamoose commented 2 weeks ago

I have the H7037 outdoor string lights and they work with LAN API just fine using the HACS version 2024.07.13-82ddc6e9. They appear as a single light though, so you can turn them on and off and control the colour, but not scenes etc.

[2024-08-26T03:23:31 TRACE govee::commands::serve] UndocDeviceInfo { ...         support_scene: false,

[2024-08-26T02:46:06 TRACE govee::service::state] Platform API unavailable: Don't know how to list scenes for H7037_1985 (39:DB:C9:F0:85:C6:19:85 H7037)

I tried editing qwirks to add them as a string light, but I still get the same response 'don't know how to list scenes'. I can poke more into the code I just haven't seen this codebase before so not sure if there's some guide on how to add support for new LAN enabled devices.

iamamoose commented 2 weeks ago

[2024-08-26T13:33:34 INFO govee::commands::serve] H7037_6F80 (0B:86:C9:F0:85:C6:6F:80 H7037) [2024-08-26T13:33:34 INFO govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-08-26T13:33:34 WARN govee::commands::serve] Unknown device type. Cannot map to Home Assistant. [2024-08-26T13:33:34 INFO govee::commands::serve]

You don't have a LAN_API line... do you have local access enabled in the app for the lights? Here's my log

[2024-08-26T03:28:52 ^[[32mINFO ^[[0m govee::commands::serve] [2024-08-26T03:28:52 ^[[32mINFO ^[[0m govee::commands::serve] H7037_1985 (39:DB:C9:F0:85:C6:19:85 H7037) [2024-08-26T03:28:52 ^[[32mINFO ^[[0m govee::commands::serve] LAN API: ip=192.168.0.103 [2024-08-26T03:28:52 ^[[32mINFO ^[[0m govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-08-26T03:28:52 ^[[36mTRACE^[[0m govee::commands::serve] UndocDeviceInfo {

MRobi1 commented 2 weeks ago

I have the H7037 outdoor string lights and they work with LAN API just fine using the HACS version 2024.07.13-82ddc6e9. They appear as a single light though, so you can turn them on and off and control the colour, but not scenes etc.

Using the exact same version and they don't appear as a single light with on/off for me.

You don't have a LAN_API line... do you have local access enabled in the app for the lights? Here's my log

You're correct, I do not have a LAN_API line. And yes the LAN Control toggle is ON in the govee app.

[2024-08-26T21:00:18 INFO  govee::commands::serve] H7037_6F80 (0B:86:C9:F0:85:C6:6F:80 H7037)
[2024-08-26T21:00:18 INFO  govee::commands::serve]   Undoc: room=None supports_iot=true ble_only=false
[2024-08-26T21:00:18 WARN  govee::commands::serve]   Unknown device type. Cannot map to Home Assistant.
iamamoose commented 2 weeks ago

A bit more investigation:

--lan-control works for on/off and colour, but not scene.

curl "https://app2.govee.com/appsku/v1/light-effect-libraries?sku=H7037" -H 'AppVersion: 5.6.01' -s returns a list of plausible looking scene IDs for the lights. Twilight for example is 11008 (0x2b00) but sending that scene directly doesn't make any change to the lights.

$target/debug/govee ... lan-control --ip 192.168.0.103 scene Twilight ... [2024-08-26T23:54:40 TRACE govee::cache] cache hit for scenes-H7037 Computed MwUEACsAAAAAAAAAAAAAAAAAABk= [2024-08-26T23:54:40 TRACE govee::lan_api] LanDevice::send_request to 192.168.0.103 PtReal { command: ["MwUEACsAAAAAAAAAAAAAAAAAABk="] }

And that base64 string looks okay too:

33 05 04 00 2b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 19 which matches what I'd expect from https://github.com/bwp91/homebridge-govee/issues/694

So maybe the govee api is sending the wrong scene id codes for this device?

MRobi1 commented 1 week ago

lan-control works for on/off and colour, but not scene.

I did get the on/off control by manually specifying the IP. It doesn't pick up just on discovery. Can confirm no scene control.

iamamoose commented 1 week ago

Well I figured out how to change scene by sniffing bt, but it's odd, and I've not found any write up of the 0xa3 command to dig further.

So sending an extended packet thing before selecting the scene works and you can change scenes.... this minimal example changes to twlight.

debug/govee lan-control --ip=192.168.0.100 command 0xa3 0x00 0x01 0x03 0x02 0x01 0x20 0x00 0x00 0x00 0x01 0x00 0x01 0xff 0x4c 0x03 0xca 0x08 0x05 debug/govee lan-control --ip=192.168.0.100 command 0xa3 0x01 0x00 0xcb 0x05 0x03 0xff 0xbf 0x07 0xff 0x7f 0x00 0xff 0x60 0x07 0x00 0x00 0xff debug/govee lan-control --ip=192.168.0.100 command 0xa3 0xff 0x00 0xed 0x01 debug/govee lan-control --ip=192.168.0.100 command 0x33 0x05 0x04 0x00 0x2b

but without those 0xa3's it doesn't change mode. And it seems to then ignore the scene code as changing 0x00 0x2b (twilight) to some other valid scene and you still get twilight.