mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00: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 === "%"){
|
||||
// Completely unscientific guess, based on test-fit data and Wikipedia real-world lux values.
|
||||
// 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 {
|
||||
return vdev.metrics.level;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user