Skip to content

Resourcelinks

Erik Baauw edited this page Sep 3, 2024 · 11 revisions

Introduction

A resource link is a type of resource on the deCONZ gateway. Resource links are maintained using the deCONZ REST API, through the /resourcelinks endpoint.

As the name suggests, a resource link contains a list of links to other resources. The deCONZ gateway doesn't do anything with resource links, but API clients can use these to keep track of what resources belong together, interact with each other.

Use of Resource Links

Homebridge deCONZ uses resource links for advanced configuration, i.e. configuration per individual resource of a device, rather than per device. The configuration per device is done through Dynamic Configuration. Resource links take precedence over dynamic configuration, changing the way dynamic configuration sees the devices exposed by deCONZ.

Homebridge deCONZ uses resource links to:

  • To specify which resources not to expose (blacklist);
  • To split multiple resource for the same device into different accessories (splitdevice).

Supported Resource Links

Homebridge deCONZ recognises resource links with a name of "homebridge-deconz" and a description specifying the type, see Resource Link Types below. Homebridge deCONZ recognises resource links from any owner. This means that resource links are shared between all instances of Homebridge deCONZ connecting to the bridge/gateway, unlike the dynamic configuration.

Resource Link Types

Homebridge Hue recognises the following types of resource links:

Type Resources Description
blacklist /lights
/sensors
Blacklist of resources not to expose.
Multiple blacklist resource links can be used; Homebridge deCONZ combines these into a single blacklist.
splitdevice /lights
/sensors
Resources to expose as separate accessory.
For wired in-wall switches with multiple gangs controlling lights in different rooms, or for multi-zone presence sensors with zones in different rooms.
Multiple splitdevice resource links can be used.

Maintaining Resource Links

As mentioned in the Introduction, resource links are maintained through the API.

  • To get an overview of all resourcelinks, do a GET of /resourcelinks;
  • To get a single resourcelink, do a GET of /resourcelinks/id;
  • To create a resource link, do a POST to /resourcelinks.
  • To update the linked resources, do a PUT to the /resourcelinks/id resource. Note that you need to specify all resources under links when updating the resource link. You cannot add or remove a single entry from links;
  • To delete a resource link, do a DELETE of /resourcelinks/id.

Examples

Blacklist

If you have a dual-gang wired in-wall switch but use only one output, you might want to blacklist the resource corresponding to the unused output (e.g. /lights/10. To do this, create the following resourcelink:

$ deconz post /resourcelinks '{
  "name": "homebridge-deconz",
  "classid": 1,
  "description": "blacklist",
  "links": [
    "/lights/10"
  ],
  "recycle": false
}'
"3"
$ deconz get /resourcelinks/3
{
  "classid": 1,
  "description": "blacklist",
  "links": [
    "/lights/10"
  ],
  "name": "homebridge-deconz",
  "owner": "**********",
  "recycle": false,
  "type": "Link"
}

Split Device

If you have a dual-gang wired in-wall switch where the second output controls the light in a different room, you might want to expose the second output as a separate accessory. To do this, create the following resourcelink:

$ deconz post /resourcelinks '{
  "name": "homebridge-deconz",
  "classid": 1,
  "description": "splitdevice",
  "links": [
    "/lights/10"
  ],
  "recycle": false
}'
"4"
$ deconz get /resourcelinks/4
{
  "classid": 1,
  "description": "splitdevice",
  "links": [
    "/lights/10"
  ],
  "name": "homebridge-deconz",
  "owner": "**********",
  "recycle": false,
  "type": "Link"
}
Clone this wiki locally