Skip to content

DDFs for Trådfri bulbs #7213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 14, 2023
Merged

DDFs for Trådfri bulbs #7213

merged 14 commits into from
Sep 14, 2023

Conversation

ebaauw
Copy link
Collaborator

@ebaauw ebaauw commented Sep 8, 2023

Updated the DDFs for the Trådfri bulbs I still had lying around in a drawer.

TRADFRI bulb E27 W opal 1000lm

  • Updated existing DDF for Dimmable Light
  • Added capabilities: alert/trigger_effect;
  • Added config items: bri/execute_if_off, bri/on_level, bri/onoff_transition_time, bri/startup, on/startup;
  • Updated attribute reporting settings to 1/300/1 and changed refresh.interval to 305.

TRADFRI bulb E27 WS opal 980lm

  • New DDF for Color Temperature Light.
  • This light reports a weird character in the Manufacturer Name, causing deCONZ to report it as hex string. The DDF should correct this.
  • capabilities items: alert/trigger_effect, bri/move_with_onoff, color/capabilities, color/ct/max, color/ct/min, on/off_with_effect, transition_block;
  • config items: bri/execute_if_off, bri/on_level,bri/onoff_transition_time, bri/startup, color/ct/startup, color/execute_if_off on/startup;
  • Attribute reporting settings to 1/300/1 and changed refresh.interval to 305.

TRADFRI bulb E27 CWS opal 600lm

  • Renamed existing DDF file and bumped status to Gold.
  • This light identified as Color Dimmable Light. Despite it's name, it doesn't support colour temperature, so it's exposed as a Color Light.
  • capabilities items: alert/trigger_effect, bri/move_with_onoff, color/capabilities, color/xy/..., on/off_with_effect, transition_block;
  • We don't know the actual colour gamut, so we report the default colour gamut;
  • config items: bri/execute_if_off, bri/on_level,bri/onoff_transition_time, bri/startup, color/execute_if_off, on/startup;
  • Updated attribute reporting settings to 1/300/1 and changed refresh.interval to 305.

TRADFRI bulb E27 CWS 806lm

  • Renamed DDF file.
  • capabilities items: bri/move_with_onoff, color/capabilities, color/xy/..., on/off_with_effect;
  • This is the first IKEA light that doesn't contain the transition_block firmware bug. But it doesn't support Trigger Effect.
  • config items: bri/execute_if_off, bri/on_level,bri/onoff_transition_time, bri/startup, color/ct/startup, color/execute_if_off, on/startup;
  • Updated attribute reporting settings to 1/300/1 and changed refresh.interval to 305.

@ebaauw ebaauw requested a review from manup September 8, 2023 12:43
@ebaauw ebaauw added the Device Improvement Additional tag to attach to a existing issue. label Sep 8, 2023
@manup
Copy link
Member

manup commented Sep 8, 2023

Interesting, the hex conversion happens because the string isn't UTF-8 encoded. It is actually "TRADFRI bulb E27 WS opal 980lm"

0x545241444652492062756c6220453237205753 this part is valid UTF-8 "TRADFRI bulb E27 WS".

But hex 0xa0 in binary is 1010 0000 which in UTF-8 is the second, third, or fourth byte. But the previous byte is 0x53 which is the 1-byte ASCII char S so this is not a multi-byte character sequence.

Digging a bit deeper the string is actually latin1 encoded! 0xa0 is "non-breaking space" here.

The deCONZ ZCL attribute reader plays strict UTF-8 here (which implicitly includes ASCII) and just returns the whole sequence as hex string. Perhaps I should expand it to alternatively try to latin1 decode if UTF-8 fails, we have seen other strings which where also returned as hex string, perhaps the same issue.

@manup
Copy link
Member

manup commented Sep 8, 2023

image


It is allowed to use non UTF-8 but should be stated in the complex descriptor, which I've never seen available in a product (can be seen in the Node Info panel).

@ebaauw
Copy link
Collaborator Author

ebaauw commented Sep 8, 2023

From my pet shark on the wire:

ZigBee Cluster Library Frame, Command: Read Attributes Response, Seq: 29
    Frame Control Field: Profile-wide (0x18)
    Sequence Number: 29
    Command: Read Attributes Response (0x01)
    Status Record, String: TRADFRI bulb E27 WS�opal 980lm
        Attribute: Model Identifier (0x0005)
        Status: Success (0x00)
        Data Type: Character String (0x42)
        String: TRADFRI bulb E27 WS�opal 980lm
0000   1e 54 52 41 44 46 52 49 20 62 75 6c 62 20 45 32   .TRADFRI bulb E2
0010   37 20 57 53 a0 6f 70 61 6c 20 39 38 30 6c 6d      7 WS.opal 980lm

When I got the light, it didn't include the weird character, but it appeared after a firmware update.

Last time I checked, the Hue bridge chokes on this as well, and shows an empty modelid in the API. deCONZ used to show TRADFRI bulb E27 WS�opal 980lm. I think either way (hex string or string with weird character), we'd better fix the model.

manup added a commit to dresden-elektronik/deconz-lib that referenced this pull request Sep 8, 2023
This chang converts Latin1 strings to UTF-8. Only strings with printable characters are considered, since we don't know for sure the encoding (but after UTF-8 latin1 is most popular).

Seen for a Ikea light: dresden-elektronik/deconz-rest-plugin#7213

Perhaps this covers also other cases where we have seen weird strings.
@manup
Copy link
Member

manup commented Sep 8, 2023

I've extended the attribute reader to detect and convert Latin1 strings to UTF-8 and only contain printable characters.
Also as an opinionated implementation soft-hyphens will be changed to simple minus - and "non breakable space" to simple ASCII space 0x20 since these are easier to type in a DDF and impossible to spot visually when just looking at a string.

There fore the DDF only needs to contain the ASCII string: "TRADFRI bulb E27 WS opal 980lm" (with normal space after WS).

dresden-elektronik/deconz-lib@1940240

@ebaauw ebaauw marked this pull request as ready for review September 9, 2023 09:27
@ebaauw ebaauw added this to the v2.23.1-beta milestone Sep 9, 2023
@manup manup merged commit 72a89fc into dresden-elektronik:master Sep 14, 2023
@ebaauw ebaauw deleted the tradfri branch September 14, 2023 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Device Improvement Additional tag to attach to a existing issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants