wez / govee2mqtt

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

H5080 Govee Smart Switches #29

Closed gscott16 closed 10 months ago

gscott16 commented 10 months ago

Wez, great work on this new integration and thank you. I migrated today from your old integration to this new one. I really like what I see. The one question I have is the behavior of the Govee H5080 smart plugs. They show up in the Intergration but they are not controllable through the UI. The PowerSwitch doesn’t seem to change the state (aka sliding it on does not turn it on, sliding it off does not turn it off). This behavior is consistent across the three plugs I tested. Interestingly, the UI does report the correct current state of the device. I can control them through the GOVEE app directly.

wez commented 10 months ago

Please share the logs from the addon

gscott16 commented 10 months ago

Here is the Log segment

[2024-01-07T16:59:12 INFO govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted. [2024-01-07T17:05:56 INFO govee::service::hass] powerSwitch for E33E9C04A094C4CD: OFF [2024-01-07T17:07:32 INFO govee::service::hass] powerSwitch for E33E9C04A094C4CD: ON [2024-01-07T17:23:48 INFO govee::commands::serve] requesting update via IoT MQTT Office Christmas House (E3:3E:9C:04:A0:94:C4:CD) Some(DeviceState { on: true, online: None, kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "AWS IoT API", updated: 2024-01-07T23:07:50.552622088Z })

gscott16 commented 10 months ago

The plug is current on… If I slide the switch to the off position in the HA UI, the following message gets posted to the Log. [2024-01-07T17:34:53 INFO govee::service::hass] powerSwitch for E33E9C04A094C4CD: OFF

Nothing happens on the device and a few seconds later the UI moves the switch back to ON.

Those messages are not posted to the LOG at the current logging level

wez commented 10 months ago

Please set the debug level to govee::commands::serve=trace,info and restart the addon, then share the logs from when it first starts up

gscott16 commented 10 months ago

Thanks Wez. Here is the log but I don’t think it’s complete. I noticed that if I refresh the log some of the log data disappears and I am not handy enough with home assistant to know exactly how to change the log size…

One of the 5080 plugs is in the log - Garage Meross Plug.

I can send you some more details if you can share some hints on how to expand the size of the log…

click to see logs ``` s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started GOVEE_API_KEY=REDACTED GOVEE_MQTT_HOST=core-mosquitto GOVEE_EMAIL=REDACTED GOVEE_PASSWORD=REDACTED GOVEE_MQTT_PASSWORD=REDACTED GOVEE_MQTT_USER=addons GOVEE_MQTT_PORT=1883 ++ cd /app ++ exec /app/govee serve [2024-01-07T20:26:49 INFO govee::commands::serve] Starting service. version 2024.01.07-92fb55e0 [2024-01-07T20:26:49 INFO govee::commands::serve] Querying platform API for device list [2024-01-07T20:26:50 INFO govee::commands::serve] Querying undocumented API for device + room list [2024-01-07T20:26:51 INFO govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted. [2024-01-07T20:26:51 INFO govee::commands::serve] Starting LAN discovery [2024-01-07T20:26:51 INFO govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted. "https://d1f2504ijhdyjw.cloudfront.net/sku-img/44f3254022e71f9376552f2080fbc0f0-new_switch_pics_5080_off.png", ), head_off_img_new: Some( "", ), ext: Some( "", ), ic: Some( 0, ), }, last_device_data: LastDeviceData { online: false, tem: None, hum: None, last_time: None, avg_day_tem: None, avg_day_hum: None, }, }, device_name: "Garage Meross Plug", goods_type: 43, group_id: 0, pact_code: Some( 1, ), pact_type: Some( 1, ), share: Some( 0, ), sku: "H5080", spec: "", support_scene: false, version_hard: "1.02.00", version_soft: "1.00.08", }, } [2024-01-07T20:29:57 INFO govee::commands::serve] [2024-01-07T20:29:57 INFO govee::commands::serve] XMAS String 2 (2C:66:E7:FD:96:78:0D:7C) sku=H70C1 [2024-01-07T20:29:57 INFO govee::commands::serve] Platform API: devices.types.light. supports_rgb=true supports_brightness=true [2024-01-07T20:29:57 INFO govee::commands::serve] color_temp=Some((2000, 9000)) segment_rgb=Some(0..10) [2024-01-07T20:29:57 TRACE govee::commands::serve] HttpDeviceInfo { sku: "H70C1", device: "2C:66:E7:FD:96:78:0D:7C", device_name: "XMAS String 2", device_type: Light, capabilities: [ DeviceCapability { kind: OnOff, instance: "powerSwitch", parameters: Some( Enum { options: [ EnumOption { name: "on", value: Number(1), extras: {}, }, EnumOption { name: "off", value: Number(0), extras: {}, }, ], }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: Toggle, instance: "gradientToggle", parameters: Some( Enum { options: [ EnumOption { name: "on", value: Number(1), extras: {}, }, EnumOption { name: "off", value: Number(0), extras: {}, }, ], }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: Range, instance: "brightness", parameters: Some( Integer { unit: Some( "unit.percent", ), range: IntegerRange { min: 1, max: 100, precision: 1, }, }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: SegmentColorSetting, instance: "segmentedBrightness", parameters: Some( Struct { fields: [ StructField { field_name: "segment", field_type: Array { size: Some( ArraySize { min: 1, max: 10, }, ), element_range: Some( ElementRange { min: 0, max: 14, }, ), element_type: Some( "INTEGER", ), options: [], }, default_value: None, required: true, }, StructField { field_name: "brightness", field_type: Integer { unit: None, range: IntegerRange { min: 0, max: 100, precision: 1, }, }, default_value: None, required: true, }, ], }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: SegmentColorSetting, instance: "segmentedColorRgb", parameters: Some( Struct { fields: [ StructField { field_name: "segment", field_type: Array { size: Some( ArraySize { min: 1, max: 10, }, ), element_range: Some( ElementRange { min: 0, max: 14, }, ), element_type: Some( "INTEGER", ), options: [], }, default_value: None, required: true, }, StructField { field_name: "rgb", field_type: Integer { unit: None, range: IntegerRange { min: 0, max: 16777215, precision: 1, }, }, default_value: None, required: true, }, ], }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: ColorSetting, instance: "colorRgb", parameters: Some( Integer { unit: None, range: IntegerRange { min: 0, max: 16777215, precision: 1, }, }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: ColorSetting, instance: "colorTemperatureK", parameters: Some( Integer { unit: None, range: IntegerRange { min: 2000, max: 9000, precision: 1, }, }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: DynamicScene, instance: "lightScene", parameters: Some( Enum { options: [], }, ), alarm_type: None, event_state: None, }, DeviceCapability { kind: MusicSetting, instance: "musicMode", parameters: Some( Struct { fields: [ StructField { field_name: "musicMode", field_type: Enum { options: [ EnumOption { name: "Energic", value: Number(1), extras: {}, }, EnumOption { name: "Rhythm", value: Number(2), extras: {}, }, EnumOption { name: "Spectrum", value: Number(3), extras: {}, }, EnumOption { name: "Rolling", value: Number(4), extras: {}, }, EnumOption { name: "Separation", value: Number(5), extras: {}, }, EnumOption { name: "Hopping", value: Number(6), extras: {}, }, EnumOption { name: "PianoKeys", value: Number(7), extras: {}, }, EnumOption { name: "Fountain", value: Number(8), extras: {}, }, EnumOption { name: "DayAndNight", value: Number(9), extras: {}, }, EnumOption { name: "Sprouting", value: Number(10), extras: {}, }, EnumOption { name: "Shiny", value: Number(11), extras: {}, }, ], }, default_value: None, required: true, version_hard: Some( "3.01.01", ), version_soft: Some( "3.00.53", ), play_state: Some( false, ), tem_min: None, tem_max: None, tem_warning: None, fah_open: None, tem_cali: None, hum_min: None, hum_max: None, hum_warning: None, hum_cali: None, net_waring: None, upload_rate: None, battery: None, wifi_level: None, }, ext_resources: ExtResources { sku_url: Some( "https://d1f2504ijhdyjw.cloudfront.net/sku-img/96ba4cfd474d94bdae72262257a576aa-add_list_type_device_61e1.png", ), head_on_img_new: Some( "", ), head_on_img: Some( "https://d1f2504ijhdyjw.cloudfront.net/sku-img/23a2bf4fa45b93a040f285d1a7e131bb-new_light_title_61e1_on.png", ), head_off_img: Some( "https://d1f2504ijhdyjw.cloudfront.net/sku-img/ccf5d69bd0e7c8bf61a9f789bb7425de-new_light_title_61e1_off.png", ), head_off_img_new: Some( "", ), ext: Some( "", ), ic: Some( 50, ), }, last_device_data: LastDeviceData { online: false, tem: None, hum: None, last_time: None, avg_day_tem: None, avg_day_hum: None, }, }, device_name: "Bar", goods_type: 123, group_id: 6909365, pact_code: Some( 2, ), pact_type: Some( 2, ), share: Some( 0, ), sku: "H61E1", spec: "", support_scene: true, version_hard: "3.01.01", version_soft: "3.00.53", }, } [2024-01-07T20:29:57 INFO govee::commands::serve] Quirk: Quirk { sku: "H61E1", icon: "mdi:led-strip-variant", supports_rgb: true, supports_brightness: true, color_temp_range: Some((2000, 9000)), avoid_platform_api: false, ble_only: false, lan_api_capable: true } [2024-01-07T20:29:57 INFO govee::commands::serve] [2024-01-07T20:29:57 INFO govee::service::http] http server addr is 0.0.0.0:8056 [2024-01-07T20:30:17 INFO govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted. [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT LR Corner Lamp (2A:97:9C:04:A0:94:C6:8B) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Test (AB:AD:D8:32:39:35:3D:7A) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT WOR-3 (28:C1:D4:AD:FC:3A:E9:0A) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT XMAS Tree 1 - Large (CA:F1:E5:95:D7:44:AC:15) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Office floor lamp (FC:3F:D9:37:34:32:10:7A) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT DR - Buffet (7B:65:D4:38:31:39:7A:59) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Garage Meross Plug (30:33:9C:04:A0:94:CD:91) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT XMAS String 2 (2C:66:E7:FD:96:78:0D:7C) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Rope Light 1 (58:FC:D4:AD:FC:7E:DE:E1) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Right Stairs XMAS (1E:97:FA:CA:BD:0B:01:79) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Flood Lights Right (C3:05:CF:35:33:33:21:82) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Glance LED (B1:25:9C:04:A0:A6:36:BB) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Office - Credenza (7C:89:D4:AD:FC:01:5D:F3) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT WOR-4 (0A:B9:D4:AD:FC:3A:EA:08) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Flood Light Left (1B:0E:D5:35:33:35:49:0D) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Left Stairs XMAS (17:C8:DA:84:6D:BF:43:BC) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT WOR-2 (0A:71:D4:AD:FC:3C:63:B2) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Foyer Table (36:D2:D8:32:39:35:07:3D) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Sauna Light (3A:6C:D4:AD:FC:99:5D:B4) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT WOR-Soffit (CF:B0:D4:AD:FC:3C:65:21) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Office Christmas House (E3:3E:9C:04:A0:94:C4:CD) None [2024-01-07T20:30:17 INFO govee::commands::serve] requesting update via IoT MQTT Bar (34:61:D5:32:39:35:65:37) None [2024-01-07T20:41:18 INFO govee::service::hass] powerSwitch for 30339C04A094CD91: OFF ```
gscott16 commented 10 months ago

And here is one error sitting in home assistant core that may be of use:

Logger: homeassistant.components.hassio Source: components/hassio/websocket_api.py:138 Integration: Home Assistant Supervisor (documentation, issues) First occurred: 7:36:52 PM (2 occurrences) Last logged: 8:14:15 PM

Failed to to call /addons/b9845f46_govee2mqtt/stats - 404 Client Error for http+docker://localhost/v1.43/containers/addon_b9845f46_govee2mqtt/json: Not Found ("No such container: addon_b9845f46_govee2mqtt")

gscott16 commented 10 months ago

Wez, here are a couple of additional log messages…

[2024-01-08T19:40:54 INFO govee::commands::serve] requesting update via IoT MQTT Garage Meross Plug (30:33:9C:04:A0:94:CD:91) Some(DeviceState { on: true, online: None, kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "AWS IoT API", updated: 2024-01-09T01:24:54.873469421Z })

[2024-01-08T19:41:54 INFO govee::commands::serve] requesting update via IoT MQTT Glance LED (B1:25:9C:04:A0:A6:36:BB) Some(DeviceState { on: true, online: None, kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "AWS IoT API", updated: 2024-01-09T01:25:54.839044568Z })

[2024-01-08T19:41:54 INFO govee::service::hass] powerSwitch for 30339C04A094CD91: OFF

[2024-01-08T19:43:03 INFO govee::service::hass] powerSwitch for B1259C04A0A636BB: OFF

wez commented 10 months ago

Failed to to call /addons/b9845f46_govee2mqtt/stats - 404 Client Error for http+docker://localhost/v1.43/containers/addon_b9845f46_govee2mqtt/json: Not Found ("No such container: addon_b9845f46_govee2mqtt")

FWIW, that's not directly something that govee2mqtt can control; that looks like something internal to HASS

wez commented 10 months ago

Thanks for sharing the logs. Unfortunately the most useful information was truncated away. I've updated the addon to include improved information at the regular logging level, which may help to understand what is going on. Please update the addon, and clear out the debug level. Please share the logs that summarize your device information on startup, and then logs from around where you are trying to control the device.

gscott16 commented 10 months ago

Wez, thanks for the update and feedback. I have 20+ GOVEE devices so the logs are full of lots of stuff. I have edited this down to one of the 5080 plugs for testing purposes. Incidentally, all of the other GOVEE devices are working as expected.

  1. Startup messages are below.
  2. The UI reports the correct statuses for the plugs (either on or off)
  3. In the UI, when I turn the device off, the UI moves the slider to the off position and then a few seconds later the switch moves back to the on position.
  4. My guess -> the command to turn the power off on the switch is not formatted correctly so nothing happens and then the status gets updated again. This message looks a little different formatting wise than the other messages when a state change happens. _ _2024-01-09T10:31:19 INFO govee::service::hass] powerSwitch for 30339C04A094CD91: OFF__

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started GOVEE_API_KEY=REDACTED GOVEE_MQTT_HOST=core-mosquitto GOVEE_EMAIL=REDACTED GOVEE_PASSWORD=REDACTED GOVEE_MQTT_PASSWORD=REDACTED GOVEE_MQTT_USER=addons GOVEE_MQTT_PORT=1883 ++ cd /app ++ exec /app/govee serve [2024-01-09T10:21:13 INFO govee::commands::serve] Starting service. version 2024.01.09-c452466f [2024-01-09T10:21:13 INFO govee::commands::serve] Querying platform API for device list [2024-01-09T10:21:13 INFO govee::commands::serve] Querying undocumented API for device + room list [2024-01-09T10:21:13 INFO govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted. [2024-01-09T10:21:13 INFO govee::commands::serve] Starting LAN discovery [2024-01-09T10:21:13 INFO govee::commands::serve] Waiting 10 seconds for LAN API discovery [2024-01-09T10:21:13 INFO govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted.

[2024-01-09T10:21:23 INFO govee::commands::serve] [2024-01-09T10:21:23 INFO govee::commands::serve] Garage Meross Plug (30:33:9C:04:A0:94:CD:91) sku=H5080 [2024-01-09T10:21:23 INFO govee::commands::serve] Platform API: devices.types.socket. supports_rgb=false supports_brightness=false [2024-01-09T10:21:23 INFO govee::commands::serve] color_temp=None segment_rgb=None [2024-01-09T10:21:23 INFO govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-01-09T10:21:23 INFO govee::commands::serve]

[2024-01-09T10:21:24 INFO govee::service::http] http server addr is 0.0.0.0:8056

[2024-01-09T10:21:43 INFO govee::commands::serve] requesting update via IoT MQTT Garage Meross Plug (30:33:9C:04:A0:94:CD:91) None

[2024-01-09T10:21:54 INFO govee::service::hass] Wait 13.1s for hass to settle on entity configs [2024-01-09T10:22:07 INFO govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted.

[2024-01-09T10:31:19 INFO govee::service::hass] powerSwitch for 30339C04A094CD91: OFF [2024-01-09T10:31:19 INFO govee::service::state] Using IoT API to set Garage Meross Plug (30:33:9C:04:A0:94:CD:91) power state

gscott16 commented 10 months ago

Adding an additional log entry…. This looks like a standard polling message which is reporting the correct state.

[2024-01-09T10:46:43 INFO govee::commands::serve] requesting update via IoT MQTT Garage Meross Plug (30:33:9C:04:A0:94:CD:91) Some(DeviceState { on: true, online: None, kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "AWS IoT API", updated: 2024-01-09T16:31:20.894959473Z })

wez commented 10 months ago

From looking at homebridge-govee, it looks like a different value is needed to control the power state on this device. I've pushed a speculative fix in ab0af6b75892443133f2d704aeb35804da4e8149; please update the addon and let me know if that works!

gscott16 commented 10 months ago

Thanks Wez. THAT'S IT :) It's working perfectly!!!!

wez commented 10 months ago

Great!