dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 498 forks source link

Incorrect light type for LEDVANCE A19 RGBW #6591

Open Thomas-Vos opened 1 year ago

Thomas-Vos commented 1 year ago

Describe the bug

A user reported that their LEDVANCE A19 RGBW has the wrong light type. It is reported as a Color temperature light but it also supports setting a color. So it should be Extended color light instead.

https://community.hueessentials.com/t/ledvance-a19-rgbw-bulb-no-color-controls/4579

Steps to reproduce the behavior

N/A

Expected behavior

Extended color light as light type

Screenshots

Capture4 https://community.hueessentials.com/t/ledvance-a19-rgbw-bulb-no-color-controls/4579

Environment

N/A

deCONZ Logs

N/A

Additional context

https://github.com/dresden-elektronik/deconz-rest-plugin/pull/3721 https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3365

Mimiix commented 1 year ago

Hi Thomas

Can you (or ask the user to) provide the rest api response ?

Kind regards,

Thomas-Vos commented 1 year ago

@Mimiix already discussed the issue with the devs on Discord, and I asked the user to provide the DDF so the bug can be fixed. It seems deCONZ is overriding the light type incorrectly here: https://github.com/dresden-elektronik/deconz-rest-plugin/blob/5d136aed7d2e79df663ab3f907954b6f3e6662bf/de_web_plugin.cpp#L3260

I will make a PR to fix this code, and once the user reports the DDF it can be fixed in a DDF as well.

Mimiix commented 1 year ago

Aah okay. Good to hear you figured it out!

Smanar commented 1 year ago

Have found capture here https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3365#issuecomment-703791010 Will be nice if he can share the "auto generated" DDF, when selecting a node and making "Edit DDF", the DDF is on the third tab "preview"

In theorie just need to replace

"type": "$TYPE_COLOR_TEMPERATURE_LIGHT", by "type": "$TYPE_EXTENDED_COLOR_LIGHT",

In the "auto generated" DDF, but you can miss some fields too, like state/x or state/y, can need too to freeze for exemple the state/colormode.

Will be usefull if we can have the attribute list in the cluster 0x0300.

Thomas-Vos commented 1 year ago

Created a PR to fix the legacy code here: https://github.com/dresden-elektronik/deconz-rest-plugin/pull/6592

Ltek commented 1 year ago

I changed the type in the DDF and Hue Essentials now correctly controls the bulb... though HE still shows it as 'unknown'. I also set the DDF to 'gold'

stock DDF...

{ "schema": "devcap1.schema.json", "manufacturername": "LEDVANCE", "modelid": "A19 RGBW", "product": "A19 RGBW", "sleeper": false, "status": "Draft", "subdevices": [ { "type": "$TYPE_COLOR_TEMPERATURE_LIGHT", "restapi": "/lights", "uuid": [ "$address.ext", "0x01" ], "items": [ { "name": "attr/id" }, { "name": "attr/lastannounced" }, { "name": "attr/lastseen" }, { "name": "attr/manufacturername" }, { "name": "attr/modelid" }, { "name": "attr/name" }, { "name": "attr/swversion" }, { "name": "attr/type" }, { "name": "attr/uniqueid" }, { "name": "config/colorcapabilities", "description": "The supported color modes as bitmap.", "refresh.interval": 84000 }, { "name": "config/ctmax", "description": "Maximum supported color temperature.", "refresh.interval": 84000 }, { "name": "config/ctmin", "description": "Minimum supported color temperature.", "refresh.interval": 84000 }, { "name": "state/alert", "description": "The currently active alert effect.", "default": "none" }, { "name": "state/bri", "description": "The current brightness.", "refresh.interval": 5 }, { "name": "state/colormode", "description": "The currently active color mode.", "refresh.interval": 300 }, { "name": "state/ct", "description": "The current Mired color temperature of the light. Where Mired is 1000000 / color temperature (in kelvins).", "refresh.interval": 5 }, { "name": "state/effect", "description": "The currently active effect.", "default": "none" }, { "name": "state/hue", "description": "The current color hue." }, { "name": "state/on", "description": "True when device is on; false when off.", "refresh.interval": 5 }, { "name": "state/reachable" }, { "name": "state/sat", "description": "The current color saturation.", "refresh.interval": 5 }, { "name": "state/x", "description": "The current color x coordinate.", "refresh.interval": 5 }, { "name": "state/y", "description": "The current color y coordinate." } ] } ], "bindings": [ { "bind": "unicast", "src.ep": 1, "dst.ep": 1, "cl": "0x0006", "report": [ { "at": "0x0000", "dt": "0x10", "min": 1, "max": 300 } ] }, { "bind": "unicast", "src.ep": 1, "dst.ep": 1, "cl": "0x0008", "report": [ { "at": "0x0000", "dt": "0x20", "min": 1, "max": 300, "change": "0x00000001" } ] }, { "bind": "unicast", "src.ep": 1, "dst.ep": 1, "cl": "0x0300", "report": [ { "at": "0x0007", "dt": "0x21", "min": 1, "max": 300, "change": "0x00000001" }, { "at": "0x0003", "dt": "0x21", "min": 1, "max": 300, "change": "0x0000000A" }, { "at": "0x0004", "dt": "0x21", "min": 1, "max": 300, "change": "0x0000000A" }, { "at": "0x0008", "dt": "0x30", "min": 1, "max": 300 } ] } ] }

Thomas-Vos commented 1 year ago

Thanks a lot for the DDF!

The unknown in Hue Essentials is unrelated to this issue and will be fixed in the next version, it's just a missing icon.

Smanar commented 1 year ago

@Ltek Nice thx ^^

Have updated the DDF,

{
  "schema": "devcap1.schema.json",
  "manufacturername": "LEDVANCE",
  "modelid": "A19 RGBW",
  "product": "A19 RGBW",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_EXTENDED_COLOR_LIGHT",
      "restapi": "/lights",
      "uuid": [
        "$address.ext",
        "0x01"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/colorcapabilities",
          "static": 16
        },
        {
          "name": "config/ctmax",
          "static": 666
        },
        {
          "name": "config/ctmin",
          "static": 142
        },
        {
          "name": "state/alert",
          "default": "none"
        },
        {
          "name": "state/bri",
          "refresh.interval": 600
        },
        {
          "name": "state/colormode",
          "refresh.interval": 84000
        },
        {
          "name": "state/ct",
          "refresh.interval": 600
        },
        {
          "name": "state/effect",
          "default": "none"
        },
        {
          "name": "state/hue",
          "refresh.interval": 600
        },
        {
          "name": "state/on",
          "refresh.interval": 600
        },
        {
          "name": "state/reachable"
        },
        {
          "name": "state/sat",
          "refresh.interval": 600
        },
        {
          "name": "state/x",
          "refresh.interval": 600
        },
        {
          "name": "state/y",
          "refresh.interval": 600
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0006",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x10",
          "min": 1,
          "max": 300
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0008",
      "report": [
        {
          "at": "0x0000",
          "dt": "0x20",
          "min": 1,
          "max": 300,
          "change": "0x00000001"
        }
      ]
    },
    {
      "bind": "unicast",
      "src.ep": 1,
      "dst.ep": 1,
      "cl": "0x0300",
      "report": [
        {
          "at": "0x0007",
          "dt": "0x21",
          "min": 1,
          "max": 300,
          "change": "0x00000001"
        },
        {
          "at": "0x0003",
          "dt": "0x21",
          "min": 1,
          "max": 300,
          "change": "0x0000000A"
        },
        {
          "at": "0x0004",
          "dt": "0x21",
          "min": 1,
          "max": 300,
          "change": "0x0000000A"
        },
        {
          "at": "0x0008",
          "dt": "0x30",
          "min": 1,
          "max": 300
        }
      ]
    }
  ]
}

I haven't freezed state/colormode (so this value can be wrong) but have freeezed other as the legacy code do it

        lightNode->addItem(DataTypeUInt16, RConfigCtMin)->setValue(142);
        lightNode->addItem(DataTypeUInt16, RConfigCtMax)->setValue(666);
        lightNode->addItem(DataTypeUInt16, RConfigColorCapabilities)->setValue(0x0001 | 0x0008 | 0x0010);

If you can test the last DDF pls ? You know how to replace them ?

manup commented 1 year ago

I'd propose to add @Smanar DDF. Currently we don't have any LEDVANCE lights available as DDF but a bunch of C++ workarounds predating DDF. So it would be cool to transition these lights to DDF over time and remove the C++ parts after that.

ebaauw commented 1 year ago

Can we please, please create new DDFs first-time-right?

For examples, see: