add a constant which fixes the inaccuracy of the SenseHat temp

This factor minimizes the difference between the messured temperature and the
real temperature down to average of 0.005653266331658
This commit is contained in:
Andreas Zweili 2019-11-02 16:08:16 +01:00
parent a0a291d82e
commit 0a8a8d42f8
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ def _round_to_half(value):
def get_temperature():
return _round_to_half(sense.get_temperature())
return _round_to_half(0.899338368784139 * sense.get_temperature())
def get_pressure():

View File

@ -13,7 +13,7 @@ def test_temp_collector(monkeypatch):
return 25.345
monkeypatch.setattr(collector.sense, 'get_temperature', mock_temp)
assert collector.get_temperature() == 25.5
assert collector.get_temperature() == 23.0
def test_humidity_collector(monkeypatch):
@ -51,7 +51,7 @@ def test_values_to_db(monkeypatch):
temp = Temperature.objects.get(pk=1)
humidity = Humidity.objects.get(pk=1)
pressure = Pressure.objects.get(pk=1)
assert (temp.value == 25.5
assert (temp.value == 23.0
and humidity.value == 45
and pressure.value == 1013)