diff --git a/MMM-DHT-Sensor.js b/MMM-DHT-Sensor.js index 06b3823..342cc6e 100755 --- a/MMM-DHT-Sensor.js +++ b/MMM-DHT-Sensor.js @@ -15,6 +15,10 @@ Module.register("MMM-DHT-Sensor", { debug: false, sensorPin: 2, sensorType: 22, + temperatureOffset: 0, + temperatureOffsetPercent: 0, + humidityOffset: 0, + humidityOffsetPercent: 0, }, start: function () { @@ -77,8 +81,8 @@ Module.register("MMM-DHT-Sensor", { } const roundToTwo = (value) => Math.round(value * 100) / 100; - const celsius = roundToTwo(rawTemp); - const humidity = roundToTwo(rawHumidity); + const celsius = roundToTwo(rawTemp * (1 + this.config.temperatureOffsetPercent / 100) + this.config.temperatureOffset); + const humidity = roundToTwo(rawHumidity * (1 + this.config.humidityOffsetPercent / 100) + this.config.humidityOffset); this.temperature = this.config.units === "imperial" ? roundToTwo((celsius * 9) / 5 + 32)