Commit 5ea2f3cf authored by Jonas's avatar Jonas

Température d'un capteur = 0 alors pour le server = None idem pour l'humidité et la pression

parent c73e2208
......@@ -245,12 +245,12 @@ class Sensor :
self.temp = None
self.hrel = None
self.pressure = None
if self.UdpDevice.data.has_key('temp') :
self.temp = self.UdpDevice.data['temp']
if self.UdpDevice.data.has_key('hrel') :
self.hrel = self.UdpDevice.data['hrel']
if self.UdpDevice.data.has_key('pressure') :
self.pressure = self.UdpDevice.data['pressure']
if self.UdpDevice.data.has_key('temp') and type(self.UdpDevice.data['temp']) in (float,int) :
self.temp = float(self.UdpDevice.data['temp'])
if self.UdpDevice.data.has_key('hrel') and type(self.UdpDevice.data['hrel']) in (float,int) :
self.hrel = float(self.UdpDevice.data['hrel'])
if self.UdpDevice.data.has_key('pressure') and type(self.UdpDevice.data['pressure']) in (float,int) :
self.pressure = float(self.UdpDevice.data['pressure'])
self.last_update = datetime.now()
elif time() > Const.timestart + 35 :
#démaré depuis plus de 35 seconde et toujours aucun udpDevice
......
......@@ -352,13 +352,13 @@ class Zone :
s_pressure_weight = 0.
for sensor in self.sensors :
weight = sensor.get_weight(self.id)
if sensor.temp :
if sensor.temp != None :
s_temp += sensor.temp * weight
s_temp_weight += weight
if sensor.hrel :
if sensor.hrel != None :
s_hrel += sensor.hrel * weight
s_hrel_weight += weight
if sensor.pressure :
if sensor.pressure != None :
s_pressure += sensor.pressure * weight
s_pressure_weight += weight
......
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