Beispiel #1
0
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin, "angle")
     self.add_property(
         Property(name="angle",
                  type=PropertyType.INT,
                  value=0,
                  unit="°",
                  range=[0, 100]))
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin, "temperature")
     self.add_property(
         Property(name="temperature",
                  type=PropertyType.INT,
                  value=0,
                  unit="°C",
                  range=[0, 100]))
     self.add_property(
         Property(name="humidity",
                  type=PropertyType.INT,
                  value=0,
                  unit="%",
                  range=[0, 100]))
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin)
     self.add_action(Action("turn_on"))
     self.add_action(Action("turn_off"))
     self.add_action(
         Action("flash").add_parameter(
             Property(name="duration",
                      type=PropertyType.INT,
                      value=10,
                      range=[10, 100])).add_parameter(
                          Property(name="interval",
                                   type=PropertyType.INT,
                                   value=1,
                                   range=[1, 10])))
     self.working_thread = None
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin, "sound")
     self.add_property(
         Property(name="volume", type=PropertyType.INT, value=0, unit="dB"))
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin, "distance")
     self.add_property(
         Property(name="distance", type=PropertyType.INT, unit="cm"))
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin, "button")
     self.add_property(Property("pressed", PropertyType.BOOL))
 def __init__(self, tid, name, pin):
     Sensor.__init__(self, tid, name, pin, "lcd")
     self.add_action(Action("display", message=PropertyType.STRING))