diff --git a/README.md b/README.md index 1c60e829..64815e0b 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,8 @@ The following optional parameters can be added to modify homebridge-hue's behavi - `group0`: Flag whether to include group 0 (all lights) when groups are exposed. Default: `true`; - `rooms`: Flag whether to include Rooms when groups are exposed. Default: `false`; - `sensors`: Flag whether to expose Hue bridge sensors to HomeKit. Default: `false`; -- `clipsensors`: Flag whether to include CLIP sensors when sensors are exposed. Default: `true`. If set to `false`, only Zigbee sensors and the built-in Daylight sensor are included. +- `excludeSensorTypes`: A list of sensor types to ignore. Default: empty, expose all sensor types. The sensor type is the (case sensitive) `type` attribute of the bridge sensor object, see **Sensors** above, or "CLIP" as a shortcut for all CLIP sensors. For example, to expose only the Hue Motion `Motion Sensor` and `Light Level` sensors, specify: `"excludeSensorTypes": [ "CLIP", "Geofence", "Daylight", "ZLLTemperature", "ZLLSwitch", "ZGPSwitch"]`; +- `clipsensors`: Deprecated, please use `"excludeSensorTypes": ["CLIP", "Geofence"]` instead; - `schedules`: Flag whether to expose Hue bridge schedules to HomeKit. Default: `false`; - `rules`: Flag whether to expose Hue bridge rules to HomeKit. Default: `false`. @@ -125,7 +126,7 @@ For reference, below is an example `config.json` that includes all parameters an "group0": true, "rooms": false, "sensors": false, - "clipsensors": true, + "excludeSensorTypes": [], "schedules": false, "rules": false } diff --git a/lib/HueBridge.js b/lib/HueBridge.js index 10495e5c..87e3da03 100644 --- a/lib/HueBridge.js +++ b/lib/HueBridge.js @@ -177,13 +177,14 @@ HueBridge.prototype.createResources = function() { if (this.platform.config.sensors) { for (const id in obj.sensors) { const sensor = obj.sensors[id]; - if (this.platform.config.clipsensors || - (sensor.type.substring(0, 4) !== "CLIP" && sensor.type !== "Geofence")) { + if (this.platform.config.excludeSensorTypes[sensor.type] || + (sensor.type.substring(0, 4) === "CLIP" && + this.platform.config.excludeSensorTypes.CLIP)) { + this.log.debug("%s: %s: ignoring %s sensor", this.name, sensor.name, sensor.type); + } else { this.log.debug("%s: %s: %s sensor", this.name, sensor.name, sensor.type); this.sensors[id] = new HueSensor(this, id, sensor); this.accessoryList.push(this.sensors[id]); - } else { - this.log.debug("%s: %s: ingoring %s sensor", this.name, sensor.name, sensor.type); } } } diff --git a/lib/HuePlatform.js b/lib/HuePlatform.js index 6bccdca2..435a0294 100644 --- a/lib/HuePlatform.js +++ b/lib/HuePlatform.js @@ -115,10 +115,20 @@ function HuePlatform(log, config, api) { group0: config.group0 === false ? false : true, rooms: config.rooms === false ? false : true, sensors: config.sensors || false, - clipsensors: config.clipsensors === false ? false : true, + excludeSensorTypes: {}, schedules: config.schedules || false, rules: config.rules || false }; + if (Array.isArray(config.excludeSensorTypes)) { + for (const type of config.excludeSensorTypes) { + this.config.excludeSensorTypes[type] = true; + } + } + if (config.clipsensors === false) { + this.log.error("config.json: warning: \"clipsensors\" has been deprecated"); + this.config.excludeSensorTypes.CLIP = true; + this.config.excludeSensorTypes.Geofence = true; + } if (config.host) { if (Array.isArray(config.host)) { this.config.hosts = config.host;