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

MultiCLIP explanation #164

Closed
jpaquino3 opened this issue Sep 19, 2017 · 6 comments
Closed

MultiCLIP explanation #164

jpaquino3 opened this issue Sep 19, 2017 · 6 comments
Labels

Comments

@jpaquino3
Copy link

I am at a loss on which file I need to edit for MultiCLIP. Would you mind explaining in greater detail? Thanks!

@ebaauw
Copy link
Owner

ebaauw commented Sep 19, 2017

MultiCLIP is a trick to combine multiple CLIP sensors on the Hue bridge into one HomeKit accessory, to avoid hitting the HomeKit limit of 99 accessories per HomeKit bridge. It's very much like how the Hue motion sensor is exposed: one HomeKit accessory with multiple services (one for each resource) instead of a different accessory per resource.

You don't need to edit any file, you just need to create your CLIP sensors on the Hue bridge, with the following attributes:

  • manufacturername must be "homebridge-hue";
  • modelid must be equal to type (so CLIPGenericFlag, CLIPGenericStatus, ...);
  • uniqueid must be unique and of the form "id-subtype". All CLIP sensors with the same id are then combined into one accessory.

For example, I've created the following sensors to control my Living Room (this is on deCONZ, but it's the same for the Hue bridge):

{
  "config": {
    "on": true,
    "reachable": true
  },
  "etag": "b559f5b22f93fea07906a679c8c56932",
  "manufacturername": "homebridge-hue",
  "modelid": "CLIPGenericFlag",
  "name": "Living Room",
  "state": {
    "flag": true,
    "lastupdated": "2017-09-19T20:46:14"
  },
  "swversion": "1",
  "type": "CLIPGenericFlag",
  "uniqueid": "/sensors/220-220"
}

and

{
  "config": {
    "on": true,
    "reachable": true
  },
  "etag": "c0546974f862e1b1c79ce10b02ab28d8",
  "manufacturername": "homebridge-hue",
  "modelid": "CLIPGenericStatus",
  "name": "Living Room Status",
  "state": {
    "lastupdated": "2017-09-19T20:46:22",
    "status": 1
  },
  "swversion": "-1,3",
  "type": "CLIPGenericStatus",
  "uniqueid": "/sensors/220-221"
}

In HomeKit, this becomes:
img_0009
Note how I (ab)use swversion to set the allowed values for the status, so Eve adjust the slider accordingly.

Another example is my virtual weather station, for which I've created the following:

{
  "config": {
    "on": true,
    "reachable": true
  },
  "etag": "0f293e90fd4625487b7a509cc827f352",
  "manufacturername": "homebridge-hue",
  "modelid": "CLIPHumidity",
  "name": "Terrace Humidity",
  "state": {
    "humidity": 7400,
    "lastupdated": "2017-09-19T20:50:04"
  },
  "swversion": "0",
  "type": "CLIPHumidity",
  "uniqueid": "/sensors/340-347"
}
{
  "config": {
    "on": true,
    "reachable": true
  },
  "etag": "0f293e90fd4625487b7a509cc827f352",
  "manufacturername": "homebridge-hue",
  "modelid": "CLIPPressure",
  "name": "Terrace Air Pressure",
  "state": {
    "lastupdated": "2017-09-19T20:50:04",
    "pressure": 1020
  },
  "swversion": "0",
  "type": "CLIPPressure",
  "uniqueid": "/sensors/340-348"
}
{
  "config": {
    "on": true,
    "reachable": true
  },
  "etag": "0f293e90fd4625487b7a509cc827f352",
  "manufacturername": "homebridge-hue",
  "modelid": "CLIPTemperature",
  "name": "Terrace Temperature",
  "state": {
    "lastupdated": "2017-09-19T20:50:04",
    "temperature": 1280
  },
  "swversion": "0",
  "type": "CLIPTemperature",
  "uniqueid": "/sensors/340-349"
}

This becomes:
img_0010

If you use ph_sensors.sh, creating these CLIP sensors is as easy as issuing from the command line:

ph_sensor_clip_flag         220 220 "Living Room"
ph_sensor_clip_status       221 220 "Living Room Status"        -1 3
ph_sensor_clip_humidity     347 340 "Terrace Humidity"
ph_sensor_clip_pressure     348 340 "Terrace Air Pressure"
ph_sensor_clip_temperature  349 340 "Terrace Temperature"

@jpaquino3
Copy link
Author

Thank you so much!

@ebaauw
Copy link
Owner

ebaauw commented Mar 10, 2018

As of v0.8.4, MultiCLIP resources are created using resourcelinks, like:

{
  "classid": 1,
  "description": "multiclip",
  "links": [
    "/sensors/347",
    "/sensors/348",
    "/sensors/349"
  ],
  "name": "homebridge-hue",
  "owner": "xxxxxxxxxx",
  "recycle": false,
  "type": "Link"
}

You no longer need to set the manufacturername, modelid, and uniqueid of the /sensors resource to create a MultiCLIP accessory, as described above. This method still works, but will be deprecated.

Similarly, you can create a MultiLight resource, to combine multiple lights (e.g. in a single chandelier) into one accessory:

{
  "classid": 1,
  "description": "multilight",
  "links": [
    "/lights/221",
    "/lights/222",
    "/lights/223",
    "/lights/224",
    "/lights/225",
    "/lights/226"
  ],
  "name": "homebridge-hue",
  "owner": "xxxxxxxxxx",
  "recycle": false,
  "type": "Link"
}

The serial number and the name for the MultiLight or MultiCLIP accessory are taken from the first (valid) resource in links.

Run homebridge -D to see debug messages:

[2018-3-10 11:49:01] [Hue] pi2: /resourcelinks/221: 6 multilight entries
[2018-3-10 11:49:01] [Hue] pi2: /resourcelinks/347: 3 multiclip entries
...
[2018-3-10 11:49:01] [Hue] pi2: 0017880100xxxxxx: dresden elektronik MultiLight "Living Room 1"
[2018-3-10 11:49:01] [Hue] pi2: /lights/221: Extended color light "Living Room 1"
[2018-3-10 11:49:01] [Hue] pi2: /lights/222: Extended color light "Living Room 2"
[2018-3-10 11:49:01] [Hue] pi2: /lights/223: Extended color light "Living Room 3"
[2018-3-10 11:49:01] [Hue] pi2: /lights/224: Extended color light "Living Room 4"
[2018-3-10 11:49:01] [Hue] pi2: /lights/225: Extended color light "Living Room 5"
[2018-3-10 11:49:01] [Hue] pi2: /lights/226: Extended color light "Living Room 6"
...
[2018-3-10 11:49:01] [Hue] pi2: 00212EFFFFxxxxxx-347: dresden elektronik MultiCLIP "Terrace Weather"
[2018-3-10 11:49:01] [Hue] pi2: /sensors/347: CLIPTemperature "Terrace Weather"
[2018-3-10 11:49:01] [Hue] pi2: /sensors/348: CLIPHumidity "Terrace Weather"
[2018-3-10 11:49:01] [Hue] pi2: /sensors/349: CLIPPressure "Terrace Weather"

@ooii
Copy link

ooii commented May 24, 2018

Hi,

I wanted to create a MultiCLIP accessory from a Xiaomi temperature/pressure/humidity sensor, which ids are resp. 44,45, and 59.
I used ph as follows:

ph post /resourcelinks '{
	"classid": 1,
	"description": "multiclip",
	"links": [
		"/sensors/44",
		"/sensors/45",
		"/sensors/59"
	],
	"name": "homebridge-hue",
	"recycle": false
}'

And that has created a resourcelink. However, when restarting homebridge-hue, I have the following output:

[2018-5-24 23:35:18] [Hue] conBee: /resourcelinks/10: /sensors/44: ignoring unsupported multiclip resource
[2018-5-24 23:35:18] [Hue] conBee: /resourcelinks/10: /sensors/45: ignoring unsupported multiclip resource
[2018-5-24 23:35:18] [Hue] conBee: /resourcelinks/10: /sensors/59: ignoring unsupported multiclip resource

Should I first create CLIPTemperature, CLIPHumidity, and CLIPPressure and assign them to the resourcelink?

Thanks.

@ebaauw
Copy link
Owner

ebaauw commented May 24, 2018

I wanted to create a MultiCLIP accessory from a Xiaomi temperature/pressure/humidity sensor

Why on earth would you want to do that?

@ooii
Copy link

ooii commented May 25, 2018

Because I thought that the three sensors are exposed as three accessories. Why did I think that? No idea.

@ebaauw ebaauw mentioned this issue Aug 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants