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)
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, )
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
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"), )
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
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)
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)
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)
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)
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)
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)
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.dcmotor'%OID) name = kwargs.pop('name', "Motor") product_name = kwargs.pop('product_name', "Motor") product_type = kwargs.pop('product_type', "DC Motor") 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="speed" self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The speed of the motor. A byte from 0 to 255', label='Speed', default=0, set_data_cb=self.set_speed, ) uuid="max_speed" self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid, node_uuid=self.uuid, help="The max speed supported by the motor. Some motor doesn't seems support 100% PWM. A byte from 0 to 255", label='Speed', default=255, ) uuid="num" self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The number of the motor on the Hat board. A byte from 1 to 4', label='Num.', ) uuid="actions" self.values[uuid] = self.value_factory['action_list'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The action on the DC motor', label='Actions', list_items=['forward', 'backward', 'release'], default='release', set_data_cb=self.set_action, is_writeonly = True, cmd_class=COMMAND_MOTOR, genre=0x01, ) uuid="current_speed" self.values[uuid] = self.value_factory['sensor_integer'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The current speed of the motor. An integer from -255 to 255', label='CSpeed', get_data_cb=self.get_current_speed, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.vcnl4000' % OID) name = kwargs.pop('name', "Input") product_name = kwargs.pop('product_name', "VCLN4000 proximity detector") product_type = kwargs.pop('product_type', "VCLN4000 proximity detector") 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 VCLN4000 component', label='Addr', default=VCNL40xx.VCNL40xx_ADDRESS, ) uuid = "proximity" self.values[uuid] = self.value_factory['sensor_distance']( options=self.options, uuid=uuid, node_uuid=self.uuid, units='cm', get_data_cb=self.proximity, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value uuid = "ambient" self.values[uuid] = self.value_factory['sensor_float']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The ambient light', label='ambient', get_data_cb=self.ambient, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value self.vcnl = None
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, )
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)
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 )
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)
def __init__(self, **kwargs): """ """ self._inputs = {} oid = kwargs.pop('oid', 'rpinxp.reader') product_name = kwargs.pop('product_name', "NXP Reader") name = kwargs.pop('name', "NXP Reader") JNTComponent.__init__(self, oid=oid, name=name, product_name=product_name, **kwargs) uuid="add" self.values[uuid] = self.value_factory['config_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='An RFID address', label='RFID add', default=None, )
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
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)
def __init__(self, **kwargs): """ """ oid = kwargs.pop('oid', '%s.generic'%OID) name = kwargs.pop('name', "Input") product_name = kwargs.pop('product_name', "GPIO") 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) 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), )
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()
def __init__(self, bus=None, addr=None, **kwargs): """ Constructor. """ oid = kwargs.pop('oid', '%s.device' % OID) product_name = kwargs.pop('product_name', "Unknown device") product_type = kwargs.pop('product_type', "Tellstick device") product_manufacturer = kwargs.pop('product_manufacturer', "Janitoo") name = kwargs.pop('name', "Telldus device") JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name, product_name=product_name, product_type=product_type, product_manufacturer=product_manufacturer, **kwargs)
def __init__(self, bus=None, addr=None, **kwargs): JNTComponent.__init__(self, oid = kwargs.pop('oid', '%s.lmsensor'%OID), bus = bus, addr = addr, name = kwargs.pop('name', "LmSensor sensors"), product_name = kwargs.pop('product_name', "LmSensor"), product_type = kwargs.pop('product_type', "Software"), product_manufacturer = kwargs.pop('product_manufacturer', "Janitoo"), **kwargs) self._lock = threading.Lock() logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid) self._lmsensor_last = False self._lmsensor_next_run = datetime.now() + timedelta(seconds=15) uuid="config_filename" self.values[uuid] = self.value_factory['config_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The full path/name of config file to use', label='File', default='/etc/sensors3.conf', ) uuid="temperature" self.values[uuid] = self.value_factory['sensor_temperature'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The temperatures from lm-sensors', label='Temperature', get_data_cb=self.get_temperature, ) config_value = self.values[uuid].create_config_value(help='The name of the lmsensor', label='sensor_name', type=0x08) self.values[config_value.uuid] = config_value poll_value = self.values[uuid].create_poll_value(default=60) self.values[poll_value.uuid] = poll_value uuid="voltage" self.values[uuid] = self.value_factory['sensor_voltage'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The voltage from lm-sensors', label='Voltage', get_data_cb=self.get_volt, ) config_value = self.values[uuid].create_config_value(help='The name of the lmsensor', label='sensor_name', type=0x08) self.values[config_value.uuid] = config_value poll_value = self.values[uuid].create_poll_value(default=90) self.values[poll_value.uuid] = poll_value
def __init__(self, bus=None, addr=None, **kwargs): """ """ JNTComponent.__init__(self, 'datarrd.datasource', bus=bus, addr=addr, name="RRD Datasource", product_name="RRD Datasource", product_type="Software", product_manufacturer="RRD", **kwargs) logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid) self._lock = threading.Lock() uuid="source" self.values[uuid] = self.value_factory['sensor_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, get_data_cb=self.get_rrd_label, help='The source label', label='Source label', genre=0x01, ) config_value = self.values[uuid].create_config_value(help='The configuration of the rrd source : hadd|value_uuid|value_index|rrd_type|rrd_label', label='Rrd Config', type=0x16) self.values[config_value.uuid] = config_value poll_value = self.values[uuid].create_poll_value(default=900) self.values[poll_value.uuid] = poll_value uuid="rrd_file" self.values[uuid] = self.value_factory['config_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The name of the rrd file. Must be unique on the server.', label='Rrd file', default='default_rrd', ) uuid="rrd_step" self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The Rrd step', label='Rrd test', default=300, ) uuid="http_file" self.values[uuid] = self.value_factory['sensor_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, get_data_cb=self.get_http_rrd_file, help='The http address of the rrd file', label='http', genre=0x01, )
def __init__(self, bus=None, addr=None, **kwargs): """ Constructor. """ oid = kwargs.pop('oid', '%s.device'%OID) product_name = kwargs.pop('product_name', "Unknown device") product_type = kwargs.pop('product_type', "Tellstick device") product_manufacturer = kwargs.pop('product_manufacturer', "Janitoo") name = kwargs.pop('name', "Telldus device") JNTComponent.__init__(self, oid=oid, bus=bus, addr=addr, name=name, product_name=product_name, product_type=product_type, product_manufacturer=product_manufacturer, **kwargs )
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.minimoto'%OID) name = kwargs.pop('name', "Motor") product_name = kwargs.pop('product_name', "Motor") product_type = kwargs.pop('product_type', "DC Motor") 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_array'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The addresses of the motors separated by |', label='Adds', default='0x60|0x61', ) uuid="drive" self.values[uuid] = self.value_factory['action_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='Drive the motor(s). Send a single value to apply to all motors or values separated with |', label='Drive', default='0', set_data_cb=self.set_drive, cmd_class=COMMAND_MOTOR, ) uuid="stop" self.values[uuid] = self.value_factory['action_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='Stop the motor(s). Send a single value to apply to all motors or values separated with |', label='Stop', default='0', set_data_cb=self.set_stop, cmd_class=COMMAND_MOTOR, ) uuid="brake" self.values[uuid] = self.value_factory['action_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='Brake the motor(s). Send a single value to apply to all motors or values separated with |', label='Brake', default='0', set_data_cb=self.set_brake, cmd_class=COMMAND_MOTOR, )
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.m8x8'%OID) name = kwargs.pop('name', "Input") product_name = kwargs.pop('product_name', "Matrix 8x8") product_type = kwargs.pop('product_type', "Matrix 8x8") 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 Matrix component', label='Addr', default=0x70, ) self.display = None
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.spy'%OID) name = kwargs.pop('name', "Spyer") product_name = kwargs.pop('product_name', "Spy for bluetooth devices") product_type = kwargs.pop('product_type', "Spy for bluetooth devices") 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="presence" self.values[uuid] = self.value_factory['sensor_presence'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The presence of a bluetooth device', ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value uuid="addr" self.values[uuid] = self.value_factory['config_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The MAC address of the bluetooth device', label='Addr', default=kwargs.get("addr", "E4:D1:C5:FA:F8:E8"), ) uuid="timer_delay" self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The delay between 2 checks', label='Timer.', default=kwargs.pop('timer_delay', 30), ) uuid="hysteresis" self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The number of negative scans before sending an absence notification', label='Hysteresis.', default=kwargs.pop('hysteresis', 3), ) self.check_timer = None self._check_active = False
def __init__(self, bus=None, addr=None, **kwargs): JNTComponent.__init__(self, oid = kwargs.pop('oid', '%s.uptime'%OID), bus = bus, addr = addr, name = kwargs.pop('name', "Uptime"), product_name = kwargs.pop('product_name', "Uptime statistics"), **kwargs) logger.debug("[%s] - __init__ node uuid:%s", self.__class__.__name__, self.uuid) uuid="uptime" self.values[uuid] = self.value_factory['sensor_float'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='Uptime in seconds', label='Uptime', get_data_cb=self.get_uptime, genre=0x01, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.pwm'%OID) name = kwargs.pop('name', "Motor") product_name = kwargs.pop('product_name', "PWM channel") product_type = kwargs.pop('product_type', "PWM channel") 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="level" self.values[uuid] = self.value_factory['action_switch_multilevel'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The level of the LED. A byte from 0 to 100', label='Level', default=0, set_data_cb=self.set_level, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value uuid="max_level" self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid, node_uuid=self.uuid, help="The max level supported by the LED. Some LED doesn't seems support 100% PWM. A byte from 0 to 100", label='Max level', default=100, ) uuid="num" self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The number of the LED on the board. A byte from 0 to 15', label='Num.', ) uuid="switch" self.values[uuid] = self.value_factory['action_switch_binary'](options=self.options, uuid=uuid, node_uuid=self.uuid, set_data_cb=self.set_switch, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value
def __init__(self, bus=None, addr=None, **kwargs): JNTComponent.__init__(self, oid = kwargs.pop('oid', '%s.load'%OID), bus = bus, addr = addr, name = kwargs.pop('name', "Load"), product_name = kwargs.pop('product_name', "Load statistics"), **kwargs) uuid="load" self.values[uuid] = self.value_factory['sensor_float'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The load average', label='Load', get_data_cb=self.get_load_average, genre=0x01, ) config_value = self.values[uuid].create_config_value(help='The load average index (1, 5, and 15m)', label='loadavg', get_data_cb=self.get_config, type=0x02) self.values[config_value.uuid] = config_value poll_value = self.values[uuid].create_poll_value(default=60) self.values[poll_value.uuid] = poll_value
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.servo'%OID) name = kwargs.pop('name', "Servo") product_name = kwargs.pop('product_name', "Servo") product_type = kwargs.pop('product_type', "Servo") 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="num" self.values[uuid] = self.value_factory['config_byte'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The number of the servo on board. A byte from 0 to 15', label='Num.', ) uuid="pulse_min" self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The minimal pulse', label='Pulsemin', default=200, ) uuid="pulse_max" self.values[uuid] = self.value_factory['config_integer'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The maximal pulse', label='Pulsemax', default=700, ) uuid="angle" self.values[uuid] = self.value_factory['action_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, set_data_cb=self.set_angle, help='Set the angle of the servo. Format is value|angle_min|angle_max', label='angle', ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value
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
def __init__(self, path='generic', bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', 'http.resource') name = kwargs.pop('name', "HTTP resource") product_name = kwargs.pop('product_name', "HTTP resource") product_type = kwargs.pop('product_type', "Software") 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) self.path = path dirname='.' if 'home_dir' in self.options.data and self.options.data['home_dir'] is not None: dirname = self.options.data['home_dir'] dirname = os.path.join(dirname, "public") dirname = os.path.join(dirname, self.path) if not os.path.exists(dirname): os.makedirs(dirname) for mydir in DEPLOY_DIRS: directory2 = os.path.join(dirname, mydir) if not os.path.exists(directory2): os.makedirs(directory2) self.deploy_resource(dirname) uuid="resource" self.values[uuid] = self.value_factory['sensor_string'](options=self.options, uuid=uuid, node_uuid=self.uuid, help='The http resource: host:port', label='Resource', get_data_cb=self.get_resource, genre=0x01, cmd_class=COMMAND_WEB_RESOURCE, ) config_value = self.values[uuid].create_config_value(help='The resource path', label='resource', type=0x08) self.values[config_value.uuid] = config_value poll_value = self.values[uuid].create_poll_value(default=1800) self.values[poll_value.uuid] = poll_value
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
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.ina219' % OID) name = kwargs.pop('name', "Input") product_name = kwargs.pop('product_name', "INA219") product_type = kwargs.pop('product_type', "Cuurent and power sensor") 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 INA219 component', label='Addr', default=0x40, ) uuid = "shunt_ohms" self.values[uuid] = self.value_factory['config_float']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The shunt of the INA219 component', label='shunt', default=0.1, ) uuid = "max_expected_amps" self.values[uuid] = self.value_factory['config_float']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The max current expected for the INA219 component', label='Max amps', units='A', default=0.2, ) uuid = "voltage" self.values[uuid] = self.value_factory['sensor_voltage']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The voltage', label='Voltage', get_data_cb=self.read_voltage, units='V', ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value uuid = "current" self.values[uuid] = self.value_factory['sensor_current']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The current', label='Current', units='mA', get_data_cb=self.read_current, ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value uuid = "power" self.values[uuid] = self.value_factory['sensor_power']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The power', label='Power', get_data_cb=self.read_power, units='mW', ) poll_value = self.values[uuid].create_poll_value(default=300) self.values[poll_value.uuid] = poll_value self.sensor = None
def __init__(self, bus=None, addr=None, **kwargs): """ """ oid = kwargs.pop('oid', '%s.ili9341' % OID) 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 = "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 = "reset_pin" self.values[uuid] = self.value_factory['config_byte']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='The reset pin', label='reset', default=None, ) 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_SCREEN_MESSAGE, genre=0x01, ) uuid = "draw" self.values[uuid] = self.value_factory['action_string']( options=self.options, uuid=uuid, node_uuid=self.uuid, help= 'Draw an image on the screen. The image must be base64 encoded.', label='Draw', default=None, set_data_cb=self.set_draw, is_writeonly=True, cmd_class=COMMAND_SCREEN_DRAW, genre=0x01, ) uuid = "clear" self.values[uuid] = self.value_factory['action_string']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='Clear the screen with the color give parameter', label='Clear', default='0,0,0', set_data_cb=self.set_clear, is_writeonly=True, cmd_class=COMMAND_SCREEN_CLEAR, genre=0x01, ) uuid = "reset" self.values[uuid] = self.value_factory['action_string']( options=self.options, uuid=uuid, node_uuid=self.uuid, help='Reset the screen', label='Reset', default=None, set_data_cb=self.set_reset, is_writeonly=True, cmd_class=COMMAND_SCREEN_CLEAR, genre=0x01, ) poll_value = self.values[uuid].create_poll_value(default=300) self.tft = None self.tft_lock = threading.Lock() self.tft_lock_last = None self.tft_timer = None