sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def manage_aldb_record(self, control_code, control_flags, group, address,
data1, data2, data3):
"""Update an IM All-Link record.
Control Code values:
- 0x00 Find First Starting at the top of the ALDB, search for the
first ALL-Link Record matching the <ALL-Link... | Update an IM All-Link record.
Control Code values:
- 0x00 Find First Starting at the top of the ALDB, search for the
first ALL-Link Record matching the <ALL-Link Group> and <ID> in bytes
5 – 8. The search ignores byte 4, <ALL-Link Record Flags>. You will
receive an ACK at the en... | entailment |
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... | 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... | entailment |
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) | Delete an All-Link Database record. | entailment |
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]:
... | Refresh the IM and device ALDB records. | entailment |
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:
... | Receive a messages sent to this device. | entailment |
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... | Receive a message sent to this device. | entailment |
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) | Add a state to the StateList. | entailment |
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')
... | Create ALDB Record from the userdata dictionary. | entailment |
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],... | Return a Userdata dictionary. | entailment |
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 | Return a byte representation of ControlFlags. | entailment |
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... | Create a ControlFlags class from a control flags byte. | entailment |
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) | Add a callback to be run when the ALDB load is complete. | entailment |
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
... | Read the device database and load. | entailment |
def write_record(self, mem_addr: int, mode: str, group: int, target,
data1=0x00, data2=0x00, data3=0x00):
"""Write an All-Link database record."""
if not (self._have_first_record() and self._have_last_record()):
_LOGGER.error('Must load the Insteon All-Link Database befo... | Write an All-Link database record. | entailment |
def del_record(self, mem_addr: int):
"""Write an All-Link database record."""
record = self._records.get(mem_addr)
if not record:
_LOGGER.error('Must load the Insteon All-Link Database record '
'before deleting it')
else:
self._prior_stat... | Write an All-Link database record. | entailment |
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... | 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 | entailment |
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._... | Handle ALDB record received from device. | entailment |
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]
... | Load ALDB records from a set of saved records. | entailment |
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... | 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... | entailment |
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) | Register a callback to notify a listener of state changes. | entailment |
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) | Save state value and notify listeners of the change. | entailment |
def from_raw_message(cls, rawmessage):
"""Create message from raw byte stream."""
userdata = Userdata.from_raw_message(rawmessage[11:25])
return ExtendedReceive(rawmessage[2:5],
rawmessage[5:8],
{'cmd1': rawmessage[9],
... | Create message from raw byte stream. | entailment |
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)
... | Create message template for callbacks. | entailment |
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 | Return the low byte of the target address field.
Used in All-Link Cleanup messages. | entailment |
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(
... | Set the devive ON LEVEL. | entailment |
def brighten(self):
"""Brighten the device one step."""
brighten_command = StandardSend(
self._address, COMMAND_LIGHT_BRIGHTEN_ONE_STEP_0X15_0X00)
self._send_method(brighten_command) | Brighten the device one step. | entailment |
def dim(self):
"""Dim the device one step."""
dim_command = StandardSend(
self._address, COMMAND_LIGHT_DIM_ONE_STEP_0X16_0X00)
self._send_method(dim_command) | Dim the device one step. | entailment |
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,
... | Set the fan speed. | entailment |
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) | Turn the device ON. | entailment |
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) | Turn the device ON Fast. | entailment |
def close(self):
"""Turn the device off."""
close_command = StandardSend(self._address,
COMMAND_LIGHT_OFF_0X13_0X00)
self._send_method(close_command, self._closed_message_received) | Turn the device off. | entailment |
def close_fast(self):
"""Turn the device off."""
close_command = StandardSend(self._address,
COMMAND_LIGHT_OFF_FAST_0X14_0X00)
self._send_method(close_command, self._closed_message_received) | Turn the device off. | entailment |
def set_position(self, val):
"""Set the devive OPEN LEVEL."""
if val == 0:
self.close()
else:
setlevel = 255
if val < 1:
setlevel = val * 100
elif val <= 0xff:
setlevel = val
set_command = StandardSend(
... | Set the devive OPEN LEVEL. | entailment |
def set_position_fast(self, val):
"""Set the devive OPEN LEVEL."""
if val == 0:
self.close_fast()
else:
setlevel = 255
if val < 1:
setlevel = val * 100
elif val <= 0xff:
setlevel = val
set_command = Stand... | Set the devive OPEN LEVEL. | entailment |
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... | Request each state to provide status update. | entailment |
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() | Return an X10 housecode value from a byte value. | entailment |
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)] | Return an X10 unitcode value from a byte value. | entailment |
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
... | Return the X10 command type from an X10 command. | entailment |
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)) | Set the value of a bit in a bitmask on or off.
Uses the low bit is 1 and the high bit is 8. | entailment |
def from_raw_message(cls, rawmessage):
"""Create a message from a raw byte stream."""
if (rawmessage[5] &
MESSAGE_FLAG_EXTENDED_0X10) == MESSAGE_FLAG_EXTENDED_0X10:
if len(rawmessage) >= ExtendedSend.receivedSize:
msg = ExtendedSend.from_raw_message(rawmessage... | Create a message from a raw byte stream. | entailment |
def from_raw_message(cls, rawmessage):
"""Create a message from a raw byte stream."""
userdata_dict = Userdata(rawmessage[8:22])
return ExtendedSend(rawmessage[2:5],
{'cmd1': rawmessage[6],
'cmd2': rawmessage[7]},
... | Create a message from a raw byte stream. | entailment |
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... | Create a message template used for callbacks. | entailment |
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 | Set byte 14 of the userdata to a checksum value. | entailment |
def set_crc(self):
"""Set Userdata[13] and Userdata[14] to the CRC value."""
data = self.bytes[6:20]
crc = int(0)
for b in data:
# pylint: disable=unused-variable
for bit in range(0, 8):
fb = b & 0x01
fb = fb ^ 0x01 if (crc & 0x8000... | Set Userdata[13] and Userdata[14] to the CRC value. | entailment |
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]},
... | Create message from a raw byte stream. | entailment |
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 | Return the middle byte of the target message property.
Used in All-Link Cleanup message types. | entailment |
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 | Return the high byte of the target message property.
Used in All-Link Cleanup message types. | entailment |
def from_raw_message(cls, rawmessage):
"""Create a message from a raw byte stream."""
return AllLinkComplete(rawmessage[2],
rawmessage[3],
rawmessage[4:7],
rawmessage[7],
rawmessag... | Create a message from a raw byte stream. | entailment |
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
... | Return an INSTEON message class based on a raw byte stream. | entailment |
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... | Test if the raw message is a complete message. | entailment |
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,... | Get the message class based on the message code. | entailment |
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))... | Remove leading bytes from a byte stream.
A proper message byte stream begins with 0x02. | entailment |
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:
... | Test if current message match a patterns or template. | entailment |
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 | Get all properties of the MessageFlags class. | entailment |
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 | Test if the message is a direct message type. | entailment |
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 =... | 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... | entailment |
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... | Return a byte representation of the message flags. | entailment |
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):
... | Take any format of flags and turn it into a hex string. | entailment |
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) >> ... | Set the properties of the message flags based on a byte input. | entailment |
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) | Set the value of the state to dry or wet. | entailment |
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) | Report a dry or a wet state. | entailment |
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) | Set the state to wet or dry. | entailment |
def _dry_message_received(self, msg):
"""Report a dry state."""
for callback in self._dry_wet_callbacks:
callback(LeakSensorState.DRY)
self._update_subscribers(0x11) | Report a dry state. | entailment |
def _wet_message_received(self, msg):
"""Report a wet state."""
for callback in self._dry_wet_callbacks:
callback(LeakSensorState.WET)
self._update_subscribers(0x13) | Report a wet state. | entailment |
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
... | 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 | entailment |
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(... | 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. | entailment |
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 | Return the callbacks associated with a message template. | entailment |
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... | Return an X10 device based on a feature.
Current features:
- OnOff
- Dimmable | entailment |
def from_raw_message(cls, rawmessage):
"""Create message from raw byte stream."""
return AllLinkRecordResponse(rawmessage[2],
rawmessage[3],
rawmessage[4:7],
rawmessage[7],
... | Create message from raw byte stream. | entailment |
def monitor():
"""Connect to receiver and show events as they occur.
Pulls the following arguments from the command line:
:param device:
Unix device where the PLM is attached
:param address:
Insteon address of the device to link with
:param group:
Insteon group for the link... | Connect to receiver and show events as they occur.
Pulls the following arguments from the command line:
:param device:
Unix device where the PLM is attached
:param address:
Insteon address of the device to link with
:param group:
Insteon group for the link
:param: linkcode
... | entailment |
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')
... | Create an interactive command line tool.
Wrapper for an interactive session for manual commands to be entered. | entailment |
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... | Connect to the IM. | entailment |
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() | Place the IM in monitoring mode. | entailment |
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... | Log that our new device callback worked. | entailment |
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) | Log the state change. | entailment |
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') | Unlock the ALDB load lock when loading is complete. | entailment |
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:
... | Start the All-Linking process with the IM and device. | entailment |
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,
... | List devices in the ALDB. | entailment |
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... | Diplay the All-Link database for a device. | entailment |
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... | Diplay the All-Link database for all devices. | entailment |
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:
... | Read the device ALDB. | entailment |
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) | Read all devices ALDB. | entailment |
async def write_aldb(self, addr, mem_addr: int, mode: str, group: int,
target, data1=0x00, data2=0x00, data3=0x00):
"""Write a device All-Link record."""
dev_addr = Address(addr)
target_addr = Address(target)
device = self.plm.devices[dev_addr.id]
if devi... | Write a device All-Link record. | entailment |
async def del_aldb(self, addr, mem_addr: int):
"""Write a device All-Link record."""
dev_addr = Address(addr)
device = self.plm.devices[dev_addr.id]
if device:
_LOGGING.debug('calling device del_aldb')
device.del_aldb(mem_addr)
await asyncio.sleep(1, l... | Write a device All-Link record. | entailment |
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... | Add a device override to the PLM. | entailment |
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:
... | Add an X10 device to the PLM. | entailment |
def kpl_status(self, address, group):
"""Get the status of a KPL button."""
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].async_refresh_state() | Get the status of a KPL button. | entailment |
def kpl_on(self, address, group):
"""Get the status of a KPL button."""
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].on() | Get the status of a KPL button. | entailment |
def kpl_off(self, address, group):
"""Get the status of a KPL button."""
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].off() | Get the status of a KPL button. | entailment |
def kpl_set_on_mask(self, address, group, mask):
"""Get the status of a KPL button."""
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].set_on_mask(mask) | Get the status of a KPL button. | entailment |
def start(self):
"""Start the command process loop."""
self.loop.create_task(self._read_line())
self.loop.create_task(self._greeting()) | Start the command process loop. | entailment |
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()
... | 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 | entailment |
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) | List tasks running in the background.
Usage:
running_tasks
Arguments: | entailment |
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... | 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
... | entailment |
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... | 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 ... | entailment |
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... | 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] | entailment |
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()
... | 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. | entailment |
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
... | 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... | entailment |
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... | 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
... | entailment |
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... | 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
... | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.