Commit 31c93144 authored by julric's avatar julric

added different names for the two temperature sensors on bmp085 and dht22

parent dde3a997
...@@ -8,7 +8,7 @@ class BMP085(sensor.Sensor): ...@@ -8,7 +8,7 @@ class BMP085(sensor.Sensor):
def __init__(self,data): def __init__(self,data):
self.sensorName = "BMP085" self.sensorName = "BMP085"
if "temp" in data["measurement"].lower(): if "temp" in data["measurement"].lower():
self.valName = "Temperature" self.valName = "TemperatureBMP"
self.valUnit = "Celsius" self.valUnit = "Celsius"
self.valSymbol = "C" self.valSymbol = "C"
if "unit" in data: if "unit" in data:
...@@ -34,7 +34,7 @@ class BMP085(sensor.Sensor): ...@@ -34,7 +34,7 @@ class BMP085(sensor.Sensor):
return return
def getVal(self): def getVal(self):
if self.valName == "Temperature": if self.valName == "TemperatureBMP":
temp = BMP085.bmpClass.readTemperature() temp = BMP085.bmpClass.readTemperature()
if self.valUnit == "Fahrenheit": if self.valUnit == "Fahrenheit":
temp = temp * 1.8 + 32 temp = temp * 1.8 + 32
......
...@@ -11,7 +11,7 @@ class DHT22(sensor.Sensor): ...@@ -11,7 +11,7 @@ class DHT22(sensor.Sensor):
self.sensorName = "DHT22" self.sensorName = "DHT22"
self.pinNum = int(data["pinNumber"]) self.pinNum = int(data["pinNumber"])
if "temp" in data["measurement"].lower(): if "temp" in data["measurement"].lower():
self.valName = "Temperature" self.valName = "TemperatureDHT"
self.valUnit = "Celsius" self.valUnit = "Celsius"
self.valSymbol = "C" self.valSymbol = "C"
if "unit" in data: if "unit" in data:
...@@ -36,7 +36,7 @@ class DHT22(sensor.Sensor): ...@@ -36,7 +36,7 @@ class DHT22(sensor.Sensor):
t, h = dhtreader.lastData t, h = dhtreader.lastData
dhtreader.lastData = (t,h) dhtreader.lastData = (t,h)
dhtreader.lastDataTime=tim dhtreader.lastDataTime=tim
if self.valName == "Temperature": if self.valName == "TemperatureDHT":
temp = t temp = t
if self.valUnit == "Fahrenheit": if self.valUnit == "Fahrenheit":
temp = temp * 1.8 + 32 temp = temp * 1.8 + 32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment