def __init__(self, port, dev_addr):
        ThreadingActor.__init__(self)

        self._logger = Logger.for_name(__name__)

        try:
            self._mb = minimalmodbus.Instrument(str(port),
                                                dev_addr,
                                                mode='rtu')
            ModbusUser.__init__(self, self._mb)
        except Exception as e:
            self._logger.error(str(e), exc_info=True)
            raise e

        self._initialize_gpio()

        self._state = DoorState.CLOSED
Esempio n. 2
0
    def __init__(self):
        ThreadingActor.__init__()
        try:
            self.twitter = Twython(
                TWITTER_CONSUMER_KEY,
                access_token=TWITTER_ACCESS_TOKEN,
            )
        except TwythonAuthError as e:
            print e.msg
            self.stop()
        self.used_resources = [
            'application/rate_limit_status',
        ]
        self.rate_limit = {}
        self.local_remainings = {}
        self.reset_timers = {}

        self.redis_con = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)
    def __init__(self, port, dev_addr):
        ThreadingActor.__init__(self)

        self._log = Logger.for_name(__name__)

        try:
            ModbusUser.__init__(
                self, minimalmodbus.Instrument(str(port), dev_addr,
                                               mode='rtu'))
        except Exception as e:
            self._log.error(str(e), exc_info=True)
            raise e

        self._initialize_gpio()

        self._button_state = Emergency.State.OFF

        self._button_check_th = Thread(target=self._button_check_thread)
        self._button_check_th.start()
Esempio n. 4
0
    def __init__(self, port, dev_addr):
        ThreadingActor.__init__(self)

        self._log = Logger.for_name(__name__)
        self.states = {
            TrafficLight.Color.RED: TrafficLight.State.OFF,
            TrafficLight.Color.GREEN: TrafficLight.State.OFF,
            TrafficLight.Color.YELLOW: TrafficLight.State.OFF,
        }

        try:
            ModbusUser.__init__(
                self, minimalmodbus.Instrument(str(port), dev_addr,
                                               mode='rtu'))
        except Exception as e:
            self._log.error(str(e), exc_info=True)
            raise e

        self.initialize_gpio()
        self.all(TrafficLight.State.OFF)
Esempio n. 5
0
 def __init__(self, filepath, buffersize, logger=None):
     ThreadingActor.__init__(self)
     self.buffersize = buffersize
     self.filepath = filepath
     self.logger = logger
Esempio n. 6
0
 def __init__(self, daemon_actor, twitter):
     ThreadingActor.__init__()
     self.daemon_actor = daemon_actor
     self.twitter = twitter
Esempio n. 7
0
File: timer.py Progetto: s1na/torpus
 def __init__(self, daemon_actor, repeat=False):
     ThreadingActor.__init__()
     self.daemon_actor = daemon_actor
     self.repeat = repeat
Esempio n. 8
0
 def __init__(self, logger, *sensors, timeformat="%d.%m.%Y %H:%M:%S"):
     ThreadingActor.__init__(self)
     self.sensors = sensors
     self.logger = logger
     self.timeformat = timeformat
     self.calibrated = False
Esempio n. 9
0
 def __init__(self, url, tempfilepath, logger):
     ThreadingActor.__init__(self)
     self.url = url
     self.logger = logger
     self.diskwriter = DiskWriter.start(tempfilepath, -1, logger)
Esempio n. 10
0
 def __init__(self, base_url, token, tempfile, logger):
     ThreadingActor.__init__(self)
     self.url = f"{base_url}/api/v1/{token}/telemetry"
     self.data_format = """{{ "ts":{ts}, "values":{{ "{name}":{value} }} }}"""
     self.postactor = PostWriter.start(self.url, tempfile, logger)
Esempio n. 11
0
File: timer.py Progetto: s1na/torpus
 def __init__(self, daemon_actor, repeat=False):
     ThreadingActor.__init__()
     self.daemon_actor = daemon_actor
     self.repeat = repeat