當前位置: 首頁>>代碼示例>>Python>>正文


Python JNTComponent.start方法代碼示例

本文整理匯總了Python中janitoo.component.JNTComponent.start方法的典型用法代碼示例。如果您正苦於以下問題:Python JNTComponent.start方法的具體用法?Python JNTComponent.start怎麽用?Python JNTComponent.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在janitoo.component.JNTComponent的用法示例。


在下文中一共展示了JNTComponent.start方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
 def start(self, mqttc):
     """Start the bus
     """
     JNTComponent.start(self, mqttc)
     self._bus.i2c_acquire()
     try:
         self.sensor = BMP085.BMP085(mode=self.values["mode"].data, address=self.values["addr"].data, i2c=self._bus._ada_i2c)
     except Exception:
         logger.exception("[%s] - Can't start component", self.__class__.__name__)
     finally:
         self._bus.i2c_release()
開發者ID:bibi21000,項目名稱:janitoo_raspberry_i2c_bmp,代碼行數:13,代碼來源:bmp.py

示例2: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
 def start(self, mqttc):
     """Start the component.
     """
     logger.warning("[%s] - Start component : %s ", self.__class__.__name__, self.values['rrd_file'].data)
     JNTComponent.start(self, mqttc)
     value_source = self.values['source']
     config = {}
     for i in range(0, value_source.get_max_index()+1):
         config[i] = value_source.get_config(value_source.node_uuid, i)
     self._bus.store.timer_add_config(self.values['rrd_file'].data, self.values['rrd_step'].data, config)
     return True
開發者ID:bibi21000,項目名稱:janitoo_datalog_rrd,代碼行數:13,代碼來源:components.py

示例3: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
 def start(self, mqttc):
     """Start the bus
     """
     JNTComponent.start(self, mqttc)
     self._bus.i2c_acquire()
     try:
         self.sensor = MAX9744(address=self.values["addr"].data, i2c=self._bus.get_adafruit_i2c(), busnum=self._bus.get_busnum())
     except Exception:
         logger.exception("[%s] - Can't start component", self.__class__.__name__)
     finally:
         self._bus.i2c_release()
開發者ID:bibi21000,項目名稱:janitoo_raspberry_i2c_max9744,代碼行數:13,代碼來源:max.py

示例4: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
 def start(self, mqttc):
     """Start the bus
     """
     JNTComponent.start(self, mqttc)
     self._bus.i2c_acquire()
     try:
         self.clock = SDL_DS1307(address=self.values["addr"].data, busnum=self._bus.get_busnum())
     except Exception:
         logger.exception("[%s] - Can't start component", self.__class__.__name__)
     finally:
         self._bus.i2c_release()
開發者ID:bibi21000,項目名稱:janitoo_raspberry_i2c_ds1307,代碼行數:13,代碼來源:ds1307.py

示例5: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
    def start(self, mqttc):
        """Start the component.

        """
        JNTComponent.start(self, mqttc)
        configs = len(self.values["add"].get_index_configs())
        for config in range(configs):
            try:
                pass
            except:
                logger.exception("Exception when starting NXP Reader component")
        return True
開發者ID:bibi21000,項目名稱:janitoo_raspberry_nxp,代碼行數:14,代碼來源:nxp.py

示例6: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
 def start(self, mqttc):
     """Start the component
     """
     JNTComponent.start(self, mqttc)
     self._bus.spi_acquire()
     try:
         device = self.values["device"].data
         dc_pin = self._bus.get_spi_device_pin(device)
         spi = self._bus.get_spi_device(device, max_speed_hz=1000000)
         self.setup_pn532(dc_pin, spi, self._ada_gpio)
     except Exception:
         logger.exception("[%s] - Can't start component", self.__class__.__name__)
     finally:
         self._bus.spi_release()
開發者ID:bibi21000,項目名稱:janitoo_raspberry_spi_pn532,代碼行數:16,代碼來源:pn532.py

示例7: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
    def start(self, mqttc):
        """Start the component.

        """
        JNTComponent.start(self, mqttc)
        configs = len(self.values["addr"].get_index_configs())
        if configs == 0:
            self.devices = [(0, self.values["addr"].data, 0)]
        else:
            self.devices = []
            for config in range(configs):
                self.devices += (config, self.values["addr"].instances[config]['data'])
        self.on_check()
        return True
開發者ID:bibi21000,項目名稱:janitoo_bluez,代碼行數:16,代碼來源:components.py

示例8: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
    def start(self, mqttc):
        """Start the component.
        """
        self.state = 'BOOT'
        JNTComponent.start(self, mqttc)
        hadd = self.values['remote_hadd'].data
        logger.debug("[%s] - Found remote HADD %s for node %s", self.__class__.__name__, hadd, self.node.uuid)
        if hadd is None:
            logger.debug("[%s] - No remote HADD. Exit ...", self.__class__.__name__)
            return False
        self.remote_hadd = hadd_split(hadd)
        if self.remote_hadd[0] is None or self.remote_hadd[1] is None:
            logger.warning("[%s] - Bad remote HADD %s", self.__class__.__name__, hadd)
            return False
        try:
            self.mqttc_heartbeat = MQTTClient(options=self.options.data)
            self.mqttc_heartbeat.connect()
            self.mqttc_heartbeat.subscribe(topic=TOPIC_HEARTBEAT_NODE%(hadd), callback=self.on_heartbeat)
            self.mqttc_heartbeat.start()
        except Exception:
            logger.exception("[%s] - start", self.__class__.__name__)
        values_read = self.get_read_values()
        values_write = self.get_write_values()
        logger.debug("[%s] - found %s values_read", self.__class__.__name__, len(values_read))
        logger.debug("[%s] - found %s values_write", self.__class__.__name__, len(values_write))
        topics = []
        for value in values_read:
            if value[0] == 'user':
                topic=TOPIC_VALUES_USER
            else:
                topic=TOPIC_VALUES_BASIC
            topic = topic%(hadd+'/'+value[1])
            topics.append((topic, 0))
            logger.debug("[%s] - subscribe to %s", self.__class__.__name__, topic)
        if len(topics)>0:
            try:
                self.mqttc_values = MQTTClient(options=self.options.data)
                self.mqttc_values.connect()
                self.mqttc_values.subscribe(topics=topics, callback=self.on_remote_value)
                self.mqttc_values.start()
            except Exception:
                logger.exception("[%s] - start", self.__class__.__name__)

        #~ print max_index
        #~ for index in range(max_index):
            #~ print index
        return True
開發者ID:bibi21000,項目名稱:janitoo_factory,代碼行數:49,代碼來源:remote.py

示例9: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
    def start(self, mqttc):
        """Start the component.

        """
        JNTComponent.start(self, mqttc)
        return True
開發者ID:bibi21000,項目名稱:janitoo_factory,代碼行數:8,代碼來源:views.py

示例10: start

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import start [as 別名]
    def start(self, mqttc):
        """Start the component. Can be used to start a thread to acquire data.

        """
        self._bus.nodeman.add_daily_job(self.current_rotate)
        return JNTComponent.start(self, mqttc)
開發者ID:bibi21000,項目名稱:janitoo_events,代碼行數:8,代碼來源:component.py


注:本文中的janitoo.component.JNTComponent.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。