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


Python JNTComponent.__init__方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 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,代碼行數:30,代碼來源:tests.py

示例2: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
    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,代碼行數:31,代碼來源:components.py

示例3: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
    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,代碼行數:31,代碼來源:ads.py

示例4: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
    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,代碼行數:30,代碼來源:ds1307.py

示例5: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 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,代碼行數:36,代碼來源:lcdchar.py

示例6: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 def __init__(self, **kwargs):
     """
     """
     self._inputs = {}
     oid = kwargs.pop('oid', 'voxgen.listener')
     product_name = kwargs.pop('product_name', "Voxgenerator listener")
     name = kwargs.pop('name', "Voxgenerator listener")
     JNTComponent.__init__(self, oid=oid, name=name, product_name=product_name, **kwargs)
開發者ID:bibi21000,項目名稱:janitoo_voxgenerator,代碼行數:10,代碼來源:voxgenerator.py

示例7: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 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,代碼行數:10,代碼來源:fishtank.py

示例8: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 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,代碼行數:11,代碼來源:sound.py

示例9: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 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,代碼行數:12,代碼來源:component.py

示例10: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 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,代碼行數:13,代碼來源:pca9685.py

示例11: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 def __init__(self, bus=None, addr=None, **kwargs):
     """
     """
     oid = kwargs.pop('oid', 'remote.node')
     name = kwargs.pop('name', "Remote node")
     product_name = kwargs.pop('product_name', "Remote node")
     product_type = kwargs.pop('product_type', "Software")
     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)
     self.mqttc_heartbeat = None
     self.mqttc_values = None
     self.state = 'OFFLINE'
     self.remote_hadd = (None,None)
     uuid="remote_hadd"
     self.values[uuid] = self.value_factory['config_string'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='HADD of the remote node that we will listen to',
         label='rhadd',
         default=None,
     )
     uuid="user_read"
     self.values[uuid] = self.value_factory['rread_value'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='The user values to listen to : value_uuid:index',
         label='ruser',
         default=None,
     )
     uuid="user_write"
     self.values[uuid] = self.value_factory['rwrite_value'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='The user values to listen to : value_uuid:index',
         label='wuser',
         default=None,
     )
     uuid="basic_read"
     self.values[uuid] = self.value_factory['rread_value'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='The basic values to listen to : value_uuid:index',
         label='rbasic',
         default=None,
     )
     uuid="basic_write"
     self.values[uuid] = self.value_factory['rwrite_value'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='The basic values to listen to : value_uuid:index',
         label='wbasic',
         default=None,
     )
開發者ID:bibi21000,項目名稱:janitoo_factory,代碼行數:51,代碼來源:remote.py

示例12: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
    def __init__(self, bus=None, addr=None, lock=None, unit="°C", **kwargs):
        """ Constructor.

        Arguments:
            bus:
                a 1-Wire instance representing the bus this device is
                connected to
            addr:
                the 1-Wire device address (in 7 bits format)
        """
        JNTComponent.__init__(self, 'onewire.ds18b20', bus=bus, addr=addr, name="DS18B20 range sensor", **kwargs)
        uuid = '%s_%s'%('ds18b20','c')
        value = JNTValue( uuid=uuid,
                help='The temperature',
                label='Temp',
                units='°C',
                index=0,
                cmd_class=COMMAND_METER,
                genre=0x02,
                type=0x03,
                get_data_cb=self.read_temp_c,
                is_writeonly=False,
                is_polled=True,
                poll_delay=300,
                )
        self.values[uuid] = value
        uuid = '%s_%s'%('ds18b20','c_poll')
        value = value_config_poll( uuid, self.poll_tempc_get, self.poll_tempc_set)
        self.values[uuid] = value
        uuid = '%s_%s'%('ds18b20','f')
        value = JNTValue( uuid=uuid,
                help='The temperature',
                label='Temp',
                units='°F',
                index=0,
                cmd_class=COMMAND_METER,
                genre=0x02,
                type=0x03,
                get_data_cb=self.read_temp_f,
                is_writeonly=False,
                is_polled=False,
                poll_delay=300,
                )
        self.values[uuid] = value
        uuid = '%s_%s'%('ds18b20','f_poll')
        value = value_config_poll( uuid, self.poll_tempf_get, self.poll_tempf_set, default=0)
        self.values[uuid] = value
        self.cmd_classes.append(COMMAND_METER)
        self.cmd_classes.append(COMMAND_CONFIGURATION)
開發者ID:bibi21000,項目名稱:janitoo_scene,代碼行數:51,代碼來源:component.py

示例13: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
    def __init__(self, bus=None, addr=None, **kwargs):
        """
        """
        JNTComponent.__init__(self, bus=bus, addr=addr, **kwargs)
        logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid)

        uuid = "hflip"
        self.values[uuid] = self.value_factory["config_boolean"](
            options=self.options, uuid=uuid, node_uuid=self.uuid, help="Horizontal flip.", label="Hflip", default=False
        )

        uuid = "vflip"
        self.values[uuid] = self.value_factory["config_boolean"](
            options=self.options, uuid=uuid, node_uuid=self.uuid, help="Vertical flip.", label="Vflip", default=False
        )
開發者ID:bibi21000,項目名稱:janitoo_raspberry_camera,代碼行數:17,代碼來源:camera.py

示例14: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
 def __init__(self, bus=None, addr=None, **kwargs):
     """
     """
     oid = kwargs.pop('oid', '%s.pn532'%OID)
     name = kwargs.pop('name', "Screen")
     product_name = kwargs.pop('product_name', "RFID component")
     product_type = kwargs.pop('product_type', "RFID component")
     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="device"
     self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='Either the device number on the hardware bus or the SPI CS pin of the software one',
         label='device',
         default=0,
     )
     uuid="listen"
     self.values[uuid] = self.value_factory['action_boolean'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='Activate/deactivate the listen mode',
         label='Listen',
         default=False,
         set_data_cb=self.set_listen,
         is_writeonly = True,
         cmd_class=COMMAND_CONTROLLER,
         genre=0x01,
     )
     self.pn532 = None
     self.listen_timer = None
     uuid="listen_delay"
     self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='The delay between 2 listens',
         label='Delay',
         default=1,
     )
     uuid="status"
     self.values[uuid] = self.value_factory['sensor_list'](options=self.options, uuid=uuid,
         node_uuid=self.uuid,
         help='The status of the pn532',
         label='Status',
         default='sleeping',
         list_items=['sleeping', 'listening', 'write_ok', 'write_error'],
     )
     poll_value = self.values[uuid].create_poll_value(default=300)
     self.values[poll_value.uuid] = poll_value
開發者ID:bibi21000,項目名稱:janitoo_raspberry_spi_pn532,代碼行數:49,代碼來源:pn532.py

示例15: __init__

# 需要導入模塊: from janitoo.component import JNTComponent [as 別名]
# 或者: from janitoo.component.JNTComponent import __init__ [as 別名]
    def __init__(self, bus=None, addr=None, **kwargs):
        """
        """
        oid = kwargs.pop('oid', 'rpibasic.dht')
        name = kwargs.pop('name', "Input")
        product_name = kwargs.pop('product_name', "DHT")
        product_type = kwargs.pop('product_type', "Temperature/humidity 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="pin"
        self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The pin number on the board',
            label='Pin',
            default=kwargs.pop('pin', 1),
        )
        uuid="sensor"
        self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The sensor type : 11,22,2302',
            label='Type',
            default=kwargs.pop('sensor', 11),
        )
        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="humidity"
        self.values[uuid] = self.value_factory['sensor_humidity'](options=self.options, uuid=uuid,
            node_uuid=self.uuid,
            help='The humidity',
            label='Hum',
            get_data_cb=self.humidity,
        )
        poll_value = self.values[uuid].create_poll_value(default=300)
        self.values[poll_value.uuid] = poll_value
        self._dht_lock =  threading.Lock()
開發者ID:bibi21000,項目名稱:janitoo_raspberry_dht,代碼行數:48,代碼來源:dht.py


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