feat: add temperatureOffset, humidityOffset and percentage-based offset config options#38
Open
Aldarande wants to merge 1 commit into
Open
feat: add temperatureOffset, humidityOffset and percentage-based offset config options#38Aldarande wants to merge 1 commit into
Aldarande wants to merge 1 commit into
Conversation
…ptions Add percentage-based offset options to complement the existing fixed offsets. - `temperatureOffsetPercent` (default: `0`): percentage applied to raw temperature - `humidityOffsetPercent` (default: `0`): percentage applied to raw humidity Both fixed and percentage offsets can be combined: final value = raw * (1 + offsetPercent / 100) + offset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DHT sensors placed inside a MagicMirror enclosure are often affected
by the heat generated by the display and electronics, resulting in
inaccurate temperature and humidity readings.
Solution
Add four optional config parameters to compensate for sensor drift:
temperatureOffset(default:0): fixed value added to the raw temperature readingtemperatureOffsetPercent(default:0): percentage applied to the raw temperature readinghumidityOffset(default:0): fixed value added to the raw humidity readinghumidityOffsetPercent(default:0): percentage applied to the raw humidity readingBoth fixed and percentage offsets can be combined:
final value = raw * (1 + offsetPercent / 100) + offsetUsage
Changes
MMM-DHT-Sensor.js: added four offset options to defaults and appliedthem in
processSensorData()