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

Switches with client clusters on multiple endpoints #2541

Closed
ebaauw opened this issue Mar 6, 2020 · 2 comments
Closed

Switches with client clusters on multiple endpoints #2541

ebaauw opened this issue Mar 6, 2020 · 2 comments

Comments

@ebaauw
Copy link
Collaborator

ebaauw commented Mar 6, 2020

Referring to #635 (comment). Some switches, e.g. ubisys, Busch-Jaeger, innr RC 110, iCasa remote, have multiple endpoints with client clusters, controlling a different group of lights from a different (set op) button(s).

The preferred way to expose these switches is to create a single ZHASwitch resource (for the first endpoint), and map the buttonevents from the other endpoints to this resource. The config.group attribute contains a comma-separated list of (decimal) group IDs, instead of a single group ID.

While this was implemented for the ubisys (and the Busch-Jaeger ?) switches, I didn't dara to implement it for the innr RC 110 (#635) nor for the iCasa remote (#1978), because I saw some errors in the deCONZ log. Looking into these errors, they are caused by some (old?) code not considering that config.group might contain a list of groups.

const QString &gid = item->toString();

Group *group = getGroupForId(item->toString());

Some of the (newer) code actually does:

QStringList gids = item->toString().split(',', QString::SkipEmptyParts);

As far as I can tell, the old code is used only as a safety net to ensure the /groups resources are available for the group (!) mentioned in the sensor's config.group. Meaning, it's probably safe to ignore the errors and expose the innr and icasa remotes using a single /sensors resource.

@ebaauw
Copy link
Collaborator Author

ebaauw commented Mar 6, 2020

And some more places:

if (item->toString() != group->id())

item->setValue(group->id());

I'm not sure what the idea behind adding uniqueid for /groups resources was, but it's not unique. When the group is created on seeing a group command from a client cluster, it isn't filled. For devices with client clusters on multiple endpoints, all the associated groups get the same uniqueid. At least we should add the switch endpoint to the group's uniqueid.

@ebaauw
Copy link
Collaborator Author

ebaauw commented Mar 6, 2020

I think I nailed it. With above commit, both innr RC 110 and icasa Remote are now exposed as a single ZHASwitch resource, with 7 resp. 4 group IDs in config.group. The groups are created on pairing and bound (or added for the first endpoint of the RC 110).

{
  "config": {
    "group": "7,8,9,10,11,12,13",
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "052534871cd8bc9ee915b68e4a6ec3a2",
  "manufacturername": "innr",
  "mode": 1,
  "modelid": "RC 110",
  "name": "RC 110 5",
  "state": {
    "buttonevent": 25002,
    "lastupdated": "2020-03-06T17:48:50"
  },
  "swversion": "0x21000e46",
  "type": "ZHASwitch",
  "uniqueid": "00:15:8d:00:01:0c:44:37-01-0006"
}
{
  "action": {
    "bri": 127,
    "colormode": "hs",
    "ct": 0,
    "effect": "none",
    "hue": 0,
    "on": true,
    "sat": 127,
    "scene": null,
    "xy": [
      0,
      0
    ]
  },
  "devicemembership": [
    "5"
  ],
  "etag": "7ea59290de30c44f9f5ac81acda48f62",
  "id": "7",
  "lights": [],
  "name": "RC 110 5",
  "scenes": [],
  "state": {
    "all_on": false,
    "any_on": false
  },
  "type": "LightGroup",
  "uniqueid": "00:15:8d:00:01:0c:44:37-01"
}
{
  "config": {
    "battery": 75,
    "group": "3,4,5,6",
    "on": true,
    "reachable": true
  },
  "ep": 1,
  "etag": "097440418c7be2fe7217d340fccbe84b",
  "manufacturername": "icasa",
  "mode": 1,
  "modelid": "ICZB-RM11S",
  "name": "ICZB-RM11S 4",
  "state": {
    "buttonevent": 7002,
    "lastupdated": "2020-03-06T17:05:43"
  },
  "swversion": "2.5.3_r20",
  "type": "ZHASwitch",
  "uniqueid": "cc:cc:cc:ff:fe:26:a3:80-01-0006"
}
{
  "action": {
    "bri": 127,
    "colormode": "hs",
    "ct": 0,
    "effect": "none",
    "hue": 0,
    "on": false,
    "sat": 127,
    "scene": null,
    "xy": [
      0,
      0
    ]
  },
  "devicemembership": [
    "4"
  ],
  "etag": "57299c0417ca357c0a295e7b35b892dc",
  "id": "3",
  "lights": [],
  "name": "ICZB-RM11S 4",
  "scenes": [],
  "state": {
    "all_on": false,
    "any_on": false
  },
  "type": "LightGroup",
  "uniqueid": "cc:cc:cc:ff:fe:26:a3:80-01"
}

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

No branches or pull requests

1 participant