예제 #1
0
 def __init__(self, topic, strategy, client=None, enabled=True, timeout=1):
     Notifier.__init__(self)
     MQTTObserver.__init__(self, topic=topic)
     self._enabled = enabled
     self._strategy = strategy
     self._is_alarm = False
     self._payload = None
     self._payload_changed_at = None
     self._timeout = timeout
     self._mutex = threading.Lock()
     if client is not None:
         client.register_observer(self)
예제 #2
0
파일: relay.py 프로젝트: munnik/ShipControl
 def __init__(self, topic: str, relay_group, index: int):
     MQTTObserver.__init__(self, topic=topic)
     DigitalDevice.__init__(self)
     MQTTTarget.__init__(self, topic=topic)
     logger.debug(
         'Creating a relay named {0} at position {1} in the relay group {2}'.format(self.topic, index, relay_group))
     # assert that the index exists in the device group
     relay_group._get_state(index)
     self._relay_group = relay_group
     self._index = index
     logger.debug(
         'Relay named {0} at position {1} in the relay group {2} is created'.format(self.topic, index, relay_group))
예제 #3
0
 def __init__(self, min_value, max_value, gauge_angle, topic, units=None, **kwargs):
     self._center_x = 300
     self._center_y = 300
     self._radius = 200
     Widget.__init__(self, pos=(self._center_x, self._center_y), topic=topic, **kwargs)
     MQTTObserver.__init__(self, topic=topic)
     self._min_value = min_value
     self._max_value = max_value
     self._zones = {0: self.NORMAL_ZONE}
     self._bars = []
     self._units = units
     self._label = None
     self._angle_calculator = GaugeAngleCalculator(min_value=min_value, max_value=max_value, gauge_angle=gauge_angle)
     self._gauge_indicator = None
예제 #4
0
 def __init__(self, client, topic):
     MQTTObserver.__init__(self, topic=topic)
     self._client = client
     self._client.register_observer(self)
     self.bind(state=self.state_callback)
예제 #5
0
 def __init__(self, client, watchdog, topic, strategy):
     MQTTObserver.__init__(self, topic=topic)
     self._payload = None
     self._watchdog = watchdog
     self._strategy = strategy
     client.register_observer(self)