mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Added LightSensor Service
This commit is contained in:
@@ -526,6 +526,25 @@ KNXDevice.prototype = {
|
||||
//iterate(myService);
|
||||
return myService;
|
||||
},
|
||||
getLightSensorService: function(config) {
|
||||
|
||||
// some sanity checks
|
||||
if (config.type !== "LightSensor") {
|
||||
this.log("[ERROR] LightSensor Service for non 'LightSensor' service called");
|
||||
return undefined;
|
||||
}
|
||||
if (!config.name) {
|
||||
this.log("[ERROR] LightSensor Service without 'name' property called");
|
||||
return undefined;
|
||||
}
|
||||
var myService = new Service.LightSensor(config.name,config.name);
|
||||
// CurrentTemperature)
|
||||
if (config.CurrentAmbientLightLevel) {
|
||||
this.log("LightSensor CurrentAmbientLightLevel characteristic enabled");
|
||||
this.bindCharacteristic(myService, Characteristic.CurrentAmbientLightLevel, "Float", config.CurrentAmbientLightLevel);
|
||||
}
|
||||
return myService;
|
||||
},
|
||||
getLockMechanismService: function(config) {
|
||||
|
||||
/** //this.config = config;
|
||||
@@ -756,10 +775,9 @@ KNXDevice.prototype = {
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/* assemble the device ***************************************************************************************************/
|
||||
|
||||
|
||||
/* assemble the device ***************************************************************************************************/
|
||||
getServices: function() {
|
||||
|
||||
// you can OPTIONALLY create an information service if you wish to override
|
||||
@@ -799,6 +817,9 @@ KNXDevice.prototype = {
|
||||
case "Lightbulb":
|
||||
accessoryServices.push(this.getLightbulbService(configService));
|
||||
break;
|
||||
case "LightSensor":
|
||||
accessoryServices.push(this.getLightSensorService(configService));
|
||||
break;
|
||||
case "LockMechanism":
|
||||
accessoryServices.push(this.getLockMechanismService(configService));
|
||||
break;
|
||||
|
||||
@@ -78,15 +78,17 @@ Two kinds of addresses are supported: `"Set":"1/2/3"` is a writable group addres
|
||||
- StatusFault: DPT 1, 1 as true
|
||||
- StatusTampered: DPT 1, 1 as true
|
||||
- StatusLowBattery: DPT 1, 1 as true
|
||||
|
||||
## Lightbulb
|
||||
- On: DPT 1, 1 as on, 0 as off
|
||||
- Brightness: DPT5 percentage, 100% (=255) the brightest
|
||||
|
||||
|
||||
## LightSensor
|
||||
- CurrentAmbientLightLevel: DPT 9, 0 to 100000 Lux
|
||||
|
||||
## LockMechanism
|
||||
- LockCurrentState: DPT 1, 1 as secured **OR (but not both:)**
|
||||
- LockCurrentStateSecured0: DPT 1, 0 as secured
|
||||
|
||||
- LockTargetState: DPT 1, 1 as secured **OR**
|
||||
- LockTargetStateSecured0: DPT 1, 0 as secured
|
||||
|
||||
|
||||
Reference in New Issue
Block a user