repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.get_engine_version
def get_engine_version(self): """Get the device engine version.""" msg = StandardSend(self._address, COMMAND_GET_INSTEON_ENGINE_VERSION_0X0D_0X00) self._send_msg(msg)
python
def get_engine_version(self): """Get the device engine version.""" msg = StandardSend(self._address, COMMAND_GET_INSTEON_ENGINE_VERSION_0X0D_0X00) self._send_msg(msg)
[ "def", "get_engine_version", "(", "self", ")", ":", "msg", "=", "StandardSend", "(", "self", ".", "_address", ",", "COMMAND_GET_INSTEON_ENGINE_VERSION_0X0D_0X00", ")", "self", ".", "_send_msg", "(", "msg", ")" ]
Get the device engine version.
[ "Get", "the", "device", "engine", "version", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L266-L270
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.ping
def ping(self): """Ping a device.""" msg = StandardSend(self._address, COMMAND_PING_0X0F_0X00) self._send_msg(msg)
python
def ping(self): """Ping a device.""" msg = StandardSend(self._address, COMMAND_PING_0X0F_0X00) self._send_msg(msg)
[ "def", "ping", "(", "self", ")", ":", "msg", "=", "StandardSend", "(", "self", ".", "_address", ",", "COMMAND_PING_0X0F_0X00", ")", "self", ".", "_send_msg", "(", "msg", ")" ]
Ping a device.
[ "Ping", "a", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L272-L275
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.create_default_links
def create_default_links(self): """Create the default links between the IM and the device.""" self._plm.manage_aldb_record(0x40, 0xe2, 0x00, self.address, self.cat, self.subcat, self.product_key) self.manage_aldb_record(0x41, 0xa2, 0x00, self._plm.address, ...
python
def create_default_links(self): """Create the default links between the IM and the device.""" self._plm.manage_aldb_record(0x40, 0xe2, 0x00, self.address, self.cat, self.subcat, self.product_key) self.manage_aldb_record(0x41, 0xa2, 0x00, self._plm.address, ...
[ "def", "create_default_links", "(", "self", ")", ":", "self", ".", "_plm", ".", "manage_aldb_record", "(", "0x40", ",", "0xe2", ",", "0x00", ",", "self", ".", "address", ",", "self", ".", "cat", ",", "self", ".", "subcat", ",", "self", ".", "product_ke...
Create the default links between the IM and the device.
[ "Create", "the", "default", "links", "between", "the", "IM", "and", "the", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L277-L301
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.read_aldb
def read_aldb(self, mem_addr=0x0000, num_recs=0): """Read the device All-Link Database.""" if self._aldb.version == ALDBVersion.Null: _LOGGER.info('Device %s does not contain an All-Link Database', self._address.human) else: _LOGGER.info('Reading ...
python
def read_aldb(self, mem_addr=0x0000, num_recs=0): """Read the device All-Link Database.""" if self._aldb.version == ALDBVersion.Null: _LOGGER.info('Device %s does not contain an All-Link Database', self._address.human) else: _LOGGER.info('Reading ...
[ "def", "read_aldb", "(", "self", ",", "mem_addr", "=", "0x0000", ",", "num_recs", "=", "0", ")", ":", "if", "self", ".", "_aldb", ".", "version", "==", "ALDBVersion", ".", "Null", ":", "_LOGGER", ".", "info", "(", "'Device %s does not contain an All-Link Dat...
Read the device All-Link Database.
[ "Read", "the", "device", "All", "-", "Link", "Database", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L303-L313
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.write_aldb
def write_aldb(self, mem_addr: int, mode: str, group: int, target, data1=0x00, data2=0x00, data3=0x00): """Write to the device All-Link Database. Parameters: Required: mode: r - device is a responder of target c - device is a controller o...
python
def write_aldb(self, mem_addr: int, mode: str, group: int, target, data1=0x00, data2=0x00, data3=0x00): """Write to the device All-Link Database. Parameters: Required: mode: r - device is a responder of target c - device is a controller o...
[ "def", "write_aldb", "(", "self", ",", "mem_addr", ":", "int", ",", "mode", ":", "str", ",", "group", ":", "int", ",", "target", ",", "data1", "=", "0x00", ",", "data2", "=", "0x00", ",", "data3", "=", "0x00", ")", ":", "if", "isinstance", "(", "...
Write to the device All-Link Database. Parameters: Required: mode: r - device is a responder of target c - device is a controller of target group: Link group target: Address of the other device Optional: data1: Dev...
[ "Write", "to", "the", "device", "All", "-", "Link", "Database", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L441-L473
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.del_aldb
def del_aldb(self, mem_addr: int): """Delete an All-Link Database record.""" self._aldb.del_record(mem_addr) self._aldb.add_loaded_callback(self._aldb_loaded_callback)
python
def del_aldb(self, mem_addr: int): """Delete an All-Link Database record.""" self._aldb.del_record(mem_addr) self._aldb.add_loaded_callback(self._aldb_loaded_callback)
[ "def", "del_aldb", "(", "self", ",", "mem_addr", ":", "int", ")", ":", "self", ".", "_aldb", ".", "del_record", "(", "mem_addr", ")", "self", ".", "_aldb", ".", "add_loaded_callback", "(", "self", ".", "_aldb_loaded_callback", ")" ]
Delete an All-Link Database record.
[ "Delete", "an", "All", "-", "Link", "Database", "record", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L475-L478
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device._refresh_aldb_records
def _refresh_aldb_records(self, linkcode, address, group): """Refresh the IM and device ALDB records.""" if self.aldb.status in [ALDBStatus.LOADED, ALDBStatus.PARTIAL]: for mem_addr in self.aldb: rec = self.aldb[mem_addr] if linkcode in [0, 1, 3]: ...
python
def _refresh_aldb_records(self, linkcode, address, group): """Refresh the IM and device ALDB records.""" if self.aldb.status in [ALDBStatus.LOADED, ALDBStatus.PARTIAL]: for mem_addr in self.aldb: rec = self.aldb[mem_addr] if linkcode in [0, 1, 3]: ...
[ "def", "_refresh_aldb_records", "(", "self", ",", "linkcode", ",", "address", ",", "group", ")", ":", "if", "self", ".", "aldb", ".", "status", "in", "[", "ALDBStatus", ".", "LOADED", ",", "ALDBStatus", ".", "PARTIAL", "]", ":", "for", "mem_addr", "in", ...
Refresh the IM and device ALDB records.
[ "Refresh", "the", "IM", "and", "device", "ALDB", "records", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L537-L556
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.receive_message
def receive_message(self, msg): """Receive a messages sent to this device.""" _LOGGER.debug('Starting Device.receive_message') if hasattr(msg, 'isack') and msg.isack: _LOGGER.debug('Got Message ACK') if self._sent_msg_wait_for_directACK.get('callback') is not None: ...
python
def receive_message(self, msg): """Receive a messages sent to this device.""" _LOGGER.debug('Starting Device.receive_message') if hasattr(msg, 'isack') and msg.isack: _LOGGER.debug('Got Message ACK') if self._sent_msg_wait_for_directACK.get('callback') is not None: ...
[ "def", "receive_message", "(", "self", ",", "msg", ")", ":", "_LOGGER", ".", "debug", "(", "'Starting Device.receive_message'", ")", "if", "hasattr", "(", "msg", ",", "'isack'", ")", "and", "msg", ".", "isack", ":", "_LOGGER", ".", "debug", "(", "'Got Mess...
Receive a messages sent to this device.
[ "Receive", "a", "messages", "sent", "to", "this", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L666-L696
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
X10Device.receive_message
def receive_message(self, msg): """Receive a message sent to this device.""" _LOGGER.debug('Starting X10Device.receive_message') if hasattr(msg, 'isack') and msg.isack: _LOGGER.debug('Got Message ACK') if self._send_msg_lock.locked(): self._send_msg_lock.r...
python
def receive_message(self, msg): """Receive a message sent to this device.""" _LOGGER.debug('Starting X10Device.receive_message') if hasattr(msg, 'isack') and msg.isack: _LOGGER.debug('Got Message ACK') if self._send_msg_lock.locked(): self._send_msg_lock.r...
[ "def", "receive_message", "(", "self", ",", "msg", ")", ":", "_LOGGER", ".", "debug", "(", "'Starting X10Device.receive_message'", ")", "if", "hasattr", "(", "msg", ",", "'isack'", ")", "and", "msg", ".", "isack", ":", "_LOGGER", ".", "debug", "(", "'Got M...
Receive a message sent to this device.
[ "Receive", "a", "message", "sent", "to", "this", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L851-L864
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
StateList.add
def add(self, plm, device, stateType, stateName, group, defaultValue=None): """Add a state to the StateList.""" self._stateList[group] = stateType(plm, device, stateName, group, defaultValue=defaultValue)
python
def add(self, plm, device, stateType, stateName, group, defaultValue=None): """Add a state to the StateList.""" self._stateList[group] = stateType(plm, device, stateName, group, defaultValue=defaultValue)
[ "def", "add", "(", "self", ",", "plm", ",", "device", ",", "stateType", ",", "stateName", ",", "group", ",", "defaultValue", "=", "None", ")", ":", "self", ".", "_stateList", "[", "group", "]", "=", "stateType", "(", "plm", ",", "device", ",", "state...
Add a state to the StateList.
[ "Add", "a", "state", "to", "the", "StateList", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L922-L925
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDBRecord.create_from_userdata
def create_from_userdata(userdata): """Create ALDB Record from the userdata dictionary.""" memhi = userdata.get('d3') memlo = userdata.get('d4') memory = memhi << 8 | memlo control_flags = userdata.get('d6') group = userdata.get('d7') addrhi = userdata.get('d8') ...
python
def create_from_userdata(userdata): """Create ALDB Record from the userdata dictionary.""" memhi = userdata.get('d3') memlo = userdata.get('d4') memory = memhi << 8 | memlo control_flags = userdata.get('d6') group = userdata.get('d7') addrhi = userdata.get('d8') ...
[ "def", "create_from_userdata", "(", "userdata", ")", ":", "memhi", "=", "userdata", ".", "get", "(", "'d3'", ")", "memlo", "=", "userdata", ".", "get", "(", "'d4'", ")", "memory", "=", "memhi", "<<", "8", "|", "memlo", "control_flags", "=", "userdata", ...
Create ALDB Record from the userdata dictionary.
[ "Create", "ALDB", "Record", "from", "the", "userdata", "dictionary", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1009-L1024
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDBRecord.to_userdata
def to_userdata(self): """Return a Userdata dictionary.""" userdata = Userdata({'d3': self.memhi, 'd4': self.memlo, 'd6': self.control_flags, 'd7': self.group, 'd8': self.address.bytes[2],...
python
def to_userdata(self): """Return a Userdata dictionary.""" userdata = Userdata({'d3': self.memhi, 'd4': self.memlo, 'd6': self.control_flags, 'd7': self.group, 'd8': self.address.bytes[2],...
[ "def", "to_userdata", "(", "self", ")", ":", "userdata", "=", "Userdata", "(", "{", "'d3'", ":", "self", ".", "memhi", ",", "'d4'", ":", "self", ".", "memlo", ",", "'d6'", ":", "self", ".", "control_flags", ",", "'d7'", ":", "self", ".", "group", "...
Return a Userdata dictionary.
[ "Return", "a", "Userdata", "dictionary", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1026-L1038
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ControlFlags.byte
def byte(self): """Return a byte representation of ControlFlags.""" flags = int(self._in_use) << 7 \ | int(self._controller) << 6 \ | int(self._bit5) << 5 \ | int(self._bit4) << 4 \ | int(self._used_before) << 1 return flags
python
def byte(self): """Return a byte representation of ControlFlags.""" flags = int(self._in_use) << 7 \ | int(self._controller) << 6 \ | int(self._bit5) << 5 \ | int(self._bit4) << 4 \ | int(self._used_before) << 1 return flags
[ "def", "byte", "(", "self", ")", ":", "flags", "=", "int", "(", "self", ".", "_in_use", ")", "<<", "7", "|", "int", "(", "self", ".", "_controller", ")", "<<", "6", "|", "int", "(", "self", ".", "_bit5", ")", "<<", "5", "|", "int", "(", "self...
Return a byte representation of ControlFlags.
[ "Return", "a", "byte", "representation", "of", "ControlFlags", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1099-L1106
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ControlFlags.create_from_byte
def create_from_byte(control_flags): """Create a ControlFlags class from a control flags byte.""" in_use = bool(control_flags & 1 << 7) controller = bool(control_flags & 1 << 6) bit5 = bool(control_flags & 1 << 5) bit4 = bool(control_flags & 1 << 4) used_before = bool(con...
python
def create_from_byte(control_flags): """Create a ControlFlags class from a control flags byte.""" in_use = bool(control_flags & 1 << 7) controller = bool(control_flags & 1 << 6) bit5 = bool(control_flags & 1 << 5) bit4 = bool(control_flags & 1 << 4) used_before = bool(con...
[ "def", "create_from_byte", "(", "control_flags", ")", ":", "in_use", "=", "bool", "(", "control_flags", "&", "1", "<<", "7", ")", "controller", "=", "bool", "(", "control_flags", "&", "1", "<<", "6", ")", "bit5", "=", "bool", "(", "control_flags", "&", ...
Create a ControlFlags class from a control flags byte.
[ "Create", "a", "ControlFlags", "class", "from", "a", "control", "flags", "byte", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1109-L1118
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB.add_loaded_callback
def add_loaded_callback(self, callback): """Add a callback to be run when the ALDB load is complete.""" if callback not in self._cb_aldb_loaded: self._cb_aldb_loaded.append(callback)
python
def add_loaded_callback(self, callback): """Add a callback to be run when the ALDB load is complete.""" if callback not in self._cb_aldb_loaded: self._cb_aldb_loaded.append(callback)
[ "def", "add_loaded_callback", "(", "self", ",", "callback", ")", ":", "if", "callback", "not", "in", "self", ".", "_cb_aldb_loaded", ":", "self", ".", "_cb_aldb_loaded", ".", "append", "(", "callback", ")" ]
Add a callback to be run when the ALDB load is complete.
[ "Add", "a", "callback", "to", "be", "run", "when", "the", "ALDB", "load", "is", "complete", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1207-L1210
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB.load
async def load(self, mem_addr=0x0000, rec_count=0, retry=0): """Read the device database and load.""" if self._version == ALDBVersion.Null: self._status = ALDBStatus.LOADED _LOGGER.debug('Device has no ALDB') else: self._status = ALDBStatus.LOADING ...
python
async def load(self, mem_addr=0x0000, rec_count=0, retry=0): """Read the device database and load.""" if self._version == ALDBVersion.Null: self._status = ALDBStatus.LOADED _LOGGER.debug('Device has no ALDB') else: self._status = ALDBStatus.LOADING ...
[ "async", "def", "load", "(", "self", ",", "mem_addr", "=", "0x0000", ",", "rec_count", "=", "0", ",", "retry", "=", "0", ")", ":", "if", "self", ".", "_version", "==", "ALDBVersion", ".", "Null", ":", "self", ".", "_status", "=", "ALDBStatus", ".", ...
Read the device database and load.
[ "Read", "the", "device", "database", "and", "load", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1212-L1255
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB.find_matching_link
def find_matching_link(self, mode, group, addr): """Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number ad...
python
def find_matching_link(self, mode, group, addr): """Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number ad...
[ "def", "find_matching_link", "(", "self", ",", "mode", ",", "group", ",", "addr", ")", ":", "found_rec", "=", "None", "mode_test", "=", "None", "if", "mode", ".", "lower", "(", ")", "in", "[", "'c'", ",", "'r'", "]", ":", "link_group", "=", "int", ...
Find a matching link in the current device. Mode: r | c is the mode of the link in the linked device This method will search for a corresponding link in the reverse direction. group: All-Link group number addr: Inteon address of the linked device
[ "Find", "a", "matching", "link", "in", "the", "current", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1347-L1371
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB.record_received
def record_received(self, msg): """Handle ALDB record received from device.""" release_lock = False userdata = msg.userdata rec = ALDBRecord.create_from_userdata(userdata) self._records[rec.mem_addr] = rec _LOGGER.debug('ALDB Record: %s', rec) rec_count = self._...
python
def record_received(self, msg): """Handle ALDB record received from device.""" release_lock = False userdata = msg.userdata rec = ALDBRecord.create_from_userdata(userdata) self._records[rec.mem_addr] = rec _LOGGER.debug('ALDB Record: %s', rec) rec_count = self._...
[ "def", "record_received", "(", "self", ",", "msg", ")", ":", "release_lock", "=", "False", "userdata", "=", "msg", ".", "userdata", "rec", "=", "ALDBRecord", ".", "create_from_userdata", "(", "userdata", ")", "self", ".", "_records", "[", "rec", ".", "mem_...
Handle ALDB record received from device.
[ "Handle", "ALDB", "record", "received", "from", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1373-L1391
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB.load_saved_records
def load_saved_records(self, status, records): """Load ALDB records from a set of saved records.""" if isinstance(status, ALDBStatus): self._status = status else: self._status = ALDBStatus(status) for mem_addr in records: rec = records[mem_addr] ...
python
def load_saved_records(self, status, records): """Load ALDB records from a set of saved records.""" if isinstance(status, ALDBStatus): self._status = status else: self._status = ALDBStatus(status) for mem_addr in records: rec = records[mem_addr] ...
[ "def", "load_saved_records", "(", "self", ",", "status", ",", "records", ")", ":", "if", "isinstance", "(", "status", ",", "ALDBStatus", ")", ":", "self", ".", "_status", "=", "status", "else", ":", "self", ".", "_status", "=", "ALDBStatus", "(", "status...
Load ALDB records from a set of saved records.
[ "Load", "ALDB", "records", "from", "a", "set", "of", "saved", "records", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1393-L1414
train
nugget/python-insteonplm
insteonplm/devices/__init__.py
ALDB._set_load_action
def _set_load_action(self, mem_addr, rec_count, retries, read_complete=False): """Calculate the next record to read. If the last record was successful and one record was being read then look for the next record until we get to the high water mark. If the last r...
python
def _set_load_action(self, mem_addr, rec_count, retries, read_complete=False): """Calculate the next record to read. If the last record was successful and one record was being read then look for the next record until we get to the high water mark. If the last r...
[ "def", "_set_load_action", "(", "self", ",", "mem_addr", ",", "rec_count", ",", "retries", ",", "read_complete", "=", "False", ")", ":", "if", "self", ".", "_have_all_records", "(", ")", ":", "mem_addr", "=", "None", "rec_count", "=", "0", "retries", "=", ...
Calculate the next record to read. If the last record was successful and one record was being read then look for the next record until we get to the high water mark. If the last read was successful and all records were being read then look for the first record. if the last rea...
[ "Calculate", "the", "next", "record", "to", "read", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L1497-L1543
train
nugget/python-insteonplm
insteonplm/states/__init__.py
State.register_updates
def register_updates(self, callback): """Register a callback to notify a listener of state changes.""" _LOGGER.debug("Registered callback for state: %s", self._stateName) self._observer_callbacks.append(callback)
python
def register_updates(self, callback): """Register a callback to notify a listener of state changes.""" _LOGGER.debug("Registered callback for state: %s", self._stateName) self._observer_callbacks.append(callback)
[ "def", "register_updates", "(", "self", ",", "callback", ")", ":", "_LOGGER", ".", "debug", "(", "\"Registered callback for state: %s\"", ",", "self", ".", "_stateName", ")", "self", ".", "_observer_callbacks", ".", "append", "(", "callback", ")" ]
Register a callback to notify a listener of state changes.
[ "Register", "a", "callback", "to", "notify", "a", "listener", "of", "state", "changes", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/__init__.py#L114-L117
train
nugget/python-insteonplm
insteonplm/states/__init__.py
State._update_subscribers
def _update_subscribers(self, val): """Save state value and notify listeners of the change.""" self._value = val for callback in self._observer_callbacks: callback(self._address, self._group, val)
python
def _update_subscribers(self, val): """Save state value and notify listeners of the change.""" self._value = val for callback in self._observer_callbacks: callback(self._address, self._group, val)
[ "def", "_update_subscribers", "(", "self", ",", "val", ")", ":", "self", ".", "_value", "=", "val", "for", "callback", "in", "self", ".", "_observer_callbacks", ":", "callback", "(", "self", ".", "_address", ",", "self", ".", "_group", ",", "val", ")" ]
Save state value and notify listeners of the change.
[ "Save", "state", "value", "and", "notify", "listeners", "of", "the", "change", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/__init__.py#L119-L123
train
nugget/python-insteonplm
insteonplm/messages/extendedReceive.py
ExtendedReceive.template
def template(cls, address=None, target=None, commandtuple=None, userdata=None, cmd2=-1, flags=None): """Create message template for callbacks.""" msgraw = bytearray([0x02, cls._code]) msgraw.extend(bytes(cls._receivedSize)) msg = ExtendedReceive.from_raw_message(msgraw) ...
python
def template(cls, address=None, target=None, commandtuple=None, userdata=None, cmd2=-1, flags=None): """Create message template for callbacks.""" msgraw = bytearray([0x02, cls._code]) msgraw.extend(bytes(cls._receivedSize)) msg = ExtendedReceive.from_raw_message(msgraw) ...
[ "def", "template", "(", "cls", ",", "address", "=", "None", ",", "target", "=", "None", ",", "commandtuple", "=", "None", ",", "userdata", "=", "None", ",", "cmd2", "=", "-", "1", ",", "flags", "=", "None", ")", ":", "msgraw", "=", "bytearray", "("...
Create message template for callbacks.
[ "Create", "message", "template", "for", "callbacks", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedReceive.py#L58-L81
train
nugget/python-insteonplm
insteonplm/messages/extendedReceive.py
ExtendedReceive.targetLow
def targetLow(self): """Return the low byte of the target address field. Used in All-Link Cleanup messages. """ low_byte = None if self.target is not None and self._messageFlags.isBroadcast: low_byte = self.target.bytes[0] return low_byte
python
def targetLow(self): """Return the low byte of the target address field. Used in All-Link Cleanup messages. """ low_byte = None if self.target is not None and self._messageFlags.isBroadcast: low_byte = self.target.bytes[0] return low_byte
[ "def", "targetLow", "(", "self", ")", ":", "low_byte", "=", "None", "if", "self", ".", "target", "is", "not", "None", "and", "self", ".", "_messageFlags", ".", "isBroadcast", ":", "low_byte", "=", "self", ".", "target", ".", "bytes", "[", "0", "]", "...
Return the low byte of the target address field. Used in All-Link Cleanup messages.
[ "Return", "the", "low", "byte", "of", "the", "target", "address", "field", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedReceive.py#L114-L122
train
nugget/python-insteonplm
insteonplm/states/dimmable.py
DimmableSwitch.set_level
def set_level(self, val): """Set the devive ON LEVEL.""" if val == 0: self.off() else: setlevel = 255 if val < 1: setlevel = val * 100 elif val <= 0xff: setlevel = val set_command = StandardSend( ...
python
def set_level(self, val): """Set the devive ON LEVEL.""" if val == 0: self.off() else: setlevel = 255 if val < 1: setlevel = val * 100 elif val <= 0xff: setlevel = val set_command = StandardSend( ...
[ "def", "set_level", "(", "self", ",", "val", ")", ":", "if", "val", "==", "0", ":", "self", ".", "off", "(", ")", "else", ":", "setlevel", "=", "255", "if", "val", "<", "1", ":", "setlevel", "=", "val", "*", "100", "elif", "val", "<=", "0xff", ...
Set the devive ON LEVEL.
[ "Set", "the", "devive", "ON", "LEVEL", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/dimmable.py#L193-L205
train
nugget/python-insteonplm
insteonplm/states/dimmable.py
DimmableSwitch_Fan.set_level
def set_level(self, val): """Set the fan speed.""" speed = self._value_to_fan_speed(val) if val == 0: self.off() else: set_command = ExtendedSend(self._address, COMMAND_LIGHT_ON_0X11_NONE, ...
python
def set_level(self, val): """Set the fan speed.""" speed = self._value_to_fan_speed(val) if val == 0: self.off() else: set_command = ExtendedSend(self._address, COMMAND_LIGHT_ON_0X11_NONE, ...
[ "def", "set_level", "(", "self", ",", "val", ")", ":", "speed", "=", "self", ".", "_value_to_fan_speed", "(", "val", ")", "if", "val", "==", "0", ":", "self", ".", "off", "(", ")", "else", ":", "set_command", "=", "ExtendedSend", "(", "self", ".", ...
Set the fan speed.
[ "Set", "the", "fan", "speed", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/dimmable.py#L269-L279
train
nugget/python-insteonplm
insteonplm/states/cover.py
Cover.open
def open(self): """Turn the device ON.""" open_command = StandardSend(self._address, COMMAND_LIGHT_ON_0X11_NONE, cmd2=0xff) self._send_method(open_command, self._open_message_received)
python
def open(self): """Turn the device ON.""" open_command = StandardSend(self._address, COMMAND_LIGHT_ON_0X11_NONE, cmd2=0xff) self._send_method(open_command, self._open_message_received)
[ "def", "open", "(", "self", ")", ":", "open_command", "=", "StandardSend", "(", "self", ".", "_address", ",", "COMMAND_LIGHT_ON_0X11_NONE", ",", "cmd2", "=", "0xff", ")", "self", ".", "_send_method", "(", "open_command", ",", "self", ".", "_open_message_receiv...
Turn the device ON.
[ "Turn", "the", "device", "ON", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L108-L112
train
nugget/python-insteonplm
insteonplm/states/cover.py
Cover.open_fast
def open_fast(self): """Turn the device ON Fast.""" open_command = StandardSend(self._address, COMMAND_LIGHT_ON_FAST_0X12_NONE, cmd2=0xff) self._send_method(open_command, self._open_message_received)
python
def open_fast(self): """Turn the device ON Fast.""" open_command = StandardSend(self._address, COMMAND_LIGHT_ON_FAST_0X12_NONE, cmd2=0xff) self._send_method(open_command, self._open_message_received)
[ "def", "open_fast", "(", "self", ")", ":", "open_command", "=", "StandardSend", "(", "self", ".", "_address", ",", "COMMAND_LIGHT_ON_FAST_0X12_NONE", ",", "cmd2", "=", "0xff", ")", "self", ".", "_send_method", "(", "open_command", ",", "self", ".", "_open_mess...
Turn the device ON Fast.
[ "Turn", "the", "device", "ON", "Fast", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L114-L118
train
nugget/python-insteonplm
insteonplm/devices/climateControl.py
ClimateControl_2441th.async_refresh_state
def async_refresh_state(self): """Request each state to provide status update.""" _LOGGER.debug('Setting up extended status') ext_status = ExtendedSend( address=self._address, commandtuple=COMMAND_EXTENDED_GET_SET_0X2E_0X00, cmd2=0x02, userdata=Use...
python
def async_refresh_state(self): """Request each state to provide status update.""" _LOGGER.debug('Setting up extended status') ext_status = ExtendedSend( address=self._address, commandtuple=COMMAND_EXTENDED_GET_SET_0X2E_0X00, cmd2=0x02, userdata=Use...
[ "def", "async_refresh_state", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "'Setting up extended status'", ")", "ext_status", "=", "ExtendedSend", "(", "address", "=", "self", ".", "_address", ",", "commandtuple", "=", "COMMAND_EXTENDED_GET_SET_0X2E_0X00", "...
Request each state to provide status update.
[ "Request", "each", "state", "to", "provide", "status", "update", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/climateControl.py#L86-L98
train
nugget/python-insteonplm
insteonplm/utils.py
byte_to_housecode
def byte_to_housecode(bytecode): """Return an X10 housecode value from a byte value.""" hc = list(HC_LOOKUP.keys())[list(HC_LOOKUP.values()).index(bytecode)] return hc.upper()
python
def byte_to_housecode(bytecode): """Return an X10 housecode value from a byte value.""" hc = list(HC_LOOKUP.keys())[list(HC_LOOKUP.values()).index(bytecode)] return hc.upper()
[ "def", "byte_to_housecode", "(", "bytecode", ")", ":", "hc", "=", "list", "(", "HC_LOOKUP", ".", "keys", "(", ")", ")", "[", "list", "(", "HC_LOOKUP", ".", "values", "(", ")", ")", ".", "index", "(", "bytecode", ")", "]", "return", "hc", ".", "uppe...
Return an X10 housecode value from a byte value.
[ "Return", "an", "X10", "housecode", "value", "from", "a", "byte", "value", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L22-L25
train
nugget/python-insteonplm
insteonplm/utils.py
byte_to_unitcode
def byte_to_unitcode(bytecode): """Return an X10 unitcode value from a byte value.""" return list(UC_LOOKUP.keys())[list(UC_LOOKUP.values()).index(bytecode)]
python
def byte_to_unitcode(bytecode): """Return an X10 unitcode value from a byte value.""" return list(UC_LOOKUP.keys())[list(UC_LOOKUP.values()).index(bytecode)]
[ "def", "byte_to_unitcode", "(", "bytecode", ")", ":", "return", "list", "(", "UC_LOOKUP", ".", "keys", "(", ")", ")", "[", "list", "(", "UC_LOOKUP", ".", "values", "(", ")", ")", ".", "index", "(", "bytecode", ")", "]" ]
Return an X10 unitcode value from a byte value.
[ "Return", "an", "X10", "unitcode", "value", "from", "a", "byte", "value", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L28-L30
train
nugget/python-insteonplm
insteonplm/utils.py
x10_command_type
def x10_command_type(command): """Return the X10 command type from an X10 command.""" command_type = X10CommandType.DIRECT if command in [X10_COMMAND_ALL_UNITS_OFF, X10_COMMAND_ALL_LIGHTS_ON, X10_COMMAND_ALL_LIGHTS_OFF]: command_type = X10CommandType.BROADCAST ...
python
def x10_command_type(command): """Return the X10 command type from an X10 command.""" command_type = X10CommandType.DIRECT if command in [X10_COMMAND_ALL_UNITS_OFF, X10_COMMAND_ALL_LIGHTS_ON, X10_COMMAND_ALL_LIGHTS_OFF]: command_type = X10CommandType.BROADCAST ...
[ "def", "x10_command_type", "(", "command", ")", ":", "command_type", "=", "X10CommandType", ".", "DIRECT", "if", "command", "in", "[", "X10_COMMAND_ALL_UNITS_OFF", ",", "X10_COMMAND_ALL_LIGHTS_ON", ",", "X10_COMMAND_ALL_LIGHTS_OFF", "]", ":", "command_type", "=", "X10...
Return the X10 command type from an X10 command.
[ "Return", "the", "X10", "command", "type", "from", "an", "X10", "command", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L33-L40
train
nugget/python-insteonplm
insteonplm/utils.py
set_bit
def set_bit(bitmask, bit, is_on): """Set the value of a bit in a bitmask on or off. Uses the low bit is 1 and the high bit is 8. """ bitshift = bit - 1 if is_on: return bitmask | (1 << bitshift) return bitmask & (0xff & ~(1 << bitshift))
python
def set_bit(bitmask, bit, is_on): """Set the value of a bit in a bitmask on or off. Uses the low bit is 1 and the high bit is 8. """ bitshift = bit - 1 if is_on: return bitmask | (1 << bitshift) return bitmask & (0xff & ~(1 << bitshift))
[ "def", "set_bit", "(", "bitmask", ",", "bit", ",", "is_on", ")", ":", "bitshift", "=", "bit", "-", "1", "if", "is_on", ":", "return", "bitmask", "|", "(", "1", "<<", "bitshift", ")", "return", "bitmask", "&", "(", "0xff", "&", "~", "(", "1", "<<"...
Set the value of a bit in a bitmask on or off. Uses the low bit is 1 and the high bit is 8.
[ "Set", "the", "value", "of", "a", "bit", "in", "a", "bitmask", "on", "or", "off", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L58-L66
train
nugget/python-insteonplm
insteonplm/messages/extendedSend.py
ExtendedSend.template
def template(cls, address=None, commandtuple=None, userdata=None, cmd2=-1, flags=None, acknak=None): """Create a message template used for callbacks.""" msgraw = bytearray([0x02, cls._code]) msgraw.extend(bytes(cls._receivedSize)) msg = ExtendedSend.from_raw_message(msgr...
python
def template(cls, address=None, commandtuple=None, userdata=None, cmd2=-1, flags=None, acknak=None): """Create a message template used for callbacks.""" msgraw = bytearray([0x02, cls._code]) msgraw.extend(bytes(cls._receivedSize)) msg = ExtendedSend.from_raw_message(msgr...
[ "def", "template", "(", "cls", ",", "address", "=", "None", ",", "commandtuple", "=", "None", ",", "userdata", "=", "None", ",", "cmd2", "=", "-", "1", ",", "flags", "=", "None", ",", "acknak", "=", "None", ")", ":", "msgraw", "=", "bytearray", "("...
Create a message template used for callbacks.
[ "Create", "a", "message", "template", "used", "for", "callbacks", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedSend.py#L69-L93
train
nugget/python-insteonplm
insteonplm/messages/extendedSend.py
ExtendedSend.set_checksum
def set_checksum(self): """Set byte 14 of the userdata to a checksum value.""" data_sum = self.cmd1 + self.cmd2 for i in range(1, 14): data_sum += self._userdata['d{:d}'.format(i)] chksum = 0xff - (data_sum & 0xff) + 1 self._userdata['d14'] = chksum
python
def set_checksum(self): """Set byte 14 of the userdata to a checksum value.""" data_sum = self.cmd1 + self.cmd2 for i in range(1, 14): data_sum += self._userdata['d{:d}'.format(i)] chksum = 0xff - (data_sum & 0xff) + 1 self._userdata['d14'] = chksum
[ "def", "set_checksum", "(", "self", ")", ":", "data_sum", "=", "self", ".", "cmd1", "+", "self", ".", "cmd2", "for", "i", "in", "range", "(", "1", ",", "14", ")", ":", "data_sum", "+=", "self", ".", "_userdata", "[", "'d{:d}'", ".", "format", "(", ...
Set byte 14 of the userdata to a checksum value.
[ "Set", "byte", "14", "of", "the", "userdata", "to", "a", "checksum", "value", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedSend.py#L143-L149
train
nugget/python-insteonplm
insteonplm/messages/standardReceive.py
StandardReceive.from_raw_message
def from_raw_message(cls, rawmessage): """Create message from a raw byte stream.""" return StandardReceive(rawmessage[2:5], rawmessage[5:8], {'cmd1': rawmessage[9], 'cmd2': rawmessage[10]}, ...
python
def from_raw_message(cls, rawmessage): """Create message from a raw byte stream.""" return StandardReceive(rawmessage[2:5], rawmessage[5:8], {'cmd1': rawmessage[9], 'cmd2': rawmessage[10]}, ...
[ "def", "from_raw_message", "(", "cls", ",", "rawmessage", ")", ":", "return", "StandardReceive", "(", "rawmessage", "[", "2", ":", "5", "]", ",", "rawmessage", "[", "5", ":", "8", "]", ",", "{", "'cmd1'", ":", "rawmessage", "[", "9", "]", ",", "'cmd2...
Create message from a raw byte stream.
[ "Create", "message", "from", "a", "raw", "byte", "stream", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardReceive.py#L43-L49
train
nugget/python-insteonplm
insteonplm/messages/standardReceive.py
StandardReceive.targetMed
def targetMed(self): """Return the middle byte of the target message property. Used in All-Link Cleanup message types. """ med_byte = None if self.target.addr is not None and self._messageFlags.isBroadcast: med_byte = self.target.bytes[1] return med_byte
python
def targetMed(self): """Return the middle byte of the target message property. Used in All-Link Cleanup message types. """ med_byte = None if self.target.addr is not None and self._messageFlags.isBroadcast: med_byte = self.target.bytes[1] return med_byte
[ "def", "targetMed", "(", "self", ")", ":", "med_byte", "=", "None", "if", "self", ".", "target", ".", "addr", "is", "not", "None", "and", "self", ".", "_messageFlags", ".", "isBroadcast", ":", "med_byte", "=", "self", ".", "target", ".", "bytes", "[", ...
Return the middle byte of the target message property. Used in All-Link Cleanup message types.
[ "Return", "the", "middle", "byte", "of", "the", "target", "message", "property", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardReceive.py#L114-L122
train
nugget/python-insteonplm
insteonplm/messages/standardReceive.py
StandardReceive.targetHi
def targetHi(self): """Return the high byte of the target message property. Used in All-Link Cleanup message types. """ hi_byte = None if self.target.addr is not None and self._messageFlags.isBroadcast: hi_byte = self.target.bytes[2] return hi_byte
python
def targetHi(self): """Return the high byte of the target message property. Used in All-Link Cleanup message types. """ hi_byte = None if self.target.addr is not None and self._messageFlags.isBroadcast: hi_byte = self.target.bytes[2] return hi_byte
[ "def", "targetHi", "(", "self", ")", ":", "hi_byte", "=", "None", "if", "self", ".", "target", ".", "addr", "is", "not", "None", "and", "self", ".", "_messageFlags", ".", "isBroadcast", ":", "hi_byte", "=", "self", ".", "target", ".", "bytes", "[", "...
Return the high byte of the target message property. Used in All-Link Cleanup message types.
[ "Return", "the", "high", "byte", "of", "the", "target", "message", "property", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardReceive.py#L125-L133
train
nugget/python-insteonplm
insteonplm/messages/__init__.py
create
def create(rawmessage): """Return an INSTEON message class based on a raw byte stream.""" rawmessage = _trim_buffer_garbage(rawmessage) if len(rawmessage) < 2: return (None, rawmessage) code = rawmessage[1] msgclass = _get_msg_class(code) msg = None remaining_data = rawmessage ...
python
def create(rawmessage): """Return an INSTEON message class based on a raw byte stream.""" rawmessage = _trim_buffer_garbage(rawmessage) if len(rawmessage) < 2: return (None, rawmessage) code = rawmessage[1] msgclass = _get_msg_class(code) msg = None remaining_data = rawmessage ...
[ "def", "create", "(", "rawmessage", ")", ":", "rawmessage", "=", "_trim_buffer_garbage", "(", "rawmessage", ")", "if", "len", "(", "rawmessage", ")", "<", "2", ":", "return", "(", "None", ",", "rawmessage", ")", "code", "=", "rawmessage", "[", "1", "]", ...
Return an INSTEON message class based on a raw byte stream.
[ "Return", "an", "INSTEON", "message", "class", "based", "on", "a", "raw", "byte", "stream", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L56-L86
train
nugget/python-insteonplm
insteonplm/messages/__init__.py
iscomplete
def iscomplete(rawmessage): """Test if the raw message is a complete message.""" if len(rawmessage) < 2: return False if rawmessage[0] != 0x02: raise ValueError('message does not start with 0x02') messageBuffer = bytearray() filler = bytearray(30) messageBuffer.extend(rawmessag...
python
def iscomplete(rawmessage): """Test if the raw message is a complete message.""" if len(rawmessage) < 2: return False if rawmessage[0] != 0x02: raise ValueError('message does not start with 0x02') messageBuffer = bytearray() filler = bytearray(30) messageBuffer.extend(rawmessag...
[ "def", "iscomplete", "(", "rawmessage", ")", ":", "if", "len", "(", "rawmessage", ")", "<", "2", ":", "return", "False", "if", "rawmessage", "[", "0", "]", "!=", "0x02", ":", "raise", "ValueError", "(", "'message does not start with 0x02'", ")", "messageBuff...
Test if the raw message is a complete message.
[ "Test", "if", "the", "raw", "message", "is", "a", "complete", "message", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L89-L115
train
nugget/python-insteonplm
insteonplm/messages/__init__.py
_get_msg_class
def _get_msg_class(code): """Get the message class based on the message code.""" msg_classes = {} msg_classes = _add_msg_class(msg_classes, MESSAGE_STANDARD_MESSAGE_RECEIVED_0X50, StandardReceive) msg_classes = _add_msg_class(msg_classes,...
python
def _get_msg_class(code): """Get the message class based on the message code.""" msg_classes = {} msg_classes = _add_msg_class(msg_classes, MESSAGE_STANDARD_MESSAGE_RECEIVED_0X50, StandardReceive) msg_classes = _add_msg_class(msg_classes,...
[ "def", "_get_msg_class", "(", "code", ")", ":", "msg_classes", "=", "{", "}", "msg_classes", "=", "_add_msg_class", "(", "msg_classes", ",", "MESSAGE_STANDARD_MESSAGE_RECEIVED_0X50", ",", "StandardReceive", ")", "msg_classes", "=", "_add_msg_class", "(", "msg_classes"...
Get the message class based on the message code.
[ "Get", "the", "message", "class", "based", "on", "the", "message", "code", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L118-L185
train
nugget/python-insteonplm
insteonplm/messages/__init__.py
_trim_buffer_garbage
def _trim_buffer_garbage(rawmessage, debug=True): """Remove leading bytes from a byte stream. A proper message byte stream begins with 0x02. """ while rawmessage and rawmessage[0] != MESSAGE_START_CODE_0X02: if debug: _LOGGER.debug('Buffer content: %s', binascii.hexlify(rawmessage))...
python
def _trim_buffer_garbage(rawmessage, debug=True): """Remove leading bytes from a byte stream. A proper message byte stream begins with 0x02. """ while rawmessage and rawmessage[0] != MESSAGE_START_CODE_0X02: if debug: _LOGGER.debug('Buffer content: %s', binascii.hexlify(rawmessage))...
[ "def", "_trim_buffer_garbage", "(", "rawmessage", ",", "debug", "=", "True", ")", ":", "while", "rawmessage", "and", "rawmessage", "[", "0", "]", "!=", "MESSAGE_START_CODE_0X02", ":", "if", "debug", ":", "_LOGGER", ".", "debug", "(", "'Buffer content: %s'", ",...
Remove leading bytes from a byte stream. A proper message byte stream begins with 0x02.
[ "Remove", "leading", "bytes", "from", "a", "byte", "stream", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L193-L203
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags.matches_pattern
def matches_pattern(self, other): """Test if current message match a patterns or template.""" if hasattr(other, 'messageType'): messageTypeIsEqual = False if self.messageType is None or other.messageType is None: messageTypeIsEqual = True else: ...
python
def matches_pattern(self, other): """Test if current message match a patterns or template.""" if hasattr(other, 'messageType'): messageTypeIsEqual = False if self.messageType is None or other.messageType is None: messageTypeIsEqual = True else: ...
[ "def", "matches_pattern", "(", "self", ",", "other", ")", ":", "if", "hasattr", "(", "other", ",", "'messageType'", ")", ":", "messageTypeIsEqual", "=", "False", "if", "self", ".", "messageType", "is", "None", "or", "other", ".", "messageType", "is", "None...
Test if current message match a patterns or template.
[ "Test", "if", "current", "message", "match", "a", "patterns", "or", "template", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L52-L66
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags.get_properties
def get_properties(cls): """Get all properties of the MessageFlags class.""" property_names = [p for p in dir(cls) if isinstance(getattr(cls, p), property)] return property_names
python
def get_properties(cls): """Get all properties of the MessageFlags class.""" property_names = [p for p in dir(cls) if isinstance(getattr(cls, p), property)] return property_names
[ "def", "get_properties", "(", "cls", ")", ":", "property_names", "=", "[", "p", "for", "p", "in", "dir", "(", "cls", ")", "if", "isinstance", "(", "getattr", "(", "cls", ",", "p", ")", ",", "property", ")", "]", "return", "property_names" ]
Get all properties of the MessageFlags class.
[ "Get", "all", "properties", "of", "the", "MessageFlags", "class", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L69-L73
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags.isDirect
def isDirect(self): """Test if the message is a direct message type.""" direct = (self._messageType == 0x00) if self.isDirectACK or self.isDirectNAK: direct = True return direct
python
def isDirect(self): """Test if the message is a direct message type.""" direct = (self._messageType == 0x00) if self.isDirectACK or self.isDirectNAK: direct = True return direct
[ "def", "isDirect", "(", "self", ")", ":", "direct", "=", "(", "self", ".", "_messageType", "==", "0x00", ")", "if", "self", ".", "isDirectACK", "or", "self", ".", "isDirectNAK", ":", "direct", "=", "True", "return", "direct" ]
Test if the message is a direct message type.
[ "Test", "if", "the", "message", "is", "a", "direct", "message", "type", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L82-L87
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags.create
def create(cls, messageType, extended, hopsleft=3, hopsmax=3): """Create message flags. messageType: integter 0 to 7: MESSAGE_TYPE_DIRECT_MESSAGE = 0 MESSAGE_TYPE_DIRECT_MESSAGE_ACK = 1 MESSAGE_TYPE_ALL_LINK_CLEANUP = 2 MESSAGE_TYPE_ALL_LINK_CLEANUP_ACK =...
python
def create(cls, messageType, extended, hopsleft=3, hopsmax=3): """Create message flags. messageType: integter 0 to 7: MESSAGE_TYPE_DIRECT_MESSAGE = 0 MESSAGE_TYPE_DIRECT_MESSAGE_ACK = 1 MESSAGE_TYPE_ALL_LINK_CLEANUP = 2 MESSAGE_TYPE_ALL_LINK_CLEANUP_ACK =...
[ "def", "create", "(", "cls", ",", "messageType", ",", "extended", ",", "hopsleft", "=", "3", ",", "hopsmax", "=", "3", ")", ":", "flags", "=", "MessageFlags", "(", "None", ")", "if", "messageType", "<", "8", ":", "flags", ".", "_messageType", "=", "m...
Create message flags. messageType: integter 0 to 7: MESSAGE_TYPE_DIRECT_MESSAGE = 0 MESSAGE_TYPE_DIRECT_MESSAGE_ACK = 1 MESSAGE_TYPE_ALL_LINK_CLEANUP = 2 MESSAGE_TYPE_ALL_LINK_CLEANUP_ACK = 3 MESSAGE_TYPE_BROADCAST_MESSAGE = 4 MESSAGE_TYPE...
[ "Create", "message", "flags", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L167-L197
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags.bytes
def bytes(self): """Return a byte representation of the message flags.""" flagByte = 0x00 messageType = 0 if self._messageType is not None: messageType = self._messageType << 5 extendedBit = 0 if self._extended is None else self._extended << 4 hopsMax = 0 if s...
python
def bytes(self): """Return a byte representation of the message flags.""" flagByte = 0x00 messageType = 0 if self._messageType is not None: messageType = self._messageType << 5 extendedBit = 0 if self._extended is None else self._extended << 4 hopsMax = 0 if s...
[ "def", "bytes", "(", "self", ")", ":", "flagByte", "=", "0x00", "messageType", "=", "0", "if", "self", ".", "_messageType", "is", "not", "None", ":", "messageType", "=", "self", ".", "_messageType", "<<", "5", "extendedBit", "=", "0", "if", "self", "."...
Return a byte representation of the message flags.
[ "Return", "a", "byte", "representation", "of", "the", "message", "flags", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L238-L248
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags._normalize
def _normalize(self, flags): """Take any format of flags and turn it into a hex string.""" norm = None if isinstance(flags, MessageFlags): norm = flags.bytes elif isinstance(flags, bytearray): norm = binascii.hexlify(flags) elif isinstance(flags, int): ...
python
def _normalize(self, flags): """Take any format of flags and turn it into a hex string.""" norm = None if isinstance(flags, MessageFlags): norm = flags.bytes elif isinstance(flags, bytearray): norm = binascii.hexlify(flags) elif isinstance(flags, int): ...
[ "def", "_normalize", "(", "self", ",", "flags", ")", ":", "norm", "=", "None", "if", "isinstance", "(", "flags", ",", "MessageFlags", ")", ":", "norm", "=", "flags", ".", "bytes", "elif", "isinstance", "(", "flags", ",", "bytearray", ")", ":", "norm", ...
Take any format of flags and turn it into a hex string.
[ "Take", "any", "format", "of", "flags", "and", "turn", "it", "into", "a", "hex", "string", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L256-L275
train
nugget/python-insteonplm
insteonplm/messages/messageFlags.py
MessageFlags._set_properties
def _set_properties(self, flags): """Set the properties of the message flags based on a byte input.""" flagByte = self._normalize(flags) if flagByte is not None: self._messageType = (flagByte[0] & 0xe0) >> 5 self._extended = (flagByte[0] & MESSAGE_FLAG_EXTENDED_0X10) >> ...
python
def _set_properties(self, flags): """Set the properties of the message flags based on a byte input.""" flagByte = self._normalize(flags) if flagByte is not None: self._messageType = (flagByte[0] & 0xe0) >> 5 self._extended = (flagByte[0] & MESSAGE_FLAG_EXTENDED_0X10) >> ...
[ "def", "_set_properties", "(", "self", ",", "flags", ")", ":", "flagByte", "=", "self", ".", "_normalize", "(", "flags", ")", "if", "flagByte", "is", "not", "None", ":", "self", ".", "_messageType", "=", "(", "flagByte", "[", "0", "]", "&", "0xe0", "...
Set the properties of the message flags based on a byte input.
[ "Set", "the", "properties", "of", "the", "message", "flags", "based", "on", "a", "byte", "input", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L277-L290
train
nugget/python-insteonplm
insteonplm/states/sensor.py
LeakSensorDryWet.set_value
def set_value(self, dry_wet: LeakSensorState): """Set the value of the state to dry or wet.""" value = 0 if dry_wet == self._dry_wet_type: value = 1 self._update_subscribers(value)
python
def set_value(self, dry_wet: LeakSensorState): """Set the value of the state to dry or wet.""" value = 0 if dry_wet == self._dry_wet_type: value = 1 self._update_subscribers(value)
[ "def", "set_value", "(", "self", ",", "dry_wet", ":", "LeakSensorState", ")", ":", "value", "=", "0", "if", "dry_wet", "==", "self", ".", "_dry_wet_type", ":", "value", "=", "1", "self", ".", "_update_subscribers", "(", "value", ")" ]
Set the value of the state to dry or wet.
[ "Set", "the", "value", "of", "the", "state", "to", "dry", "or", "wet", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L316-L321
train
nugget/python-insteonplm
insteonplm/states/sensor.py
LeakSensorDryWet._dry_wet_message_received
def _dry_wet_message_received(self, msg): """Report a dry or a wet state.""" for callback in self._dry_wet_callbacks: callback(self._dry_wet_type) self._update_subscribers(0x01)
python
def _dry_wet_message_received(self, msg): """Report a dry or a wet state.""" for callback in self._dry_wet_callbacks: callback(self._dry_wet_type) self._update_subscribers(0x01)
[ "def", "_dry_wet_message_received", "(", "self", ",", "msg", ")", ":", "for", "callback", "in", "self", ".", "_dry_wet_callbacks", ":", "callback", "(", "self", ".", "_dry_wet_type", ")", "self", ".", "_update_subscribers", "(", "0x01", ")" ]
Report a dry or a wet state.
[ "Report", "a", "dry", "or", "a", "wet", "state", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L324-L328
train
nugget/python-insteonplm
insteonplm/states/sensor.py
LeakSensorHeartbeat.set_value
def set_value(self, dry_wet: LeakSensorState): """Set the state to wet or dry.""" if dry_wet == LeakSensorState.DRY: self._update_subscribers(0x11) else: self._update_subscribers(0x13)
python
def set_value(self, dry_wet: LeakSensorState): """Set the state to wet or dry.""" if dry_wet == LeakSensorState.DRY: self._update_subscribers(0x11) else: self._update_subscribers(0x13)
[ "def", "set_value", "(", "self", ",", "dry_wet", ":", "LeakSensorState", ")", ":", "if", "dry_wet", "==", "LeakSensorState", ".", "DRY", ":", "self", ".", "_update_subscribers", "(", "0x11", ")", "else", ":", "self", ".", "_update_subscribers", "(", "0x13", ...
Set the state to wet or dry.
[ "Set", "the", "state", "to", "wet", "or", "dry", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L408-L413
train
nugget/python-insteonplm
insteonplm/states/sensor.py
LeakSensorHeartbeat._dry_message_received
def _dry_message_received(self, msg): """Report a dry state.""" for callback in self._dry_wet_callbacks: callback(LeakSensorState.DRY) self._update_subscribers(0x11)
python
def _dry_message_received(self, msg): """Report a dry state.""" for callback in self._dry_wet_callbacks: callback(LeakSensorState.DRY) self._update_subscribers(0x11)
[ "def", "_dry_message_received", "(", "self", ",", "msg", ")", ":", "for", "callback", "in", "self", ".", "_dry_wet_callbacks", ":", "callback", "(", "LeakSensorState", ".", "DRY", ")", "self", ".", "_update_subscribers", "(", "0x11", ")" ]
Report a dry state.
[ "Report", "a", "dry", "state", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L416-L420
train
nugget/python-insteonplm
insteonplm/states/sensor.py
LeakSensorHeartbeat._wet_message_received
def _wet_message_received(self, msg): """Report a wet state.""" for callback in self._dry_wet_callbacks: callback(LeakSensorState.WET) self._update_subscribers(0x13)
python
def _wet_message_received(self, msg): """Report a wet state.""" for callback in self._dry_wet_callbacks: callback(LeakSensorState.WET) self._update_subscribers(0x13)
[ "def", "_wet_message_received", "(", "self", ",", "msg", ")", ":", "for", "callback", "in", "self", ".", "_dry_wet_callbacks", ":", "callback", "(", "LeakSensorState", ".", "WET", ")", "self", ".", "_update_subscribers", "(", "0x13", ")" ]
Report a wet state.
[ "Report", "a", "wet", "state", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L423-L427
train
nugget/python-insteonplm
insteonplm/messagecallback.py
MessageCallback.add
def add(self, msg, callback, override=False): """Add a callback to the callback list. msg: Message template. callback: Callback method override: True - replace all existing callbacks for that template False - append the list of callbacks for that message ...
python
def add(self, msg, callback, override=False): """Add a callback to the callback list. msg: Message template. callback: Callback method override: True - replace all existing callbacks for that template False - append the list of callbacks for that message ...
[ "def", "add", "(", "self", ",", "msg", ",", "callback", ",", "override", "=", "False", ")", ":", "if", "override", ":", "if", "isinstance", "(", "callback", ",", "list", ")", ":", "self", ".", "_dict", "[", "msg", "]", "=", "callback", "else", ":",...
Add a callback to the callback list. msg: Message template. callback: Callback method override: True - replace all existing callbacks for that template False - append the list of callbacks for that message Default is False
[ "Add", "a", "callback", "to", "the", "callback", "list", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messagecallback.py#L64-L81
train
nugget/python-insteonplm
insteonplm/messagecallback.py
MessageCallback.remove
def remove(self, msg, callback): """Remove a callback from the callback list. msg: Message template callback: Callback method to remove. If callback is None, all callbacks for the message template are removed. """ if callback is None: self._dict.pop(...
python
def remove(self, msg, callback): """Remove a callback from the callback list. msg: Message template callback: Callback method to remove. If callback is None, all callbacks for the message template are removed. """ if callback is None: self._dict.pop(...
[ "def", "remove", "(", "self", ",", "msg", ",", "callback", ")", ":", "if", "callback", "is", "None", ":", "self", ".", "_dict", ".", "pop", "(", "msg", ",", "None", ")", "else", ":", "cb", "=", "self", ".", "_dict", ".", "get", "(", "msg", ",",...
Remove a callback from the callback list. msg: Message template callback: Callback method to remove. If callback is None, all callbacks for the message template are removed.
[ "Remove", "a", "callback", "from", "the", "callback", "list", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messagecallback.py#L83-L105
train
nugget/python-insteonplm
insteonplm/messagecallback.py
MessageCallback.get_callbacks_from_message
def get_callbacks_from_message(self, msg): """Return the callbacks associated with a message template.""" callbacks = [] for key in self._find_matching_keys(msg): for callback in self[key]: callbacks.append(callback) return callbacks
python
def get_callbacks_from_message(self, msg): """Return the callbacks associated with a message template.""" callbacks = [] for key in self._find_matching_keys(msg): for callback in self[key]: callbacks.append(callback) return callbacks
[ "def", "get_callbacks_from_message", "(", "self", ",", "msg", ")", ":", "callbacks", "=", "[", "]", "for", "key", "in", "self", ".", "_find_matching_keys", "(", "msg", ")", ":", "for", "callback", "in", "self", "[", "key", "]", ":", "callbacks", ".", "...
Return the callbacks associated with a message template.
[ "Return", "the", "callbacks", "associated", "with", "a", "message", "template", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messagecallback.py#L107-L113
train
nugget/python-insteonplm
insteonplm/devices/ipdb.py
IPDB.x10
def x10(self, feature): """Return an X10 device based on a feature. Current features: - OnOff - Dimmable """ x10_product = None for product in self._x10_products: if feature.lower() == product.feature: x10_product = product if...
python
def x10(self, feature): """Return an X10 device based on a feature. Current features: - OnOff - Dimmable """ x10_product = None for product in self._x10_products: if feature.lower() == product.feature: x10_product = product if...
[ "def", "x10", "(", "self", ",", "feature", ")", ":", "x10_product", "=", "None", "for", "product", "in", "self", ".", "_x10_products", ":", "if", "feature", ".", "lower", "(", ")", "==", "product", ".", "feature", ":", "x10_product", "=", "product", "i...
Return an X10 device based on a feature. Current features: - OnOff - Dimmable
[ "Return", "an", "X10", "device", "based", "on", "a", "feature", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/ipdb.py#L386-L401
train
nugget/python-insteonplm
insteonplm/tools.py
interactive
def interactive(): """Create an interactive command line tool. Wrapper for an interactive session for manual commands to be entered. """ parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--device', default='/dev/ttyUSB0', help='Path to PLM device') ...
python
def interactive(): """Create an interactive command line tool. Wrapper for an interactive session for manual commands to be entered. """ parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--device', default='/dev/ttyUSB0', help='Path to PLM device') ...
[ "def", "interactive", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "__doc__", ")", "parser", ".", "add_argument", "(", "'--device'", ",", "default", "=", "'/dev/ttyUSB0'", ",", "help", "=", "'Path to PLM device'", "...
Create an interactive command line tool. Wrapper for an interactive session for manual commands to be entered.
[ "Create", "an", "interactive", "command", "line", "tool", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1203-L1240
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.connect
async def connect(self, poll_devices=False, device=None, workdir=None): """Connect to the IM.""" await self.aldb_load_lock.acquire() device = self.host if self.host else self.device _LOGGING.info('Connecting to Insteon Modem at %s', device) self.device = device if device else sel...
python
async def connect(self, poll_devices=False, device=None, workdir=None): """Connect to the IM.""" await self.aldb_load_lock.acquire() device = self.host if self.host else self.device _LOGGING.info('Connecting to Insteon Modem at %s', device) self.device = device if device else sel...
[ "async", "def", "connect", "(", "self", ",", "poll_devices", "=", "False", ",", "device", "=", "None", ",", "workdir", "=", "None", ")", ":", "await", "self", ".", "aldb_load_lock", ".", "acquire", "(", ")", "device", "=", "self", ".", "host", "if", ...
Connect to the IM.
[ "Connect", "to", "the", "IM", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L79-L102
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.monitor_mode
async def monitor_mode(self, poll_devices=False, device=None, workdir=None): """Place the IM in monitoring mode.""" print("Running monitor mode") await self.connect(poll_devices, device, workdir) self.plm.monitor_mode()
python
async def monitor_mode(self, poll_devices=False, device=None, workdir=None): """Place the IM in monitoring mode.""" print("Running monitor mode") await self.connect(poll_devices, device, workdir) self.plm.monitor_mode()
[ "async", "def", "monitor_mode", "(", "self", ",", "poll_devices", "=", "False", ",", "device", "=", "None", ",", "workdir", "=", "None", ")", ":", "print", "(", "\"Running monitor mode\"", ")", "await", "self", ".", "connect", "(", "poll_devices", ",", "de...
Place the IM in monitoring mode.
[ "Place", "the", "IM", "in", "monitoring", "mode", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L104-L109
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.async_new_device_callback
def async_new_device_callback(self, device): """Log that our new device callback worked.""" _LOGGING.info( 'New Device: %s cat: 0x%02x subcat: 0x%02x desc: %s, model: %s', device.id, device.cat, device.subcat, device.description, device.model) for state in dev...
python
def async_new_device_callback(self, device): """Log that our new device callback worked.""" _LOGGING.info( 'New Device: %s cat: 0x%02x subcat: 0x%02x desc: %s, model: %s', device.id, device.cat, device.subcat, device.description, device.model) for state in dev...
[ "def", "async_new_device_callback", "(", "self", ",", "device", ")", ":", "_LOGGING", ".", "info", "(", "'New Device: %s cat: 0x%02x subcat: 0x%02x desc: %s, model: %s'", ",", "device", ".", "id", ",", "device", ".", "cat", ",", "device", ".", "subcat", ",", "devi...
Log that our new device callback worked.
[ "Log", "that", "our", "new", "device", "callback", "worked", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L111-L119
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.async_state_change_callback
def async_state_change_callback(self, addr, state, value): """Log the state change.""" _LOGGING.info('Device %s state %s value is changed to %s', addr, state, value)
python
def async_state_change_callback(self, addr, state, value): """Log the state change.""" _LOGGING.info('Device %s state %s value is changed to %s', addr, state, value)
[ "def", "async_state_change_callback", "(", "self", ",", "addr", ",", "state", ",", "value", ")", ":", "_LOGGING", ".", "info", "(", "'Device %s state %s value is changed to %s'", ",", "addr", ",", "state", ",", "value", ")" ]
Log the state change.
[ "Log", "the", "state", "change", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L122-L125
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.async_aldb_loaded_callback
def async_aldb_loaded_callback(self): """Unlock the ALDB load lock when loading is complete.""" if self.aldb_load_lock.locked(): self.aldb_load_lock.release() _LOGGING.info('ALDB Loaded')
python
def async_aldb_loaded_callback(self): """Unlock the ALDB load lock when loading is complete.""" if self.aldb_load_lock.locked(): self.aldb_load_lock.release() _LOGGING.info('ALDB Loaded')
[ "def", "async_aldb_loaded_callback", "(", "self", ")", ":", "if", "self", ".", "aldb_load_lock", ".", "locked", "(", ")", ":", "self", ".", "aldb_load_lock", ".", "release", "(", ")", "_LOGGING", ".", "info", "(", "'ALDB Loaded'", ")" ]
Unlock the ALDB load lock when loading is complete.
[ "Unlock", "the", "ALDB", "load", "lock", "when", "loading", "is", "complete", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L127-L131
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.start_all_linking
async def start_all_linking(self, linkcode, group, address=None): """Start the All-Linking process with the IM and device.""" _LOGGING.info('Starting the All-Linking process') if address: linkdevice = self.plm.devices[Address(address).id] if not linkdevice: ...
python
async def start_all_linking(self, linkcode, group, address=None): """Start the All-Linking process with the IM and device.""" _LOGGING.info('Starting the All-Linking process') if address: linkdevice = self.plm.devices[Address(address).id] if not linkdevice: ...
[ "async", "def", "start_all_linking", "(", "self", ",", "linkcode", ",", "group", ",", "address", "=", "None", ")", ":", "_LOGGING", ".", "info", "(", "'Starting the All-Linking process'", ")", "if", "address", ":", "linkdevice", "=", "self", ".", "plm", ".",...
Start the All-Linking process with the IM and device.
[ "Start", "the", "All", "-", "Linking", "process", "with", "the", "IM", "and", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L133-L153
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.list_devices
def list_devices(self): """List devices in the ALDB.""" if self.plm.devices: for addr in self.plm.devices: device = self.plm.devices[addr] if device.address.is_x10: _LOGGING.info('Device: %s %s', device.address.human, ...
python
def list_devices(self): """List devices in the ALDB.""" if self.plm.devices: for addr in self.plm.devices: device = self.plm.devices[addr] if device.address.is_x10: _LOGGING.info('Device: %s %s', device.address.human, ...
[ "def", "list_devices", "(", "self", ")", ":", "if", "self", ".", "plm", ".", "devices", ":", "for", "addr", "in", "self", ".", "plm", ".", "devices", ":", "device", "=", "self", ".", "plm", ".", "devices", "[", "addr", "]", "if", "device", ".", "...
List devices in the ALDB.
[ "List", "devices", "in", "the", "ALDB", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L155-L173
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.print_device_aldb
def print_device_aldb(self, addr): """Diplay the All-Link database for a device.""" if Address(addr).id == self.plm.address.id: device = self.plm else: dev_addr = Address(addr) device = self.plm.devices[dev_addr.id] if device: if device.ald...
python
def print_device_aldb(self, addr): """Diplay the All-Link database for a device.""" if Address(addr).id == self.plm.address.id: device = self.plm else: dev_addr = Address(addr) device = self.plm.devices[dev_addr.id] if device: if device.ald...
[ "def", "print_device_aldb", "(", "self", ",", "addr", ")", ":", "if", "Address", "(", "addr", ")", ".", "id", "==", "self", ".", "plm", ".", "address", ".", "id", ":", "device", "=", "self", ".", "plm", "else", ":", "dev_addr", "=", "Address", "(",...
Diplay the All-Link database for a device.
[ "Diplay", "the", "All", "-", "Link", "database", "for", "a", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L221-L241
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.print_all_aldb
def print_all_aldb(self): """Diplay the All-Link database for all devices.""" addr = self.plm.address.id _LOGGING.info('ALDB for PLM device %s', addr) self.print_device_aldb(addr) if self.plm.devices: for addr in self.plm.devices: _LOGGING.info('ALDB f...
python
def print_all_aldb(self): """Diplay the All-Link database for all devices.""" addr = self.plm.address.id _LOGGING.info('ALDB for PLM device %s', addr) self.print_device_aldb(addr) if self.plm.devices: for addr in self.plm.devices: _LOGGING.info('ALDB f...
[ "def", "print_all_aldb", "(", "self", ")", ":", "addr", "=", "self", ".", "plm", ".", "address", ".", "id", "_LOGGING", ".", "info", "(", "'ALDB for PLM device %s'", ",", "addr", ")", "self", ".", "print_device_aldb", "(", "addr", ")", "if", "self", ".",...
Diplay the All-Link database for all devices.
[ "Diplay", "the", "All", "-", "Link", "database", "for", "all", "devices", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L243-L256
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.load_device_aldb
async def load_device_aldb(self, addr, clear=True): """Read the device ALDB.""" dev_addr = Address(addr) device = None if dev_addr == self.plm.address: device = self.plm else: device = self.plm.devices[dev_addr.id] if device: if clear: ...
python
async def load_device_aldb(self, addr, clear=True): """Read the device ALDB.""" dev_addr = Address(addr) device = None if dev_addr == self.plm.address: device = self.plm else: device = self.plm.devices[dev_addr.id] if device: if clear: ...
[ "async", "def", "load_device_aldb", "(", "self", ",", "addr", ",", "clear", "=", "True", ")", ":", "dev_addr", "=", "Address", "(", "addr", ")", "device", "=", "None", "if", "dev_addr", "==", "self", ".", "plm", ".", "address", ":", "device", "=", "s...
Read the device ALDB.
[ "Read", "the", "device", "ALDB", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L258-L277
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.load_all_aldb
async def load_all_aldb(self, clear=True): """Read all devices ALDB.""" for addr in self.plm.devices: await self.load_device_aldb(addr, clear)
python
async def load_all_aldb(self, clear=True): """Read all devices ALDB.""" for addr in self.plm.devices: await self.load_device_aldb(addr, clear)
[ "async", "def", "load_all_aldb", "(", "self", ",", "clear", "=", "True", ")", ":", "for", "addr", "in", "self", ".", "plm", ".", "devices", ":", "await", "self", ".", "load_device_aldb", "(", "addr", ",", "clear", ")" ]
Read all devices ALDB.
[ "Read", "all", "devices", "ALDB", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L279-L282
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.add_device_override
def add_device_override(self, addr, cat, subcat, firmware=None): """Add a device override to the PLM.""" self.plm.devices.add_override(addr, 'cat', cat) self.plm.devices.add_override(addr, 'subcat', subcat) if firmware: self.plm.devices.add_override(addr, 'firmware', firmware...
python
def add_device_override(self, addr, cat, subcat, firmware=None): """Add a device override to the PLM.""" self.plm.devices.add_override(addr, 'cat', cat) self.plm.devices.add_override(addr, 'subcat', subcat) if firmware: self.plm.devices.add_override(addr, 'firmware', firmware...
[ "def", "add_device_override", "(", "self", ",", "addr", ",", "cat", ",", "subcat", ",", "firmware", "=", "None", ")", ":", "self", ".", "plm", ".", "devices", ".", "add_override", "(", "addr", ",", "'cat'", ",", "cat", ")", "self", ".", "plm", ".", ...
Add a device override to the PLM.
[ "Add", "a", "device", "override", "to", "the", "PLM", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L311-L316
train
nugget/python-insteonplm
insteonplm/tools.py
Tools.add_x10_device
def add_x10_device(self, housecode, unitcode, dev_type): """Add an X10 device to the PLM.""" device = None try: device = self.plm.devices.add_x10_device(self.plm, housecode, unitcode, dev_type) except ValueError: ...
python
def add_x10_device(self, housecode, unitcode, dev_type): """Add an X10 device to the PLM.""" device = None try: device = self.plm.devices.add_x10_device(self.plm, housecode, unitcode, dev_type) except ValueError: ...
[ "def", "add_x10_device", "(", "self", ",", "housecode", ",", "unitcode", ",", "dev_type", ")", ":", "device", "=", "None", "try", ":", "device", "=", "self", ".", "plm", ".", "devices", ".", "add_x10_device", "(", "self", ".", "plm", ",", "housecode", ...
Add an X10 device to the PLM.
[ "Add", "an", "X10", "device", "to", "the", "PLM", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L318-L326
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.start
def start(self): """Start the command process loop.""" self.loop.create_task(self._read_line()) self.loop.create_task(self._greeting())
python
def start(self): """Start the command process loop.""" self.loop.create_task(self._read_line()) self.loop.create_task(self._greeting())
[ "def", "start", "(", "self", ")", ":", "self", ".", "loop", ".", "create_task", "(", "self", ".", "_read_line", "(", ")", ")", "self", ".", "loop", ".", "create_task", "(", "self", ".", "_greeting", "(", ")", ")" ]
Start the command process loop.
[ "Start", "the", "command", "process", "loop", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L364-L367
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_connect
async def do_connect(self, args): """Connect to the PLM device. Usage: connect [device [workdir]] Arguments: device: PLM device (default /dev/ttyUSB0) workdir: Working directory to save and load device information """ params = args.split() ...
python
async def do_connect(self, args): """Connect to the PLM device. Usage: connect [device [workdir]] Arguments: device: PLM device (default /dev/ttyUSB0) workdir: Working directory to save and load device information """ params = args.split() ...
[ "async", "def", "do_connect", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "device", "=", "'/dev/ttyUSB0'", "workdir", "=", "None", "try", ":", "device", "=", "params", "[", "0", "]", "except", "IndexError", ":", ...
Connect to the PLM device. Usage: connect [device [workdir]] Arguments: device: PLM device (default /dev/ttyUSB0) workdir: Working directory to save and load device information
[ "Connect", "to", "the", "PLM", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L422-L448
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_running_tasks
def do_running_tasks(self, arg): """List tasks running in the background. Usage: running_tasks Arguments: """ for task in asyncio.Task.all_tasks(loop=self.loop): _LOGGING.info(task)
python
def do_running_tasks(self, arg): """List tasks running in the background. Usage: running_tasks Arguments: """ for task in asyncio.Task.all_tasks(loop=self.loop): _LOGGING.info(task)
[ "def", "do_running_tasks", "(", "self", ",", "arg", ")", ":", "for", "task", "in", "asyncio", ".", "Task", ".", "all_tasks", "(", "loop", "=", "self", ".", "loop", ")", ":", "_LOGGING", ".", "info", "(", "task", ")" ]
List tasks running in the background. Usage: running_tasks Arguments:
[ "List", "tasks", "running", "in", "the", "background", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L451-L459
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_add_all_link
def do_add_all_link(self, args): """Add an All-Link record to the IM and a device. Usage: add_all_link [linkcode] [group] [address] Arguments: linkcode: 0 - PLM is responder 1 - PLM is controller 3 - PLM is controller or respon...
python
def do_add_all_link(self, args): """Add an All-Link record to the IM and a device. Usage: add_all_link [linkcode] [group] [address] Arguments: linkcode: 0 - PLM is responder 1 - PLM is controller 3 - PLM is controller or respon...
[ "def", "do_add_all_link", "(", "self", ",", "args", ")", ":", "linkcode", "=", "1", "group", "=", "0", "addr", "=", "None", "params", "=", "args", ".", "split", "(", ")", "if", "params", ":", "try", ":", "linkcode", "=", "int", "(", "params", "[", ...
Add an All-Link record to the IM and a device. Usage: add_all_link [linkcode] [group] [address] Arguments: linkcode: 0 - PLM is responder 1 - PLM is controller 3 - PLM is controller or responder Default 1 ...
[ "Add", "an", "All", "-", "Link", "record", "to", "the", "IM", "and", "a", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L503-L546
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_print_aldb
def do_print_aldb(self, args): """Print the All-Link database for a device. Usage: print_aldb address|plm|all Arguments: address: INSTEON address of the device plm: Print the All-Link database for the PLM all: Print the All-Link database for all d...
python
def do_print_aldb(self, args): """Print the All-Link database for a device. Usage: print_aldb address|plm|all Arguments: address: INSTEON address of the device plm: Print the All-Link database for the PLM all: Print the All-Link database for all d...
[ "def", "do_print_aldb", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "addr", "=", "None", "try", ":", "addr", "=", "params", "[", "0", "]", "except", "IndexError", ":", "_LOGGING", ".", "error", "(", "'Device add...
Print the All-Link database for a device. Usage: print_aldb address|plm|all Arguments: address: INSTEON address of the device plm: Print the All-Link database for the PLM all: Print the All-Link database for all devices This method requires that ...
[ "Print", "the", "All", "-", "Link", "database", "for", "a", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L581-L611
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_set_hub_connection
def do_set_hub_connection(self, args): """Set Hub connection parameters. Usage: set_hub_connection username password host [port] Arguments: username: Hub username password: Hub password host: host name or IP address port: IP port [def...
python
def do_set_hub_connection(self, args): """Set Hub connection parameters. Usage: set_hub_connection username password host [port] Arguments: username: Hub username password: Hub password host: host name or IP address port: IP port [def...
[ "def", "do_set_hub_connection", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "username", "=", "None", "password", "=", "None", "host", "=", "None", "port", "=", "None", "try", ":", "username", "=", "params", "[", ...
Set Hub connection parameters. Usage: set_hub_connection username password host [port] Arguments: username: Hub username password: Hub password host: host name or IP address port: IP port [default 25105]
[ "Set", "Hub", "connection", "parameters", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L613-L648
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_set_log_file
def do_set_log_file(self, args): """Set the log file. Usage: set_log_file filename Parameters: filename: log file name to write to THIS CAN ONLY BE CALLED ONCE AND MUST BE CALLED BEFORE ANY LOGGING STARTS. """ params = args.split() ...
python
def do_set_log_file(self, args): """Set the log file. Usage: set_log_file filename Parameters: filename: log file name to write to THIS CAN ONLY BE CALLED ONCE AND MUST BE CALLED BEFORE ANY LOGGING STARTS. """ params = args.split() ...
[ "def", "do_set_log_file", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "try", ":", "filename", "=", "params", "[", "0", "]", "logging", ".", "basicConfig", "(", "filename", "=", "filename", ")", "except", "IndexErr...
Set the log file. Usage: set_log_file filename Parameters: filename: log file name to write to THIS CAN ONLY BE CALLED ONCE AND MUST BE CALLED BEFORE ANY LOGGING STARTS.
[ "Set", "the", "log", "file", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L650-L666
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_load_aldb
async def do_load_aldb(self, args): """Load the All-Link database for a device. Usage: load_aldb address|all [clear_prior] Arguments: address: NSTEON address of the device all: Load the All-Link database for all devices clear_prior: y|n ...
python
async def do_load_aldb(self, args): """Load the All-Link database for a device. Usage: load_aldb address|all [clear_prior] Arguments: address: NSTEON address of the device all: Load the All-Link database for all devices clear_prior: y|n ...
[ "async", "def", "do_load_aldb", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "addr", "=", "None", "clear", "=", "True", "try", ":", "addr", "=", "params", "[", "0", "]", "except", "IndexError", ":", "_LOGGING", ...
Load the All-Link database for a device. Usage: load_aldb address|all [clear_prior] Arguments: address: NSTEON address of the device all: Load the All-Link database for all devices clear_prior: y|n y - Clear the prior data and sta...
[ "Load", "the", "All", "-", "Link", "database", "for", "a", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L668-L712
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_write_aldb
async def do_write_aldb(self, args): """Write device All-Link record. WARNING THIS METHOD CAN DAMAGE YOUR DEVICE IF USED INCORRECTLY. Please ensure the memory id is appropriate for the device. You must load the ALDB of the device before using this method. The memory id must be a...
python
async def do_write_aldb(self, args): """Write device All-Link record. WARNING THIS METHOD CAN DAMAGE YOUR DEVICE IF USED INCORRECTLY. Please ensure the memory id is appropriate for the device. You must load the ALDB of the device before using this method. The memory id must be a...
[ "async", "def", "do_write_aldb", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "addr", "=", "None", "mem_bytes", "=", "None", "memory", "=", "None", "mode", "=", "None", "group", "=", "None", "target", "=", "None"...
Write device All-Link record. WARNING THIS METHOD CAN DAMAGE YOUR DEVICE IF USED INCORRECTLY. Please ensure the memory id is appropriate for the device. You must load the ALDB of the device before using this method. The memory id must be an existing memory id in the ALDB or this ...
[ "Write", "device", "All", "-", "Link", "record", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L714-L790
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_del_aldb
async def do_del_aldb(self, args): """Delete device All-Link record. WARNING THIS METHOD CAN DAMAGE YOUR DEVICE IF USED INCORRECTLY. Please ensure the memory id is appropriate for the device. You must load the ALDB of the device before using this method. The memory id must be an...
python
async def do_del_aldb(self, args): """Delete device All-Link record. WARNING THIS METHOD CAN DAMAGE YOUR DEVICE IF USED INCORRECTLY. Please ensure the memory id is appropriate for the device. You must load the ALDB of the device before using this method. The memory id must be an...
[ "async", "def", "do_del_aldb", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "addr", "=", "None", "mem_bytes", "=", "None", "memory", "=", "None", "try", ":", "addr", "=", "Address", "(", "params", "[", "0", "]"...
Delete device All-Link record. WARNING THIS METHOD CAN DAMAGE YOUR DEVICE IF USED INCORRECTLY. Please ensure the memory id is appropriate for the device. You must load the ALDB of the device before using this method. The memory id must be an existing memory id in the ALDB or this ...
[ "Delete", "device", "All", "-", "Link", "record", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L792-L832
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_set_log_level
def do_set_log_level(self, arg): """Set the log level. Usage: set_log_level i|v Parameters: log_level: i - info | v - verbose """ if arg in ['i', 'v']: _LOGGING.info('Setting log level to %s', arg) if arg == 'i': _...
python
def do_set_log_level(self, arg): """Set the log level. Usage: set_log_level i|v Parameters: log_level: i - info | v - verbose """ if arg in ['i', 'v']: _LOGGING.info('Setting log level to %s', arg) if arg == 'i': _...
[ "def", "do_set_log_level", "(", "self", ",", "arg", ")", ":", "if", "arg", "in", "[", "'i'", ",", "'v'", "]", ":", "_LOGGING", ".", "info", "(", "'Setting log level to %s'", ",", "arg", ")", "if", "arg", "==", "'i'", ":", "_LOGGING", ".", "setLevel", ...
Set the log level. Usage: set_log_level i|v Parameters: log_level: i - info | v - verbose
[ "Set", "the", "log", "level", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L834-L853
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_set_device
def do_set_device(self, args): """Set the PLM OS device. Device defaults to /dev/ttyUSB0 Usage: set_device device Arguments: device: Required - INSTEON PLM device """ params = args.split() device = None try: device = ...
python
def do_set_device(self, args): """Set the PLM OS device. Device defaults to /dev/ttyUSB0 Usage: set_device device Arguments: device: Required - INSTEON PLM device """ params = args.split() device = None try: device = ...
[ "def", "do_set_device", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "device", "=", "None", "try", ":", "device", "=", "params", "[", "0", "]", "except", "IndexError", ":", "_LOGGING", ".", "error", "(", "'Device...
Set the PLM OS device. Device defaults to /dev/ttyUSB0 Usage: set_device device Arguments: device: Required - INSTEON PLM device
[ "Set", "the", "PLM", "OS", "device", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L855-L875
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_set_workdir
def do_set_workdir(self, args): """Set the working directory. The working directory is used to load and save known devices to improve startup times. During startup the application loads and saves a file `insteon_plm_device_info.dat`. This file is saved in the working directory. ...
python
def do_set_workdir(self, args): """Set the working directory. The working directory is used to load and save known devices to improve startup times. During startup the application loads and saves a file `insteon_plm_device_info.dat`. This file is saved in the working directory. ...
[ "def", "do_set_workdir", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "workdir", "=", "None", "try", ":", "workdir", "=", "params", "[", "0", "]", "except", "IndexError", ":", "_LOGGING", ".", "error", "(", "'Dev...
Set the working directory. The working directory is used to load and save known devices to improve startup times. During startup the application loads and saves a file `insteon_plm_device_info.dat`. This file is saved in the working directory. The working directory has no defau...
[ "Set", "the", "working", "directory", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L877-L903
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_help
def do_help(self, arg): """Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help """ cmds = arg.split() if cmds: func = getattr(self, 'do_{}'.format(cmds[0])) if func: ...
python
def do_help(self, arg): """Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help """ cmds = arg.split() if cmds: func = getattr(self, 'do_{}'.format(cmds[0])) if func: ...
[ "def", "do_help", "(", "self", ",", "arg", ")", ":", "cmds", "=", "arg", ".", "split", "(", ")", "if", "cmds", ":", "func", "=", "getattr", "(", "self", ",", "'do_{}'", ".", "format", "(", "cmds", "[", "0", "]", ")", ")", "if", "func", ":", "...
Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help
[ "Help", "command", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L905-L927
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_add_device_override
def do_add_device_override(self, args): """Add a device override to the IM. Usage: add_device_override address cat subcat [firmware] Arguments: address: Insteon address of the device to override cat: Device category subcat: Device subcategory ...
python
def do_add_device_override(self, args): """Add a device override to the IM. Usage: add_device_override address cat subcat [firmware] Arguments: address: Insteon address of the device to override cat: Device category subcat: Device subcategory ...
[ "def", "do_add_device_override", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "addr", "=", "None", "cat", "=", "None", "subcat", "=", "None", "firmware", "=", "None", "error", "=", "None", "try", ":", "addr", "="...
Add a device override to the IM. Usage: add_device_override address cat subcat [firmware] Arguments: address: Insteon address of the device to override cat: Device category subcat: Device subcategory firmware: Optional - Device firmware ...
[ "Add", "a", "device", "override", "to", "the", "IM", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L945-L992
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_add_x10_device
def do_add_x10_device(self, args): """Add an X10 device to the IM. Usage: add_x10_device housecode unitcode type Arguments: housecode: Device housecode (A - P) unitcode: Device unitcode (1 - 16) type: Device type Current device types ar...
python
def do_add_x10_device(self, args): """Add an X10 device to the IM. Usage: add_x10_device housecode unitcode type Arguments: housecode: Device housecode (A - P) unitcode: Device unitcode (1 - 16) type: Device type Current device types ar...
[ "def", "do_add_x10_device", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "housecode", "=", "None", "unitcode", "=", "None", "dev_type", "=", "None", "try", ":", "housecode", "=", "params", "[", "0", "]", "unitcode"...
Add an X10 device to the IM. Usage: add_x10_device housecode unitcode type Arguments: housecode: Device housecode (A - P) unitcode: Device unitcode (1 - 16) type: Device type Current device types are: - OnOff - Dimmable ...
[ "Add", "an", "X10", "device", "to", "the", "IM", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L994-L1039
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_kpl_status
def do_kpl_status(self, args): """Get the status of a KeypadLinc button. Usage: kpl_status address group """ params = args.split() address = None group = None try: address = params[0] group = int(params[1]) except Inde...
python
def do_kpl_status(self, args): """Get the status of a KeypadLinc button. Usage: kpl_status address group """ params = args.split() address = None group = None try: address = params[0] group = int(params[1]) except Inde...
[ "def", "do_kpl_status", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "address", "=", "None", "group", "=", "None", "try", ":", "address", "=", "params", "[", "0", "]", "group", "=", "int", "(", "params", "[", ...
Get the status of a KeypadLinc button. Usage: kpl_status address group
[ "Get", "the", "status", "of", "a", "KeypadLinc", "button", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1041-L1062
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_kpl_on
def do_kpl_on(self, args): """Turn on a KeypadLinc button. Usage: kpl_on address group """ params = args.split() address = None group = None try: address = params[0] group = int(params[1]) except IndexError: ...
python
def do_kpl_on(self, args): """Turn on a KeypadLinc button. Usage: kpl_on address group """ params = args.split() address = None group = None try: address = params[0] group = int(params[1]) except IndexError: ...
[ "def", "do_kpl_on", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "address", "=", "None", "group", "=", "None", "try", ":", "address", "=", "params", "[", "0", "]", "group", "=", "int", "(", "params", "[", "1"...
Turn on a KeypadLinc button. Usage: kpl_on address group
[ "Turn", "on", "a", "KeypadLinc", "button", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1064-L1085
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_kpl_off
def do_kpl_off(self, args): """Turn off a KeypadLinc button. Usage: kpl_on address group """ params = args.split() address = None group = None try: address = params[0] group = int(params[1]) except IndexError: ...
python
def do_kpl_off(self, args): """Turn off a KeypadLinc button. Usage: kpl_on address group """ params = args.split() address = None group = None try: address = params[0] group = int(params[1]) except IndexError: ...
[ "def", "do_kpl_off", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "address", "=", "None", "group", "=", "None", "try", ":", "address", "=", "params", "[", "0", "]", "group", "=", "int", "(", "params", "[", "1...
Turn off a KeypadLinc button. Usage: kpl_on address group
[ "Turn", "off", "a", "KeypadLinc", "button", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1087-L1108
train
nugget/python-insteonplm
insteonplm/tools.py
Commander.do_kpl_set_on_mask
def do_kpl_set_on_mask(self, args): """Set the on mask for a KeypadLinc button. Usage: kpl_set_on_mask address group mask """ params = args.split() address = None group = None mask_string = None mask = None try: address = ...
python
def do_kpl_set_on_mask(self, args): """Set the on mask for a KeypadLinc button. Usage: kpl_set_on_mask address group mask """ params = args.split() address = None group = None mask_string = None mask = None try: address = ...
[ "def", "do_kpl_set_on_mask", "(", "self", ",", "args", ")", ":", "params", "=", "args", ".", "split", "(", ")", "address", "=", "None", "group", "=", "None", "mask_string", "=", "None", "mask", "=", "None", "try", ":", "address", "=", "params", "[", ...
Set the on mask for a KeypadLinc button. Usage: kpl_set_on_mask address group mask
[ "Set", "the", "on", "mask", "for", "a", "KeypadLinc", "button", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1110-L1138
train
nugget/python-insteonplm
insteonplm/messages/userdata.py
Userdata.from_raw_message
def from_raw_message(cls, rawmessage): """Create a user data instance from a raw byte stream.""" empty = cls.create_empty(0x00) userdata_dict = cls.normalize(empty, rawmessage) return Userdata(userdata_dict)
python
def from_raw_message(cls, rawmessage): """Create a user data instance from a raw byte stream.""" empty = cls.create_empty(0x00) userdata_dict = cls.normalize(empty, rawmessage) return Userdata(userdata_dict)
[ "def", "from_raw_message", "(", "cls", ",", "rawmessage", ")", ":", "empty", "=", "cls", ".", "create_empty", "(", "0x00", ")", "userdata_dict", "=", "cls", ".", "normalize", "(", "empty", ",", "rawmessage", ")", "return", "Userdata", "(", "userdata_dict", ...
Create a user data instance from a raw byte stream.
[ "Create", "a", "user", "data", "instance", "from", "a", "raw", "byte", "stream", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L83-L87
train
nugget/python-insteonplm
insteonplm/messages/userdata.py
Userdata.create_pattern
def create_pattern(cls, userdata): """Create a user data instance with all values the same.""" empty = cls.create_empty(None) userdata_dict = cls.normalize(empty, userdata) return Userdata(userdata_dict)
python
def create_pattern(cls, userdata): """Create a user data instance with all values the same.""" empty = cls.create_empty(None) userdata_dict = cls.normalize(empty, userdata) return Userdata(userdata_dict)
[ "def", "create_pattern", "(", "cls", ",", "userdata", ")", ":", "empty", "=", "cls", ".", "create_empty", "(", "None", ")", "userdata_dict", "=", "cls", ".", "normalize", "(", "empty", ",", "userdata", ")", "return", "Userdata", "(", "userdata_dict", ")" ]
Create a user data instance with all values the same.
[ "Create", "a", "user", "data", "instance", "with", "all", "values", "the", "same", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L90-L94
train
nugget/python-insteonplm
insteonplm/messages/userdata.py
Userdata.template
def template(cls, userdata): """Create a template instance used for message callbacks.""" ud = Userdata(cls.normalize(cls.create_empty(None), userdata)) return ud
python
def template(cls, userdata): """Create a template instance used for message callbacks.""" ud = Userdata(cls.normalize(cls.create_empty(None), userdata)) return ud
[ "def", "template", "(", "cls", ",", "userdata", ")", ":", "ud", "=", "Userdata", "(", "cls", ".", "normalize", "(", "cls", ".", "create_empty", "(", "None", ")", ",", "userdata", ")", ")", "return", "ud" ]
Create a template instance used for message callbacks.
[ "Create", "a", "template", "instance", "used", "for", "message", "callbacks", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L103-L106
train
nugget/python-insteonplm
insteonplm/messages/userdata.py
Userdata.matches_pattern
def matches_pattern(self, other): """Test if the current instance matches a template instance.""" ismatch = False if isinstance(other, Userdata): for key in self._userdata: if self._userdata[key] is None or other[key] is None: ismatch = True ...
python
def matches_pattern(self, other): """Test if the current instance matches a template instance.""" ismatch = False if isinstance(other, Userdata): for key in self._userdata: if self._userdata[key] is None or other[key] is None: ismatch = True ...
[ "def", "matches_pattern", "(", "self", ",", "other", ")", ":", "ismatch", "=", "False", "if", "isinstance", "(", "other", ",", "Userdata", ")", ":", "for", "key", "in", "self", ".", "_userdata", ":", "if", "self", ".", "_userdata", "[", "key", "]", "...
Test if the current instance matches a template instance.
[ "Test", "if", "the", "current", "instance", "matches", "a", "template", "instance", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L108-L120
train
nugget/python-insteonplm
insteonplm/messages/userdata.py
Userdata.create_empty
def create_empty(cls, val=0x00): """Create an empty Userdata object. val: value to fill the empty user data fields with (default is 0x00) """ userdata_dict = {} for i in range(1, 15): key = 'd{}'.format(i) userdata_dict.update({key: val}) return u...
python
def create_empty(cls, val=0x00): """Create an empty Userdata object. val: value to fill the empty user data fields with (default is 0x00) """ userdata_dict = {} for i in range(1, 15): key = 'd{}'.format(i) userdata_dict.update({key: val}) return u...
[ "def", "create_empty", "(", "cls", ",", "val", "=", "0x00", ")", ":", "userdata_dict", "=", "{", "}", "for", "i", "in", "range", "(", "1", ",", "15", ")", ":", "key", "=", "'d{}'", ".", "format", "(", "i", ")", "userdata_dict", ".", "update", "("...
Create an empty Userdata object. val: value to fill the empty user data fields with (default is 0x00)
[ "Create", "an", "empty", "Userdata", "object", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L150-L159
train
nugget/python-insteonplm
insteonplm/messages/userdata.py
Userdata.normalize
def normalize(cls, empty, userdata): """Return normalized user data as a dictionary. empty: an empty dictionary userdata: data in the form of Userdata, dict or None """ if isinstance(userdata, Userdata): return userdata.to_dict() if isinstance(userdata, dict)...
python
def normalize(cls, empty, userdata): """Return normalized user data as a dictionary. empty: an empty dictionary userdata: data in the form of Userdata, dict or None """ if isinstance(userdata, Userdata): return userdata.to_dict() if isinstance(userdata, dict)...
[ "def", "normalize", "(", "cls", ",", "empty", ",", "userdata", ")", ":", "if", "isinstance", "(", "userdata", ",", "Userdata", ")", ":", "return", "userdata", ".", "to_dict", "(", ")", "if", "isinstance", "(", "userdata", ",", "dict", ")", ":", "return...
Return normalized user data as a dictionary. empty: an empty dictionary userdata: data in the form of Userdata, dict or None
[ "Return", "normalized", "user", "data", "as", "a", "dictionary", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L162-L176
train
nugget/python-insteonplm
insteonplm/messages/message.py
Message.hex
def hex(self): """Hexideciaml representation of the message in bytes.""" props = self._message_properties() msg = bytearray([MESSAGE_START_CODE_0X02, self._code]) for prop in props: # pylint: disable=unused-variable for key, val in prop.items(): i...
python
def hex(self): """Hexideciaml representation of the message in bytes.""" props = self._message_properties() msg = bytearray([MESSAGE_START_CODE_0X02, self._code]) for prop in props: # pylint: disable=unused-variable for key, val in prop.items(): i...
[ "def", "hex", "(", "self", ")", ":", "props", "=", "self", ".", "_message_properties", "(", ")", "msg", "=", "bytearray", "(", "[", "MESSAGE_START_CODE_0X02", ",", "self", ".", "_code", "]", ")", "for", "prop", "in", "props", ":", "for", "key", ",", ...
Hexideciaml representation of the message in bytes.
[ "Hexideciaml", "representation", "of", "the", "message", "in", "bytes", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/message.py#L131-L157
train
nugget/python-insteonplm
insteonplm/messages/message.py
Message.matches_pattern
def matches_pattern(self, other): """Return if the current message matches a message template. Compare the current message to a template message to test matches to a pattern. """ properties = self._message_properties() ismatch = False if isinstance(other, Message...
python
def matches_pattern(self, other): """Return if the current message matches a message template. Compare the current message to a template message to test matches to a pattern. """ properties = self._message_properties() ismatch = False if isinstance(other, Message...
[ "def", "matches_pattern", "(", "self", ",", "other", ")", ":", "properties", "=", "self", ".", "_message_properties", "(", ")", "ismatch", "=", "False", "if", "isinstance", "(", "other", ",", "Message", ")", "and", "self", ".", "code", "==", "other", "."...
Return if the current message matches a message template. Compare the current message to a template message to test matches to a pattern.
[ "Return", "if", "the", "current", "message", "matches", "a", "message", "template", "." ]
65548041f1b0729ae1ae904443dd81b0c6cbf1bf
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/message.py#L164-L184
train