wez / govee2mqtt

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

H7173 kettle no longer functioning with recent changes #100

Open tankdeer opened 7 months ago

tankdeer commented 7 months ago

Govee Device SKU

H7173

Govee2MQTT Version

2024.01.21-33e8cd7c

Describe the issue

After updating to the most recent version, I notice the stuff we added last week is no longer functioning. Neither the activate mode buttons, nor the mode select work anymore. And the new mode/scene select is empty. I deleted the device and re-started the addon already.

The power switch and target temperature slider still work as before - it seems to be limited to the modes

Startup Diagnostics

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_TEMPERATURE_SCALE=F 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-21T11:03:32 INFO govee::commands::serve] Starting service. version 2024.01.21-33e8cd7c [2024-01-21T11:03:32 INFO govee::commands::serve] Querying platform API for device list [2024-01-21T11:03:32 INFO govee::commands::serve] Querying undocumented API for device + room list [2024-01-21T11:03:34 INFO govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted. [2024-01-21T11:03:34 INFO govee::commands::serve] Starting LAN discovery [2024-01-21T11:03:34 INFO govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted. [2024-01-21T11:03:34 INFO govee::commands::serve] Waiting 10 seconds for LAN API discovery [2024-01-21T11:03:44 INFO govee::commands::serve] Devices returned from Govee's APIs [2024-01-21T11:03:44 INFO govee::commands::serve] Bev (1E:6E:60:74:F4:5F:3E:1E H7173) [2024-01-21T11:03:44 INFO govee::commands::serve] Platform API: devices.types.kettle. supports_rgb=false supports_brightness=false [2024-01-21T11:03:44 INFO govee::commands::serve] color_temp=None segment_rgb=None [2024-01-21T11:03:44 INFO govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-01-21T11:03:44 INFO govee::commands::serve] Quirk { sku: "H7173", icon: "mdi:kettle", supports_rgb: false, supports_brightness: false, color_temp_range: None, avoid_platform_api: false, ble_only: false, lan_api_capable: false, device_type: Kettle, platform_temperature_sensor_units: Some(Farenheit), platform_humidity_sensor_units: None, iot_api_supported: false, show_as_preset_buttons: Some(["Tea", "Coffee", "DIY"]) } [2024-01-21T11:03:44 INFO govee::commands::serve] [2024-01-21T11:03:44 INFO govee::commands::serve] Backyard Spotlights (A4:2A:CC:38:32:30:55:39 H7066) [2024-01-21T11:03:44 INFO govee::commands::serve] LAN API: ip=192.168.30.199 [2024-01-21T11:03:44 INFO govee::commands::serve] Platform API: devices.types.light. supports_rgb=true supports_brightness=true [2024-01-21T11:03:44 INFO govee::commands::serve] color_temp=Some((2000, 9000)) segment_rgb=Some(0..4) [2024-01-21T11:03:44 INFO govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-01-21T11:03:44 INFO govee::commands::serve] Quirk { sku: "H7066", icon: "mdi:light-bulb", supports_rgb: true, supports_brightness: true, color_temp_range: Some((2000, 9000)), avoid_platform_api: false, ble_only: false, lan_api_capable: true, device_type: Light, platform_temperature_sensor_units: None, platform_humidity_sensor_units: None, iot_api_supported: true, show_as_preset_buttons: None } [2024-01-21T11:03:44 INFO govee::commands::serve] [2024-01-21T11:03:44 INFO govee::service::http] http server addr is 0.0.0.0:8056 [2024-01-21T11:03:49 INFO govee::service::hass] Wait 1.1s for hass to settle on 22 entity configs [2024-01-21T11:03:50 INFO govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted. [2024-01-21T11:04:04 INFO govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) None [2024-01-21T11:05:30 INFO govee::service::hass] Request Platform API State for Bev (1E:6E:60:74:F4:5F:3E:1E H7173) [2024-01-21T11:05:30 INFO govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-21T19:04:04.851833053Z })

Additional Logs

[2024-01-21T11:05:32 INFO govee::hass_mqtt::humidifier] mqtt_humidifier_set_mode: 1E6E6074F45F3E1E: DIY [2024-01-21T11:05:33 ERROR govee::service::hass] While dispatching Message { topic: "gv2mqtt/1E6E6074F45F3E1E/set-work-mode", payload: "DIY", qos: AtMostOnce, retain: false, mid: 0 }: request https://openapi.api.govee.com/router/api/v1/device/control status 200: OK: parsing https://openapi.api.govee.com/router/api/v1/device/control response: Failed with status 400 Bad Request Bad Request: Request to https://openapi.api.govee.com/router/api/v1/device/control failed with code 400 Bad Request Parameter value out of range. Full response: {"requestId":"uuid","msg":"Parameter value out of range","code":400,"capability":{"type":"devices.capabilities.work_mode","instance":"workMode","state":{"status":"failure","errorCode":400,"errorMsg":"Parameter value out of range"},"value":{"modeValue":0,"workMode":1}}} [2024-01-21T11:05:37 INFO govee::service::hass] Request Platform API State for Bev (1E:6E:60:74:F4:5F:3E:1E H7173) [2024-01-21T11:05:37 INFO govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-21T19:05:32.460828401Z }) [2024-01-21T11:05:38 INFO govee::service::state] Polling Bev (1E:6E:60:74:F4:5F:3E:1E H7173) to get latest state after control [2024-01-21T11:05:38 INFO govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-21T19:05:32.460828401Z }) [2024-01-21T11:05:59 INFO govee::service::hass] Request Platform API State for Bev (1E:6E:60:74:F4:5F:3E:1E H7173) [2024-01-21T11:05:59 INFO govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: None, kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "AWS IoT API", updated: 2024-01-21T19:05:52.278392868Z }) [2024-01-21T11:06:15 INFO govee::hass_mqtt::number] DIY for 1E6E6074F45F3E1E: 0 [2024-01-21T11:06:16 ERROR govee::service::hass] While dispatching Message { topic: "gv2mqtt/number/1E6E6074F45F3E1E/command/DIY/1", payload: "0", qos: AtMostOnce, retain: false, mid: 0 }: request https://openapi.api.govee.com/router/api/v1/device/control status 200: OK: parsing https://openapi.api.govee.com/router/api/v1/device/control response: Failed with status 400 Bad Request Bad Request: Request to https://openapi.api.govee.com/router/api/v1/device/control failed with code 400 Bad Request Parameter value out of range. Full response: {"requestId":"uuid","msg":"Parameter value out of range","code":400,"capability":{"type":"devices.capabilities.work_mode","instance":"workMode","state":{"status":"failure","errorCode":400,"errorMsg":"Parameter value out of range"},"value":{"modeValue":0,"workMode":1}}} [2024-01-21T11:06:21 INFO govee::service::state] Polling Bev (1E:6E:60:74:F4:5F:3E:1E H7173) to get latest state after control [2024-01-21T11:06:21 INFO govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-21T19:06:00.085825492Z })

Home Assistant Logs

No response

Anything else?

No response

wez commented 7 months ago

Please share the metadata for your device; I wonder if perhaps it has been updated by Govee.

Then evaluate the following home assistant template by visiting Developer Tools | Template, replacing the entity name with what yours actually is:

{{
    {
      "meta": state_attr('sensor.device_name_status', 'platform_metadata'),
      "state": state_attr('sensor.device_name_status', 'platform_state'),
    }
}}

It should output a large-ish json blob, please share that here.

tankdeer commented 7 months ago
{
  "meta": {
    "capabilities": [
      {
        "alarmType": null,
        "eventState": null,
        "instance": "powerSwitch",
        "parameters": {
          "dataType": "ENUM",
          "options": [
            {
              "name": "on",
              "value": 1
            },
            {
              "name": "off",
              "value": 0
            }
          ]
        },
        "type": "devices.capabilities.on_off"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "sliderTemperature",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "INTEGER",
              "defaultValue": null,
              "fieldName": "temperature",
              "range": {
                "max": 100,
                "min": 40,
                "precision": 1
              },
              "required": true,
              "unit": null
            },
            {
              "dataType": "ENUM",
              "defaultValue": "Celsius",
              "fieldName": "unit",
              "options": [
                {
                  "name": "Celsius",
                  "value": "Celsius"
                },
                {
                  "name": "Fahrenheit",
                  "value": "Fahrenheit"
                }
              ],
              "required": true
            }
          ]
        },
        "type": "devices.capabilities.temperature_setting"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "sensorTemperature",
        "parameters": null,
        "type": "devices.capabilities.property"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "workMode",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "ENUM",
              "defaultValue": null,
              "fieldName": "workMode",
              "options": [
                {
                  "name": "DIY",
                  "value": 1
                },
                {
                  "name": "Boiling",
                  "value": 2
                },
                {
                  "name": "Tea",
                  "value": 3
                },
                {
                  "name": "Coffee",
                  "value": 4
                }
              ],
              "required": true
            },
            {
              "dataType": "ENUM",
              "defaultValue": null,
              "fieldName": "modeValue",
              "options": [
                {
                  "defaultValue": 0,
                  "name": "Boiling",
                  "value": null
                },
                {
                  "dataType": "ENUM",
                  "name": "Tea",
                  "options": [
                    {
                      "value": 1
                    },
                    {
                      "value": 2
                    },
                    {
                      "value": 3
                    },
                    {
                      "value": 4
                    }
                  ],
                  "value": null
                },
                {
                  "dataType": "ENUM",
                  "name": "Coffee",
                  "options": [
                    {
                      "value": 1
                    },
                    {
                      "value": 2
                    },
                    {
                      "value": 3
                    },
                    {
                      "value": 4
                    }
                  ],
                  "value": null
                },
                {
                  "dataType": "ENUM",
                  "name": "DIY",
                  "options": [
                    {
                      "value": 1
                    },
                    {
                      "value": 2
                    },
                    {
                      "value": 3
                    },
                    {
                      "value": 4
                    }
                  ],
                  "value": null
                }
              ],
              "required": false
            }
          ]
        },
        "type": "devices.capabilities.work_mode"
      }
    ],
    "device": "1E:6E:60:74:F4:5F:3E:1E",
    "deviceName": "Bev",
    "sku": "H7173",
    "type": "devices.types.kettle"
  },
  "state": {
    "capabilities": [
      {
        "instance": "online",
        "state": {
          "value": true
        },
        "type": "devices.capabilities.online"
      },
      {
        "instance": "powerSwitch",
        "state": {
          "value": 0
        },
        "type": "devices.capabilities.on_off"
      },
      {
        "instance": "sliderTemperature",
        "state": {
          "value": {
            "targetTemperature": 100,
            "unit": "Celsius"
          }
        },
        "type": "devices.capabilities.temperature_setting"
      },
      {
        "instance": "sensorTemperature",
        "state": {
          "value": 111
        },
        "type": "devices.capabilities.property"
      },
      {
        "instance": "workMode",
        "state": {
          "value": {
            "workMode": 2
          }
        },
        "type": "devices.capabilities.work_mode"
      }
    ],
    "device": "1E:6E:60:74:F4:5F:3E:1E",
    "sku": "H7173"
  }
}
wez commented 7 months ago

And can you share what you see in the HA UI for the number entity that triggered the error? I'm trying to understand where the 0 comes from in this part of your logs;

[2024-01-21T11:06:15 INFO govee::hass_mqtt::number] DIY for 1E6E6074F45F3E1E: 0

Based on the metadata, the lowest value there should be a 1.

That's the reason that the API errors with:

[2024-01-21T11:06:16 ERROR govee::service::hass] While dispatching Message { topic: "gv2mqtt/number/1E6E6074F45F3E1E/command/DIY/1", payload: "0", qos: AtMostOnce, retain: false, mid: 0 }: request https://openapi.api.govee.com/router/api/v1/device/control status 200: OK: parsing https://openapi.api.govee.com/router/api/v1/device/control response: Failed with status 400 Bad Request Bad Request: Request to https://openapi.api.govee.com/router/api/v1/device/control failed with code 400 Bad Request Parameter value out of range. Full response: {"requestId":"uuid","msg":"Parameter value out of range","code":400,"capability":{"type":"devices.capabilities.work_mode","instance":"workMode","state":{"status":"failure","errorCode":400,"errorMsg":"Parameter value out of range"},"value":{"modeValue":0,"workMode":1}}}

Capturing the MQTT info for the entity would also be useful, so we can see what range has been configured for it in HA.

tankdeer commented 7 months ago

It wasn't a number entity that triggered the error, it was both the mode select entity, and the button entities.

image

Here is the select:

image image

[2024-01-21T17:44:40 INFO  govee::hass_mqtt::humidifier] mqtt_humidifier_set_mode: 1E6E6074F45F3E1E: DIY
[2024-01-21T17:44:42 ERROR govee::service::hass] While dispatching Message { topic: "gv2mqtt/1E6E6074F45F3E1E/set-work-mode", payload: "DIY", qos: AtMostOnce, retain: false, mid: 0 }: request https://openapi.api.govee.com/router/api/v1/device/control status 200: OK: parsing https://openapi.api.govee.com/router/api/v1/device/control response: Failed with status 400 Bad Request Bad Request: Request to https://openapi.api.govee.com/router/api/v1/device/control failed with code 400 Bad Request Parameter value out of range. Full response: {"requestId":"uuid","msg":"Parameter value out of range","code":400,"capability":{"type":"devices.capabilities.work_mode","instance":"workMode","state":{"status":"failure","errorCode":400,"errorMsg":"Parameter value out of range"},"value":{"modeValue":0,"workMode":1}}}
[2024-01-21T17:44:47 INFO  govee::service::state] Polling Bev (1E:6E:60:74:F4:5F:3E:1E H7173) to get latest state after control
[2024-01-21T17:44:47 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: None, kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "AWS IoT API", updated: 2024-01-22T01:44:34.661092608Z })

And here's the button: image

[2024-01-21T17:46:55 INFO  govee::hass_mqtt::number] DIY for 1E6E6074F45F3E1E: 0
[2024-01-21T17:46:55 ERROR govee::service::hass] While dispatching Message { topic: "gv2mqtt/number/1E6E6074F45F3E1E/command/DIY/1", payload: "0", qos: AtMostOnce, retain: false, mid: 0 }: request https://openapi.api.govee.com/router/api/v1/device/control status 200: OK: parsing https://openapi.api.govee.com/router/api/v1/device/control response: Failed with status 400 Bad Request Bad Request: Request to https://openapi.api.govee.com/router/api/v1/device/control failed with code 400 Bad Request Parameter value out of range. Full response: {"requestId":"uuid","msg":"Parameter value out of range","code":400,"capability":{"type":"devices.capabilities.work_mode","instance":"workMode","state":{"status":"failure","errorCode":400,"errorMsg":"Parameter value out of range"},"value":{"modeValue":0,"workMode":1}}}
[2024-01-21T17:47:00 INFO  govee::service::state] Polling Bev (1E:6E:60:74:F4:5F:3E:1E H7173) to get latest state after control
[2024-01-21T17:47:00 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-22T01:44:48.195928247Z })

I noticed that the select seems to be treating this as a humidifier now, which I don't recall it doing before. And as mentioned, this was of course working previously, after we completed #30

wez commented 7 months ago

Please try the latest version!

tankdeer commented 7 months ago

Thanks. That did fix both the mode button and the mode select entities.

Are there plans to reintroduce the additional modes that were removed? When this was first reverse engineered we were able to change to any of the settings within a specific mode (Tea index 2 for example). Now we can only select the higher level category. Not sure if that was an intentional change or not.

tankdeer commented 7 months ago

Another issue I am not sure if this is related to the recent changes or not. The past few days I have noticed the kettle seems to turn it self on randomly. My wife commented noticed as well. After digging around a little, it seems that the mode select is being changed from DIY to Boiling. Neither me nor my wife are initiating this change, and there are no automations set to do this. I do have an automation that sets it to DIY first thing in the morning, but that is it.

You can see it set here at 10:50 am (I included a few lines before the command)

[2024-01-29T10:13:25 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-29T17:58:25.939435193Z })
[2024-01-29T10:28:27 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-29T18:13:26.974614913Z })
[2024-01-29T10:43:27 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-29T18:28:27.611132630Z })
[2024-01-29T10:50:10 INFO  govee::hass_mqtt::humidifier] mqtt_humidifier_set_mode: 1E6E6074F45F3E1E: Boiling
[2024-01-29T10:50:12 INFO  govee::platform_api] control_device result: ControlDeviceResponse { request_id: "uuid", code: 200, message: "success", capability: ControlDeviceResponseCapability { kind: WorkMode, instance: "workMode", value: Object {"modeValue": Number(0), "workMode": Number(2)}, state: Object {"status": String("success")} } }
[2024-01-29T10:50:17 INFO  govee::service::state] Polling Bev (1E:6E:60:74:F4:5F:3E:1E H7173) to get latest state after control
[2024-01-29T10:50:17 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: false, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-29T18:43:28.647551362Z })
[2024-01-29T10:51:28 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: true, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-29T18:50:17.562773154Z })
[2024-01-29T10:52:29 INFO  govee::service::state] requesting update via Platform API Bev (1E:6E:60:74:F4:5F:3E:1E H7173) Some(DeviceState { on: true, light_on: None, online: Some(true), kelvin: 0, color: DeviceColor { r: 0, g: 0, b: 0 }, brightness: 0, scene: None, source: "PLATFORM API", updated: 2024-01-29T18:51:29.288002453Z })

And the MQTT message as well: image

Boiling is the first item in the select box, index 0. Not sure if something is happening that is re-setting the value or what. From what I can tell this seems to happen about once a day