當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。