本文整理汇总了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,
)
示例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"),
)
示例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
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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,
)
示例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)
示例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
)
示例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
示例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()