wez / govee2mqtt

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

H7021 only showing 15 of 30 total sements #96

Open wolfslab opened 5 months ago

wolfslab commented 5 months ago

Govee Device SKU

H7021

Govee2MQTT Version

2024.01.19-ffca9c12

Describe the issue

These lights have 30 total lights in them, but the segments only show 15, which when I control each segment, it refers to each light. So we are missing the second half of the strand in this addon. These lights are 2 48ft segments, with 15 lights each in them. The govee app works just fine to modify them. Everything works correctly from what I can tell. I am just missing the last 15 segments of them.

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-20T19:23:12 INFO govee::commands::serve] Starting service. version 2024.01.19-ffca9c12 [2024-01-20T19:23:12 INFO govee::commands::serve] Querying platform API for device list [2024-01-20T19:23:12 INFO govee::commands::serve] Querying undocumented API for device + room list [2024-01-20T19:23:13 INFO govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted. [2024-01-20T19:23:13 INFO govee::commands::serve] Starting LAN discovery [2024-01-20T19:23:13 INFO govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted. [2024-01-20T19:23:13 INFO govee::commands::serve] Waiting 10 seconds for LAN API discovery [2024-01-20T19:23:23 INFO govee::commands::serve] Devices returned from Govee's APIs [2024-01-20T19:23:23 INFO govee::commands::serve] Fence String Lights 2 (98:BD:C4:35:33:35:2A:75 H7021) [2024-01-20T19:23:23 INFO govee::commands::serve] LAN API: ip=192.168.1.88 [2024-01-20T19:23:23 INFO govee::commands::serve] Platform API: devices.types.light. supports_rgb=true supports_brightness=true [2024-01-20T19:23:23 INFO govee::commands::serve] color_temp=Some((2000, 9000)) segment_rgb=Some(0..15) [2024-01-20T19:23:23 INFO govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-01-20T19:23:23 INFO govee::commands::serve] Quirk { sku: "H7021", icon: "mdi:string-lights", 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-20T19:23:23 INFO govee::commands::serve] [2024-01-20T19:23:23 INFO govee::commands::serve] Fence String Lights 1 (94:69:CA:30:38:35:44:4E H7021) [2024-01-20T19:23:23 INFO govee::commands::serve] Platform API: devices.types.light. supports_rgb=true supports_brightness=true [2024-01-20T19:23:23 INFO govee::commands::serve] color_temp=Some((2000, 9000)) segment_rgb=Some(0..15) [2024-01-20T19:23:23 INFO govee::commands::serve] Undoc: room=None supports_iot=true ble_only=false [2024-01-20T19:23:23 INFO govee::commands::serve] Quirk { sku: "H7021", icon: "mdi:string-lights", 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-20T19:23:23 WARN govee::commands::serve] This device should be available via the LAN API, but didn't respond to probing yet. Possible causes: [2024-01-20T19:23:23 WARN govee::commands::serve] 1) LAN API needs to be enabled in the Govee Home App. [2024-01-20T19:23:23 WARN govee::commands::serve] 2) The device is offline. [2024-01-20T19:23:23 WARN govee::commands::serve] 3) A network configuration issue is preventing communication. [2024-01-20T19:23:23 INFO govee::commands::serve] [2024-01-20T19:23:24 INFO govee::service::http] http server addr is 0.0.0.0:8056 [2024-01-20T19:23:29 INFO govee::service::hass] Wait 2.1s for hass to settle on 42 entity configs [2024-01-20T19:23:31 INFO govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted.

Additional Logs

No response

Home Assistant Logs

No response

Anything else?

No response

wez commented 5 months ago

Please share the metadata for your device:

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.

wolfslab commented 5 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": "gradientToggle",
        "parameters": {
          "dataType": "ENUM",
          "options": [
            {
              "name": "on",
              "value": 1
            },
            {
              "name": "off",
              "value": 0
            }
          ]
        },
        "type": "devices.capabilities.toggle"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "brightness",
        "parameters": {
          "dataType": "INTEGER",
          "range": {
            "max": 100,
            "min": 1,
            "precision": 1
          },
          "unit": "unit.percent"
        },
        "type": "devices.capabilities.range"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "segmentedBrightness",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "Array",
              "defaultValue": null,
              "elementRange": {
                "max": 14,
                "min": 0
              },
              "elementType": "INTEGER",
              "fieldName": "segment",
              "options": [],
              "required": true,
              "size": {
                "max": 15,
                "min": 1
              }
            },
            {
              "dataType": "INTEGER",
              "defaultValue": null,
              "fieldName": "brightness",
              "range": {
                "max": 100,
                "min": 0,
                "precision": 1
              },
              "required": true,
              "unit": null
            }
          ]
        },
        "type": "devices.capabilities.segment_color_setting"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "segmentedColorRgb",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "Array",
              "defaultValue": null,
              "elementRange": {
                "max": 14,
                "min": 0
              },
              "elementType": "INTEGER",
              "fieldName": "segment",
              "options": [],
              "required": true,
              "size": {
                "max": 15,
                "min": 1
              }
            },
            {
              "dataType": "INTEGER",
              "defaultValue": null,
              "fieldName": "rgb",
              "range": {
                "max": 16777215,
                "min": 0,
                "precision": 1
              },
              "required": true,
              "unit": null
            }
          ]
        },
        "type": "devices.capabilities.segment_color_setting"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "colorRgb",
        "parameters": {
          "dataType": "INTEGER",
          "range": {
            "max": 16777215,
            "min": 0,
            "precision": 1
          },
          "unit": null
        },
        "type": "devices.capabilities.color_setting"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "colorTemperatureK",
        "parameters": {
          "dataType": "INTEGER",
          "range": {
            "max": 9000,
            "min": 2000,
            "precision": 1
          },
          "unit": null
        },
        "type": "devices.capabilities.color_setting"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "lightScene",
        "parameters": {
          "dataType": "ENUM",
          "options": []
        },
        "type": "devices.capabilities.dynamic_scene"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "musicMode",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "ENUM",
              "defaultValue": null,
              "fieldName": "musicMode",
              "options": [
                {
                  "name": "Energic",
                  "value": 1
                },
                {
                  "name": "Spectrum",
                  "value": 2
                },
                {
                  "name": "Rolling",
                  "value": 3
                },
                {
                  "name": "Rhythm",
                  "value": 4
                }
              ],
              "required": true
            },
            {
              "dataType": "INTEGER",
              "defaultValue": null,
              "fieldName": "sensitivity",
              "range": {
                "max": 100,
                "min": 0,
                "precision": 1
              },
              "required": true,
              "unit": "unit.percent"
            },
            {
              "dataType": "ENUM",
              "defaultValue": null,
              "fieldName": "autoColor",
              "options": [
                {
                  "name": "on",
                  "value": 1
                },
                {
                  "name": "off",
                  "value": 0
                }
              ],
              "required": false
            },
            {
              "dataType": "INTEGER",
              "defaultValue": null,
              "fieldName": "rgb",
              "range": {
                "max": 16777215,
                "min": 0,
                "precision": 1
              },
              "required": false,
              "unit": null
            }
          ]
        },
        "type": "devices.capabilities.music_setting"
      },
      {
        "alarmType": null,
        "eventState": null,
        "instance": "diyScene",
        "parameters": {
          "dataType": "ENUM",
          "options": []
        },
        "type": "devices.capabilities.dynamic_scene"
      }
    ],
    "device": "94:69:CA:30:38:35:44:4E",
    "deviceName": "Fence String Lights 1",
    "sku": "H7021",
    "type": "devices.types.light"
  },
  "state": null
}
wolfslab commented 5 months ago

I do have 2 of these same lights as well. The H7020 version of these lights that do not have LAN control are the ones that are just 48ft with only 15 lights or segments (I do not have that version, only the H7021).

wez commented 5 months ago

Thanks!

So if you look at this part of the metadata:

        "instance": "segmentedBrightness",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "Array",
              "defaultValue": null,
              "elementRange": {
                "max": 14,
                "min": 0
              },
              "elementType": "INTEGER",
              "fieldName": "segment",
              "options": [],
              "required": true,
              "size": {
                "max": 15,
                "min": 1
              }
            },

that tells us that there are only 15 segments. The metadata for a lot of devices is a bit wonky, so it doesn't surprise me that this is wrong for your device.

Are you able to try manually curl'ing or postman'ing the API to see if it will actually accept setting controls for segments outside of that range?

https://developer.govee.com/reference/control-you-devices#segment_color_setting has some details.

If you can prove that it will work to ignore the limits in the API, we can look at potentially adding a quirk to make that work for this device.

However, this is really a bug in Govee's API data and should be reported to them to resolve at the source.

wolfslab commented 5 months ago

Thanks!

So if you look at this part of the metadata:

        "instance": "segmentedBrightness",
        "parameters": {
          "dataType": "STRUCT",
          "fields": [
            {
              "dataType": "Array",
              "defaultValue": null,
              "elementRange": {
                "max": 14,
                "min": 0
              },
              "elementType": "INTEGER",
              "fieldName": "segment",
              "options": [],
              "required": true,
              "size": {
                "max": 15,
                "min": 1
              }
            },

that tells us that there are only 15 segments. The metadata for a lot of devices is a bit wonky, so it doesn't surprise me that this is wrong for your device.

Are you able to try manually curl'ing or postman'ing the API to see if it will actually accept setting controls for segments outside of that range?

https://developer.govee.com/reference/control-you-devices#segment_color_setting has some details.

If you can prove that it will work to ignore the limits in the API, we can look at potentially adding a quirk to make that work for this device.

However, this is really a bug in Govee's API data and should be reported to them to resolve at the source.

I am not quite advanced enough to try to manually curling or postmanning the API. If you have steps you want to give me, I am able to do that. But I can report this to Govee and see if they can resolve it as well.