Пример #1
0
 def update_state(self):
     data = Sensor.analog_read(self)
     if data is not None:
         self.update_property(angle=data)
 def update_state(self):
     data = Sensor.analog_read(self)
     if data is not None and data is not 0:
         resistance = (1023 - data) * 10000.0 / data
         value = 1 / (math.log(resistance / 10000) / 4250 + 1 / 298.15) - 273.15 + 100
         self.update_property(temperature=value)
 def update_state(self):
     data = Sensor.analog_read(self, "dht")
     if data is not None:
         self.update_property(temperature=data[0], humidity=data[1])
Пример #4
0
 def update_state(self):
     data = Sensor.analog_read(self, "ultrasonic")
     if data is not None:
         self.update_property(distance=data)