当前位置: 首页>>代码示例>>Python>>正文


Python component.JNTComponent类代码示例

本文整理汇总了Python中janitoo.component.JNTComponent的典型用法代码示例。如果您正苦于以下问题:Python JNTComponent类的具体用法?Python JNTComponent怎么用?Python JNTComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JNTComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, bus=None, addr=None, **kwargs):
        """
        """
        oid = kwargs.pop('oid', '%s.ds18b20'%OID)
        name = kwargs.pop('name', "Onewire DS18B20 sensor")
        product_name = kwargs.pop('product_name', "DS18B20 sensor")
        product_type = kwargs.pop('product_type', "Temperature sensor")
        product_manufacturer = kwargs.pop('product_manufacturer', "Janitoo")
        JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
                product_name=product_name, product_type=product_type, product_manufacturer=product_manufacturer, **kwargs)
        logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)

        uuid="temperature"
        self.values[uuid] = self.value_factory['sensor_temperature'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The temperature',
            label='Temp',
            get_data_cb=self.temperature,
        )
        poll_value = self.values[uuid].create_poll_value(default=300)
        self.values[poll_value.uuid] = poll_value

        uuid="hexadd"
        self.values[uuid] = self.value_factory['config_string'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The hexadecimal address of the DS18B20',
            label='Addr',
            default=kwargs.get("hexadd", "28-000005e2fdc3"),
        )
开发者ID:bibi21000,项目名称:janitoo_raspberry_1wire,代码行数:29,代码来源:components.py

示例2: stop

    def stop(self):
        """Stop the component.

        """
        self.stop_check()
        JNTComponent.stop(self)
        return True
开发者ID:bibi21000,项目名称:janitoo_bluez,代码行数:7,代码来源:components.py

示例3: __init__

 def __init__(self, bus=None, addr=None, **kwargs):
     """
     """
     oid = kwargs.pop('oid', 'fake.component')
     name = kwargs.pop('name', "Fake component")
     JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
             **kwargs)
     logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)
     uuid="test_basic"
     self.values[uuid] = JNTValue( uuid=uuid,
                 index=0,
                 genre=0x01,
             )
     uuid="test_user"
     self.values[uuid] = JNTValue( uuid=uuid,
                 index=0,
                 genre=0x02,
             )
     uuid="test_command"
     self.values[uuid] = JNTValue( uuid=uuid,
                 index=0,
                 genre=0x05,
             )
     uuid="test_config"
     self.values[uuid] = JNTValue( uuid=uuid,
                 index=0,
                 genre=0x03,
             )
开发者ID:bibi21000,项目名称:janitoo,代码行数:28,代码来源:tests.py

示例4: __init__

    def __init__(self, bus=None, addr=None, **kwargs):
        """
        """
        oid = kwargs.pop('oid', '%s.ads'%OID)
        name = kwargs.pop('name', "Input")
        product_name = kwargs.pop('product_name', "ADS")
        product_type = kwargs.pop('product_type', "Analog to binary converter")
        JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
                product_name=product_name, product_type=product_type, **kwargs)
        logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)

        uuid="addr"
        self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The I2C address of the ADS component',
            label='Addr',
            default=0x77,
        )
        uuid="data"
        self.values[uuid] = self.value_factory['sensor_integer'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The data',
            label='data',
            get_data_cb=self.read_data,
        )
        poll_value = self.values[uuid].create_poll_value(default=300)
        self.values[poll_value.uuid] = poll_value

        self.sensor = None
开发者ID:bibi21000,项目名称:janitoo_raspberry_i2c_ads1x15,代码行数:29,代码来源:ads.py

示例5: __init__

 def __init__(self, bus=None, addr=None, **kwargs):
     """
     """
     oid = kwargs.pop('oid', 'rpilcdchar.screen')
     name = kwargs.pop('name', "Screen")
     product_name = kwargs.pop('product_name', "Screen")
     product_type = kwargs.pop('product_type', "Screen")
     JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
             product_name=product_name, product_type=product_type, **kwargs)
     logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)
     uuid="message"
     self.values[uuid] = self.value_factory['action_string'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='A message to print on the screen',
         label='Msg',
         default='Janitoo started',
         set_data_cb=self.set_message,
         is_writeonly = True,
         cmd_class=COMMAND_MOTOR,
         genre=0x01,
     )
     poll_value = self.values[uuid].create_poll_value(default=300)
     self.values[poll_value.uuid] = poll_value
     self.pin_lcd_rs        = 27  # Note this might need to be changed to 21 for older revision Pi's.
     self.pin_lcd_en        = 22
     self.pin_lcd_d4        = 25
     self.pin_lcd_d5        = 24
     self.pin_lcd_d6        = 23
     self.pin_lcd_d7        = 18
     self.pin_lcd_backlight = 4
     self.lcd_columns = 20
     self.lcd_rows    = 4
     self.lcd = Adafruit_CharLCD(self.pin_lcd_rs, self.pin_lcd_en, self.pin_lcd_d4, self.pin_lcd_d5, self.pin_lcd_d6, self.pin_lcd_d7,
                         self.lcd_columns, self.lcd_rows, self.pin_lcd_backlight)
开发者ID:bibi21000,项目名称:janitoo_raspberry_lcdchar,代码行数:34,代码来源:lcdchar.py

示例6: __init__

    def __init__(self, bus=None, addr=None, **kwargs):
        """
        """
        oid = kwargs.pop('oid', '%s.ds1307'%OID)
        name = kwargs.pop('name', "Input")
        product_name = kwargs.pop('product_name', "RTC DS1307")
        product_type = kwargs.pop('product_type', "RTC DS1307 clock")
        JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
                product_name=product_name, product_type=product_type, **kwargs)
        logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)

        uuid="addr"
        self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The I2C address of the DS1307 component',
            label='Addr',
            default=0x68,
        )

        uuid="now"
        self.values[uuid] = self.value_factory['sensor_string'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='Return the current date (YY-DD-MM HH-MM-SS)',
            label='now',
            get_data_cb=self.now,
        )

        self.clock = None
开发者ID:bibi21000,项目名称:janitoo_raspberry_i2c_ds1307,代码行数:28,代码来源:ds1307.py

示例7: __init__

 def __init__(self, **kwargs):
     """
     """
     self._inputs = {}
     oid = kwargs.pop('oid', 'rpinxp.writer')
     product_name = kwargs.pop('product_name', "NXP Writer")
     name = kwargs.pop('name', "NXP Writer")
     JNTComponent.__init__(self, oid=oid, name=name, product_name=product_name, **kwargs)
开发者ID:bibi21000,项目名称:janitoo_raspberry_nxp,代码行数:8,代码来源:nxp.py

示例8: __init__

 def __init__(self, bus=None, addr=None, **kwargs):
     """
     """
     oid = kwargs.pop('oid', '%s.thermostat'%OID)
     name = kwargs.pop('name', "Timelapse")
     JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
             **kwargs)
     logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)
开发者ID:bibi21000,项目名称:janitoo_raspberry_fishtank,代码行数:8,代码来源:fishtank.py

示例9: __init__

 def __init__(self, **kwargs):
     """
     """
     oid = kwargs.pop('oid', '%s.input'%OID)
     name = kwargs.pop('name', "Input")
     product_name = kwargs.pop('product_name', "Audio input")
     product_type = kwargs.pop('product_type', "Software")
     JNTComponent.__init__(self, oid=oid, name=name, product_name=product_name, product_type=product_type, **kwargs)
     logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)
开发者ID:bibi21000,项目名称:janitoo_raspberry_sound,代码行数:9,代码来源:sound.py

示例10: __init__

 def __init__(self, bus=None, addr=None, lock=None, unit="°C", **kwargs):
     """ Constructor.
     """
     JNTComponent.__init__(self,
         oid = kwargs.pop('oid', '%s.dawndusk'%OID),
         bus = bus,
         addr = addr,
         name = kwargs.pop('name', "Dawn/Dusk event"),
         product_name = kwargs.pop('product_name', "Dawn/Dusk event"),
         **kwargs)
开发者ID:bibi21000,项目名称:janitoo_events_earth,代码行数:10,代码来源:component.py

示例11: start

 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,代码行数:11,代码来源:ds1307.py

示例12: start

 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,代码行数:11,代码来源:max.py

示例13: start

 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,代码行数:11,代码来源:bmp.py

示例14: start

 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,代码行数:11,代码来源:components.py

示例15: __init__

 def __init__(self, bus=None, addr=None, **kwargs):
     """
     """
     oid = kwargs.pop('oid', '%s.stepmotor'%OID)
     name = kwargs.pop('name', "Motor")
     product_name = kwargs.pop('product_name', "Motor")
     product_type = kwargs.pop('product_type', "Step Motor")
     product_manufacturer = kwargs.pop('product_manufacturer', "Janitoo")
     JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name,
             product_name=product_name, product_type=product_type, product_manufacturer=product_manufacturer, **kwargs)
     logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)
开发者ID:bibi21000,项目名称:janitoo_raspberry_i2c_pca9685,代码行数:11,代码来源:pca9685.py


注:本文中的janitoo.component.JNTComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。