Added LightSensor Service

This commit is contained in:
Snowdd1
2015-09-18 13:18:27 +02:00
parent 93ea0deded
commit 91f6ccb2d4
2 changed files with 28 additions and 5 deletions

View File

@@ -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;

View File

@@ -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