Skip to content

Some more Hue lights - #6936

Merged
manup merged 22 commits into
dresden-elektronik:masterfrom
ebaauw:hue-lights
May 23, 2023
Merged

manup merged 22 commits into
dresden-elektronik:masterfrom
ebaauw:hue-lights

Conversation

@ebaauw

@ebaauw ebaauw commented Apr 30, 2023 •

Copy link
Copy Markdown
Collaborator

Additional models

See Discord, #restapi-issues channel.

productname

Expose productname for "all" Hue devices exposed through DDF:

  • Read for light-oids, using 0xC0/0xC1 manufacturer-specific commands on the Basic cluster. The offset for the 0xC0 command is computed using the modelid and manufacturername items, instead of taking these from the 0xC1 response at offset 0. This way, only a single 0xC0 needs to be issued.
  • Hardcoded sensor-oids. These have a dedicated DDF per model anyway, and 0xC0/0xC1 doesn't work for all sensor-oids (notably the Hue motion sensor family report themselves as Hue dimmer switch).

cmd in DDF read and write

Add support for cmd (instead of attr) in read and write functions of item in DDF. Both take an optional eval to specify the command payload as hex string.

  • Add ZCL_WriteAttribute() and ZCL_SendCommand() to zcl.cpp;
  • Move ZCL handling from WriteZCLAttribute() in device_access_fn.cpp to ZCL_WriteAttribute();
  • Call ZCL_SendCommand() from ReadZCLAttribute() and WriteZCLAttribute() to send the specified command instead of Read Attributes or Write Attributes.

ebaauw added 2 commits April 30, 2023 18:39
Add LCA008 (1600lm E27 bulb) and Iris gen4, see Discord.
@ebaauw
ebaauw requested a review from manup April 30, 2023 19:07
@ebaauw ebaauw added this to the v2.22.1-beta milestone Apr 30, 2023
ebaauw added 10 commits May 4, 2023 20:54
Remove Hue-specific command.
Shut up eslint warning.
- Create `ZCL_WriteAttribute()` and `ZCL_SendCommand()` in spirit of `ZCL_ReadAttributes()`;
- Move ZCL logic from `writeZclAttribute()` to `ZCL_WriteAtrribute()`;
- Call `ZCL_SendCommand()` from `readZclAttribute()` and `writeZclAttribute()`.
Attribute is read-only.
Only update item when real productname has been found.  Use the dummy assignment, to see offset in deCONZ log.
Compute offset from modelid and manufacturername, rather than parsing the 0xC1 from offset 0.
@ebaauw
ebaauw requested a review from SwoopX May 5, 2023 10:19
ebaauw added 6 commits May 5, 2023 15:32
- Use `zcl:attr` and `zcl:cmd` instead of deprecated `zcl` for `fn`.
- Hue motion sensor family: Remove `config/ledindication` and `config/usertest` from ZHALightLevel and ZHATemeprature resources.  These attributes apply only to the ZHAPresence.
Don't use Qt here.
Don't use Qt here.
Display `productname` in API.
- Deprecate `"fn": "zcl"` in favour of `"fn": "zcl:attr"` and `"fn": "zcl:cmd"` at manup's request;
- Define separate function for sending command from `read` and from `write`;
- Handle no Qt in `zcl.cpp`.
@SwoopX

SwoopX commented May 9, 2023

Copy link
Copy Markdown
Collaborator

I guess I like the proposed changes on the functions, especially as this presumably solves one of my experienced annoyances and I don't need to code it myself 🙂

Iirc from fiddling around back in the days, command usage will fail when involving any state changes. However, totally fine for me for the time being and saving it as stage 2 for later.

@SwoopX

SwoopX commented May 19, 2023 •

Copy link
Copy Markdown
Collaborator

@ebaauw Could you please also include a change for this particular code here?

item->setValue(s);

and make it item->setValue(s, ResourceItem::SourceDevice); ?

This would allow using the read cmd for config/schedule. Without the suggested change, the command is send in an infinite loop, as the item get an incorrect value source causing unwanted poll behavior.

@ebaauw

ebaauw commented May 20, 2023

Copy link
Copy Markdown
Collaborator Author

Could you please also include a change for this particular code here?

@SwoopX : 81376ca375823291359b0510969d8b86c88b4622

No idea what it does, but it compiles.

@manup

manup commented May 20, 2023

Copy link
Copy Markdown
Member

The ResourceItem::SourceDevice parameter tells the StateChange API where a value comes from (API, unknown, device).
It helps figuring out if a value set via the REST-API was actually applied.

@ebaauw ebaauw added the Device Improvement Additional tag to attach to a existing issue. label May 20, 2023

@manup manup left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a few minor comments, overall the PR looks pretty good to me.

Comment thread device_access_fn.cpp Outdated
Comment thread device_access_fn.cpp Outdated
Comment thread device_access_fn.cpp Outdated
Comment thread device_access_fn.cpp Outdated
@manup
manup merged commit 8c2590c into dresden-elektronik:master May 23, 2023
@ebaauw
ebaauw deleted the hue-lights branch May 23, 2023 17:53
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.

3 participants