当前位置: 首页>>代码示例>>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;未经允许,请勿转载。