wez / govee2mqtt

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

Support for H7037 - Outdoor String Lights v2 #272

Open MRobi1 opened 3 months ago

MRobi1 commented 3 months 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 3 months 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 3 months 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 3 months 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 3 months 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 2 months 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 2 months 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.

eboline commented 1 month 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.

How were you able to manually specify the IP? I'm having a similar issue with the H7053 (Outdoor Ground Lights 2) where they pull in but there is no on/off control at all. Looks similar to your screen shot in the OP.

MRobi1 commented 1 month ago

How were you able to manually specify the IP?

In the config you can use scan: 192.X.X.X to specify the IP addresses manually. Once i did that, I gained on/off control.

eboline commented 1 month ago

How were you able to manually specify the IP?

In the config you can use scan: 192.X.X.X to specify the IP addresses manually. Once i did that, I gained on/off control.

Thanks! My apologies for my ignorance on this, but where in the configuration can I specify this particular IP? I added to one spot thinking it was correct, but the then the Add-on wouldn't start. I removed it and it started right back up.

MRobi1 commented 1 month ago

In the HA add on, it's the last text box. Labelled as "Additional IPs and broadcast addresses to scan"

eboline commented 1 month ago

Got it! Thank you! That's where I was putting it, but it wasn't working.

I finally realized it wasn't working because I also had the "Govee Lights Local" integration running as well. As soon as I disabled that, it worked immediately. Thanks again!

mmccool commented 1 month ago

So this partially works now, at least for on-off (and overall color and brightness, e.g. as a "light"), but not scenes or segments. Also when the device shows up, it is as the device model + some hex identifier, e.g. my device name is "H7037_261D" as opposed to what I call it in the app ("Govee LED String 2" - I also have a H7020 which works fine and is discovered as "Govee LED String 1").

I should note that the H7037 was not showing up in the other available API-based govee integrations at all, e.g. "govee" or "goveelife". It WAS showing up in the built-in Govee Local LAN integration, but that does not have segment or scene control and also does not pick up the names from the app (so this integration is at least as good...).