mirror of
https://github.com/mtan93/homebridge.git
synced 2026-04-05 14:23:12 +01:00
Added LightSensor Service
This commit is contained in:
@@ -526,6 +526,25 @@ KNXDevice.prototype = {
|
|||||||
//iterate(myService);
|
//iterate(myService);
|
||||||
return 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) {
|
getLockMechanismService: function(config) {
|
||||||
|
|
||||||
/** //this.config = config;
|
/** //this.config = config;
|
||||||
@@ -756,10 +775,9 @@ KNXDevice.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* assemble the device ***************************************************************************************************/
|
/* assemble the device ***************************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
getServices: function() {
|
getServices: function() {
|
||||||
|
|
||||||
// you can OPTIONALLY create an information service if you wish to override
|
// you can OPTIONALLY create an information service if you wish to override
|
||||||
@@ -799,6 +817,9 @@ KNXDevice.prototype = {
|
|||||||
case "Lightbulb":
|
case "Lightbulb":
|
||||||
accessoryServices.push(this.getLightbulbService(configService));
|
accessoryServices.push(this.getLightbulbService(configService));
|
||||||
break;
|
break;
|
||||||
|
case "LightSensor":
|
||||||
|
accessoryServices.push(this.getLightSensorService(configService));
|
||||||
|
break;
|
||||||
case "LockMechanism":
|
case "LockMechanism":
|
||||||
accessoryServices.push(this.getLockMechanismService(configService));
|
accessoryServices.push(this.getLockMechanismService(configService));
|
||||||
break;
|
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
|
- StatusFault: DPT 1, 1 as true
|
||||||
- StatusTampered: DPT 1, 1 as true
|
- StatusTampered: DPT 1, 1 as true
|
||||||
- StatusLowBattery: DPT 1, 1 as true
|
- StatusLowBattery: DPT 1, 1 as true
|
||||||
|
|
||||||
## Lightbulb
|
## Lightbulb
|
||||||
- On: DPT 1, 1 as on, 0 as off
|
- On: DPT 1, 1 as on, 0 as off
|
||||||
- Brightness: DPT5 percentage, 100% (=255) the brightest
|
- Brightness: DPT5 percentage, 100% (=255) the brightest
|
||||||
|
|
||||||
|
## LightSensor
|
||||||
|
- CurrentAmbientLightLevel: DPT 9, 0 to 100000 Lux
|
||||||
|
|
||||||
## LockMechanism
|
## LockMechanism
|
||||||
- LockCurrentState: DPT 1, 1 as secured **OR (but not both:)**
|
- LockCurrentState: DPT 1, 1 as secured **OR (but not both:)**
|
||||||
- LockCurrentStateSecured0: DPT 1, 0 as secured
|
- LockCurrentStateSecured0: DPT 1, 0 as secured
|
||||||
|
|
||||||
- LockTargetState: DPT 1, 1 as secured **OR**
|
- LockTargetState: DPT 1, 1 as secured **OR**
|
||||||
- LockTargetStateSecured0: DPT 1, 0 as secured
|
- LockTargetStateSecured0: DPT 1, 0 as secured
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user