mirror of
https://github.com/mtan93/homebridge.git
synced 2026-05-10 14:26:05 +01:00
FIX: Prevent light sensor values from going out of bounds
This commit is contained in:
@@ -584,7 +584,10 @@ ZWayServerAccessory.prototype = {
|
|||||||
if(vdev.metrics.scaleTitle === "%"){
|
if(vdev.metrics.scaleTitle === "%"){
|
||||||
// Completely unscientific guess, based on test-fit data and Wikipedia real-world lux values.
|
// Completely unscientific guess, based on test-fit data and Wikipedia real-world lux values.
|
||||||
// This will probably change!
|
// This will probably change!
|
||||||
return 0.0005 * (vdev.metrics.level^3.6);
|
var lux = 0.0005 * (vdev.metrics.level^3.6);
|
||||||
|
if(lux < cx.minimumValue) return cx.minimumValue;
|
||||||
|
if(lux > cx.maximumValue) return cx.maximumValue;
|
||||||
|
return lux;
|
||||||
} else {
|
} else {
|
||||||
return vdev.metrics.level;
|
return vdev.metrics.level;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user