-
Notifications
You must be signed in to change notification settings - Fork 39
Add new devices in configuration
This section will give you an overview of new way of adding devices supported by the herdsman library using the plugin configuration.
ConfigurableAccessory class is now responsible of creating accessories starting from a simple configuration definition.
To add a device that is still not mapped into the plugin, you need to add a configuration object in the devices
array property of the plugin configuration:
{
"name": "ZigBee",
"channel": 11,
"secondaryChannel": "25",
"routerPollingInterval": 30,
"disableRouterPolling": false,
"disableHttpServer": false,
"disableLed": true,
"platform": "ZigbeeHomebridgeNTPlatform",
"devices": [{
//device config goes here
}]
}
The configuration object is defined here and has the following properties:
manufacturer: string; // device manufacturer
models: string[]; // list of supported models by your device
services: ServiceConfig[]; // list of exposed services by your device
A ServiceConfig
is the definition of an HomeKit service the device is able to expose, and it has the following properties:
type: ServiceType;
meta?: {
colorTemp?: boolean; // light temperature control
batteryLow?: boolean; // battery low warning
colorXY?: boolean; // XY light color control
brightness?: boolean; // brightness control
hue?: boolean; // hue control
saturation?: boolean; // saturation control
power?: boolean; // consumption information (Wh)
voltage?: boolean; // consumption information (a)
current?: boolean; // consumption information (mWh)
waterLeak?: boolean; // water leak detection
gasLeak?: boolean; // gas leak detection
smokeLeak?: boolean; // smoke leak detection
tamper?: boolean; // tampered status detection
}
ServiceType
is a string representing the type of the service. Can be:
- 'contact-sensor'
- 'bulb'
- 'motion-sensor'
- 'leak-sensor' // to use with water, gas or smoke sensors
- 'vibration-sensor'
- 'battery'
- 'humidity-sensor'
- 'temperature-sensor'
- 'outlet'
More service types will come.
The meta
object is a set of booleans that are used internally to expose characteristics for the given service. For example, you may want to set brightness
to true
for a bulb
service if your device has brightness support.
Lets try to configure a Philips Light Bulb with color temperature, color XY and brightness. The same bulb is already statically configured here but it can also be expressed like a configured device:
{
"name": "ZigBee",
"channel": 11,
"secondaryChannel": "25",
"routerPollingInterval": 30,
"disableRouterPolling": false,
"disableHttpServer": false,
"disableLed": true,
"platform": "ZigbeeHomebridgeNTPlatform",
"devices": [{
"manufacturer": "Philips",
"models": [
"LCT001",
"LCT007",
"LCT010",
"LCT012",
"LCT014",
"LCT015",
"LCT016",
"LCT021",
"LCT002",
"LCT011",
"LCT003",
"LCT024",
"LCA001",
"LCA002",
"LCA003",
"LST003",
"LST004",
"LST002"
],
"services": [{
"type": "bulb",
"meta": {
"brightness": true,
"colorXY": true,
"colorTemp": true
}
}]
}]
}
On/Off
is implicit for the bulb
service.