Skip to content
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

Gateway cascade enhancements (and some more) #338

Merged
merged 9 commits into from
Jan 4, 2018
Merged

Gateway cascade enhancements (and some more) #338

merged 9 commits into from
Jan 4, 2018

Conversation

ebaauw
Copy link
Collaborator

@ebaauw ebaauw commented Dec 21, 2017

Several enhancements for gateway cascade functionality, see #287:

  • Cascade setting action.on and action.bri, with or without action.transitiontime from the REST API;
  • Cascade recalling scenes to the Hue bridge: support Hue bridge syntax for scene commands, see Scene API #29;
  • Cascade all commands sent by the Hue dimmer switch in group mode;
  • Cascade all commands sent by the IKEA Trådfri remote in group mode.

Notes:

  • The Hue dimmer switch actually sends multiple Step commands (~one every second) while holding the DimUp or DimDown button; the Trådfri remote sends a single Move command and relies on the Stop command (on long release) to stop the current movement;
  • The Trådfri remote sends a Toggle command on the On/Off button. As this is not supported by the REST API, action.on is set to true (false) when local group state.all_on is false (true);
  • Currently, the DimUp and DimDown buttons (for both the Hue and the Trådfri) can only be cascaded to a Hue bridge, as deCONZ hasn't yet implemented bri_inc (see state.bri_inc not yet implemented? #84).

Todo:

  • Cascade setting action.ct and action.xy from the REST API.

Other changes:

  • Change ubisys dimmer buttonevents;
  • Only expose ZHASwitch sensor resources for Analog Input and Multistate Input clusters for the Xiaomi Smart Cube, not for other devices. Apparently, sometimes other Xiaomi devices advertise these clusters.

@ebaauw ebaauw mentioned this pull request Dec 21, 2017
@ebaauw ebaauw mentioned this pull request Dec 21, 2017
@ebaauw ebaauw changed the title Gateway cascade fix for Hue dimmer switch, see #287 Gateway enhancements for cascading to Hue bridge Dec 21, 2017
Simple _Move to level_ for setting `action.bri` and _Step_ and _Stop_
as issued by Hue dimmer switch.
Send set remote group `action.on` to true (false) when local group
`state.all_on` is false (true).
@ebaauw ebaauw changed the title Gateway enhancements for cascading to Hue bridge Gateway enhancements Dec 24, 2017
@ebaauw ebaauw changed the title Gateway enhancements Gateway cascade enhancements Dec 24, 2017
ebaauw added 2 commits January 4, 2018 11:29
Only create ZHASwitch resources for _Analog Input_ (0x000c) and
_Multistate Input_ (0x0012) clusters for the Xiaomi Smart Cube.  See
ebaauw/homebridge-hue#245 and
ebaauw/homebridge-hue#203.
Expose ubisys dimmer inputs as two buttons (left and right), with
SHORT_RELEASE, HOLD, and LONG_RELEASE, rather than separate buttons for
On/Off, DimUp, and DimDown for both left and right.
@ebaauw ebaauw changed the title Gateway cascade enhancements Gateway cascade enhancements (and some more) Jan 4, 2018
ebaauw added a commit to ebaauw/homebridge-hue that referenced this pull request Jan 4, 2018
In line with
dresden-elektronik/deconz-rest-plugin#338
s/7d5a2c371adaecd649ec152d523747d5eb7d447b.
@@ -2694,13 +2694,17 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node)

case ANALOG_INPUT_CLUSTER_ID:
{
fpSwitch.inClusters.push_back(ci->id());
if (modelId == QLatin1String("lumi.sensor_cube")) {
Copy link
Member

Choose a reason for hiding this comment

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

We may need to extend this whitelist in future, I'm not sure but I think there were other sensors using the analog/multi-state clusters too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I double-checked that I introduced these clusters when adding support for the Smart Cube. Also, the handling of the attribute values is specific to the cube.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alternatively we could to blacklist the “funny” sensors (so far I’ve seen reports of lumi.sensor_ht and lumi.switch_86sw2 showing additional endpoints with these clusters).

@manup
Copy link
Member

manup commented Jan 4, 2018

Thanks a lot, I'll merge the PR now but can't test it currently (back in end of January).

Maybe in future the support for proper external web hooks in rules replaces the cascades with a simpler general way to forward REST API requests to an arbitrary destination.

See also #347

Luckily the implementation will be fairly simple due QNetworkManager. :)

@manup manup merged commit 1c5ee83 into dresden-elektronik:master Jan 4, 2018
@ebaauw
Copy link
Collaborator Author

ebaauw commented Jan 4, 2018

Maybe in future the support for proper external web hooks in rules replaces the cascades with a simpler general way to forward REST API requests to an arbitrary destination.

Maybe, maybe not. There’s something to say for webhooks, especially if they can be attached to rule actions. You’d be able to interact with any REST api, not just the deCONZ/Hue API. With cascade, you actually forward ZigBee commands as deCONZ/Hue REST API calls. I’m amazed how fast this works, when the commands are sent by ZigBee switches or sensors, compared to commands sent by the gateway (looks like the gateway only cascades these when it reads back the groupcasts).

The translation of ZigBee commands to REST API calls is somewhat crude. I’d love someday to design a more consistent and complete API, with different endpoints for (write-only) commands, /actions/..., read-only attributes, /state/..., and writeable attributes, /config/....

@manup
Copy link
Member

manup commented Jan 4, 2018

Agree, they both have their use cases. Setup for cascades is also easier since it's just a group a forward to group b mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants