code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
msg = StandardSend(self._address,
COMMAND_GET_INSTEON_ENGINE_VERSION_0X0D_0X00)
self._send_msg(msg) | def get_engine_version(self) | Get the device engine version. | 13.480439 | 10.46007 | 1.288752 |
msg = StandardSend(self._address, COMMAND_PING_0X0F_0X00)
self._send_msg(msg) | def ping(self) | Ping a device. | 13.202 | 10.856326 | 1.216065 |
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,
self._plm.cat, self._plm.subcat,
... | def create_default_links(self) | Create the default links between the IM and the device. | 2.559231 | 2.36369 | 1.082727 |
if self._aldb.version == ALDBVersion.Null:
_LOGGER.info('Device %s does not contain an All-Link Database',
self._address.human)
else:
_LOGGER.info('Reading All-Link Database for device %s',
self._address.human)
... | def read_aldb(self, mem_addr=0x0000, num_recs=0) | Read the device All-Link Database. | 3.824139 | 3.459275 | 1.105474 |
if isinstance(mode, str) and mode.lower() in ['c', 'r']:
pass
else:
_LOGGER.error('Insteon link mode: %s', mode)
raise ValueError("Mode must be 'c' or 'r'")
if isinstance(group, int):
pass
else:
raise ValueError("Group ... | 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 of target
group: Link group
target: Address of the other device
Optional:
data1: Dev... | 3.504048 | 3.206185 | 1.092903 |
self._aldb.del_record(mem_addr)
self._aldb.add_loaded_callback(self._aldb_loaded_callback) | def del_aldb(self, mem_addr: int) | Delete an All-Link Database record. | 5.674197 | 4.363516 | 1.300373 |
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]:
if rec.control_flags.is_high_water_mark:
_LOGGER.debug('Removing HWM rec... | def _refresh_aldb_records(self, linkcode, address, group) | Refresh the IM and device ALDB records. | 2.666584 | 2.647539 | 1.007194 |
_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:
_LOGGER.debug('Look for direct ACK')
asyncio.ensure... | def receive_message(self, msg) | Receive a messages sent to this device. | 3.784528 | 3.749445 | 1.009357 |
_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.release()
callbacks = self._message_callbacks.get_callbacks_from_mess... | def receive_message(self, msg) | Receive a message sent to this device. | 4.013073 | 4.053251 | 0.990087 |
self._stateList[group] = stateType(plm, device, stateName, group,
defaultValue=defaultValue) | def add(self, plm, device, stateType, stateName, group, defaultValue=None) | Add a state to the StateList. | 5.433671 | 4.564144 | 1.190513 |
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')
addrmed = userdata.get('d9')
addrlo = userdata.get('d10')
addr = Ad... | def create_from_userdata(userdata) | Create ALDB Record from the userdata dictionary. | 2.80664 | 2.435863 | 1.152216 |
userdata = Userdata({'d3': self.memhi,
'd4': self.memlo,
'd6': self.control_flags,
'd7': self.group,
'd8': self.address.bytes[2],
'd9': self.address.bytes[1],... | def to_userdata(self) | Return a Userdata dictionary. | 3.219115 | 3.065706 | 1.05004 |
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) | Return a byte representation of ControlFlags. | 5.101906 | 4.557131 | 1.119543 |
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(control_flags & 1 << 1)
flags = ControlFlags(in_use, controller, used_before,
... | def create_from_byte(control_flags) | Create a ControlFlags class from a control flags byte. | 2.758487 | 2.554923 | 1.079675 |
if callback not in self._cb_aldb_loaded:
self._cb_aldb_loaded.append(callback) | def add_loaded_callback(self, callback) | Add a callback to be run when the ALDB load is complete. | 5.789292 | 3.335271 | 1.735779 |
if self._version == ALDBVersion.Null:
self._status = ALDBStatus.LOADED
_LOGGER.debug('Device has no ALDB')
else:
self._status = ALDBStatus.LOADING
_LOGGER.debug('Tring to lock from load')
await self._rec_mgr_lock
_LOGGER.de... | async def load(self, mem_addr=0x0000, rec_count=0, retry=0) | Read the device database and load. | 3.798973 | 3.746762 | 1.013935 |
if not (self._have_first_record() and self._have_last_record()):
_LOGGER.error('Must load the Insteon All-Link Database before '
'writing to it')
else:
self._prior_status = self._status
self._status = ALDBStatus.LOADING
m... | def write_record(self, mem_addr: int, mode: str, group: int, target,
data1=0x00, data2=0x00, data3=0x00) | Write an All-Link database record. | 4.010868 | 3.799684 | 1.055579 |
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_status = self._status
self._status = ALDBStatus.LOADING
m... | def del_record(self, mem_addr: int) | Write an All-Link database record. | 3.84782 | 3.610021 | 1.065872 |
found_rec = None
mode_test = None
if mode.lower() in ['c', 'r']:
link_group = int(group)
link_addr = Address(addr)
for mem_addr in self:
rec = self[mem_addr]
if mode.lower() == 'r':
mode_test = rec.c... | 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
addr: Inteon address of the linked device | 3.510952 | 3.494197 | 1.004795 |
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._load_action.rec_count
if rec_count == 1 or self._have_all_records():
... | def record_received(self, msg) | Handle ALDB record received from device. | 5.059715 | 4.486345 | 1.127803 |
if isinstance(status, ALDBStatus):
self._status = status
else:
self._status = ALDBStatus(status)
for mem_addr in records:
rec = records[mem_addr]
control_flags = int(rec.get('control_flags', 0))
group = int(rec.get('group', 0))... | def load_saved_records(self, status, records) | Load ALDB records from a set of saved records. | 2.520789 | 2.368514 | 1.064292 |
if self._have_all_records():
mem_addr = None
rec_count = 0
retries = 0
elif read_complete:
retries = 0
if rec_count:
mem_addr = self._next_address(mem_addr)
else:
mem_addr = self._next_addres... | 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 read was successful and all records were being read then
look for the first record.
if the last rea... | 2.021142 | 2.107488 | 0.959029 |
_LOGGER.debug("Registered callback for state: %s", self._stateName)
self._observer_callbacks.append(callback) | def register_updates(self, callback) | Register a callback to notify a listener of state changes. | 10.941486 | 9.41578 | 1.162037 |
self._value = val
for callback in self._observer_callbacks:
callback(self._address, self._group, val) | def _update_subscribers(self, val) | Save state value and notify listeners of the change. | 7.141393 | 5.467733 | 1.306098 |
userdata = Userdata.from_raw_message(rawmessage[11:25])
return ExtendedReceive(rawmessage[2:5],
rawmessage[5:8],
{'cmd1': rawmessage[9],
'cmd2': rawmessage[10]},
userdata... | def from_raw_message(cls, rawmessage) | Create message from raw byte stream. | 5.854508 | 5.617728 | 1.042149 |
msgraw = bytearray([0x02, cls._code])
msgraw.extend(bytes(cls._receivedSize))
msg = ExtendedReceive.from_raw_message(msgraw)
if commandtuple:
cmd1 = commandtuple.get('cmd1')
cmd2out = commandtuple.get('cmd2')
else:
cmd1 = None
... | def template(cls, address=None, target=None, commandtuple=None,
userdata=None, cmd2=-1, flags=None) | Create message template for callbacks. | 4.167768 | 4.19345 | 0.993876 |
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) | Return the low byte of the target address field.
Used in All-Link Cleanup messages. | 8.277045 | 6.022344 | 1.374389 |
if val == 0:
self.off()
else:
setlevel = 255
if val < 1:
setlevel = val * 100
elif val <= 0xff:
setlevel = val
set_command = StandardSend(
self._address, COMMAND_LIGHT_ON_0X11_NONE, cmd2=... | def set_level(self, val) | Set the devive ON LEVEL. | 6.565932 | 5.844889 | 1.123363 |
brighten_command = StandardSend(
self._address, COMMAND_LIGHT_BRIGHTEN_ONE_STEP_0X15_0X00)
self._send_method(brighten_command) | def brighten(self) | Brighten the device one step. | 12.302196 | 8.360257 | 1.471509 |
dim_command = StandardSend(
self._address, COMMAND_LIGHT_DIM_ONE_STEP_0X16_0X00)
self._send_method(dim_command) | def dim(self) | Dim the device one step. | 20.593138 | 12.634557 | 1.629906 |
speed = self._value_to_fan_speed(val)
if val == 0:
self.off()
else:
set_command = ExtendedSend(self._address,
COMMAND_LIGHT_ON_0X11_NONE,
self._udata, cmd2=speed)
set_comman... | def set_level(self, val) | Set the fan speed. | 8.860751 | 7.747282 | 1.143724 |
open_command = StandardSend(self._address,
COMMAND_LIGHT_ON_0X11_NONE, cmd2=0xff)
self._send_method(open_command, self._open_message_received) | def open(self) | Turn the device ON. | 17.859106 | 13.004981 | 1.373251 |
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) | Turn the device ON Fast. | 16.677996 | 12.403074 | 1.344666 |
close_command = StandardSend(self._address,
COMMAND_LIGHT_OFF_0X13_0X00)
self._send_method(close_command, self._closed_message_received) | def close(self) | Turn the device off. | 14.619233 | 10.856676 | 1.346566 |
close_command = StandardSend(self._address,
COMMAND_LIGHT_OFF_FAST_0X14_0X00)
self._send_method(close_command, self._closed_message_received) | def close_fast(self) | Turn the device off. | 13.323236 | 10.215391 | 1.304232 |
if val == 0:
self.close()
else:
setlevel = 255
if val < 1:
setlevel = val * 100
elif val <= 0xff:
setlevel = val
set_command = StandardSend(
self._address, COMMAND_LIGHT_ON_0X11_NONE, cmd... | def set_position(self, val) | Set the devive OPEN LEVEL. | 7.525833 | 6.658531 | 1.130254 |
if val == 0:
self.close_fast()
else:
setlevel = 255
if val < 1:
setlevel = val * 100
elif val <= 0xff:
setlevel = val
set_command = StandardSend(
self._address, COMMAND_LIGHT_ON_FAST_0X12... | def set_position_fast(self, val) | Set the devive OPEN LEVEL. | 7.789083 | 6.898866 | 1.129038 |
_LOGGER.debug('Setting up extended status')
ext_status = ExtendedSend(
address=self._address,
commandtuple=COMMAND_EXTENDED_GET_SET_0X2E_0X00,
cmd2=0x02,
userdata=Userdata())
ext_status.set_crc()
_LOGGER.debug('Sending ext status: ... | def async_refresh_state(self) | Request each state to provide status update. | 6.986194 | 6.491675 | 1.076177 |
hc = list(HC_LOOKUP.keys())[list(HC_LOOKUP.values()).index(bytecode)]
return hc.upper() | def byte_to_housecode(bytecode) | Return an X10 housecode value from a byte value. | 4.52645 | 4.671574 | 0.968935 |
return list(UC_LOOKUP.keys())[list(UC_LOOKUP.values()).index(bytecode)] | def byte_to_unitcode(bytecode) | Return an X10 unitcode value from a byte value. | 5.065969 | 5.04848 | 1.003464 |
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 command_type | def x10_command_type(command) | Return the X10 command type from an X10 command. | 2.890182 | 2.904173 | 0.995182 |
bitshift = bit - 1
if is_on:
return bitmask | (1 << bitshift)
return bitmask & (0xff & ~(1 << bitshift)) | 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. | 3.658349 | 3.954632 | 0.925079 |
if (rawmessage[5] &
MESSAGE_FLAG_EXTENDED_0X10) == MESSAGE_FLAG_EXTENDED_0X10:
if len(rawmessage) >= ExtendedSend.receivedSize:
msg = ExtendedSend.from_raw_message(rawmessage)
else:
msg = None
else:
msg = Standa... | def from_raw_message(cls, rawmessage) | Create a message from a raw byte stream. | 4.993402 | 4.797951 | 1.040736 |
userdata_dict = Userdata(rawmessage[8:22])
return ExtendedSend(rawmessage[2:5],
{'cmd1': rawmessage[6],
'cmd2': rawmessage[7]},
userdata_dict,
flags=rawmessage[5],
... | def from_raw_message(cls, rawmessage) | Create a message from a raw byte stream. | 8.195702 | 7.883156 | 1.039647 |
msgraw = bytearray([0x02, cls._code])
msgraw.extend(bytes(cls._receivedSize))
msg = ExtendedSend.from_raw_message(msgraw)
if commandtuple:
cmd1 = commandtuple.get('cmd1')
cmd2out = commandtuple.get('cmd2')
else:
cmd1 = None
... | def template(cls, address=None, commandtuple=None,
userdata=None, cmd2=-1, flags=None, acknak=None) | Create a message template used for callbacks. | 4.086232 | 4.050191 | 1.008899 |
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) | Set byte 14 of the userdata to a checksum value. | 4.851323 | 3.908073 | 1.241359 |
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) else fb
fb = fb ^ 0x01 if (crc & 0x4000) else fb
... | def set_crc(self) | Set Userdata[13] and Userdata[14] to the CRC value. | 2.392705 | 2.242515 | 1.066974 |
return StandardReceive(rawmessage[2:5],
rawmessage[5:8],
{'cmd1': rawmessage[9],
'cmd2': rawmessage[10]},
flags=rawmessage[8]) | def from_raw_message(cls, rawmessage) | Create message from a raw byte stream. | 6.772773 | 6.375962 | 1.062235 |
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) | Return the middle byte of the target message property.
Used in All-Link Cleanup message types. | 10.939186 | 8.009807 | 1.365724 |
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) | Return the high byte of the target message property.
Used in All-Link Cleanup message types. | 10.275775 | 7.988768 | 1.286278 |
return AllLinkComplete(rawmessage[2],
rawmessage[3],
rawmessage[4:7],
rawmessage[7],
rawmessage[8],
rawmessage[9]) | def from_raw_message(cls, rawmessage) | Create a message from a raw byte stream. | 5.378466 | 5.240842 | 1.02626 |
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
if msgclass is None:
_LOGGER.debug('Did not find message class 0x%02x', rawmess... | def create(rawmessage) | Return an INSTEON message class based on a raw byte stream. | 3.285813 | 3.16266 | 1.03894 |
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(rawmessage)
messageBuffer.extend(filler)
msg = _get_msg_class(rawmessage[1])
... | def iscomplete(rawmessage) | Test if the raw message is a complete message. | 3.668991 | 3.613365 | 1.015395 |
msg_classes = {}
msg_classes = _add_msg_class(msg_classes,
MESSAGE_STANDARD_MESSAGE_RECEIVED_0X50,
StandardReceive)
msg_classes = _add_msg_class(msg_classes,
MESSAGE_EXTENDED_MESSAGE_RECEIVED_0X51,
... | def _get_msg_class(code) | Get the message class based on the message code. | 1.712476 | 1.693086 | 1.011453 |
while rawmessage and rawmessage[0] != MESSAGE_START_CODE_0X02:
if debug:
_LOGGER.debug('Buffer content: %s', binascii.hexlify(rawmessage))
_LOGGER.debug('Trimming leading buffer garbage')
rawmessage = rawmessage[1:]
return rawmessage | def _trim_buffer_garbage(rawmessage, debug=True) | Remove leading bytes from a byte stream.
A proper message byte stream begins with 0x02. | 3.835571 | 3.707902 | 1.034431 |
if hasattr(other, 'messageType'):
messageTypeIsEqual = False
if self.messageType is None or other.messageType is None:
messageTypeIsEqual = True
else:
messageTypeIsEqual = (self.messageType == other.messageType)
extendedIsE... | def matches_pattern(self, other) | Test if current message match a patterns or template. | 2.177457 | 1.960681 | 1.110562 |
property_names = [p for p in dir(cls)
if isinstance(getattr(cls, p), property)]
return property_names | def get_properties(cls) | Get all properties of the MessageFlags class. | 3.690945 | 3.007576 | 1.227216 |
direct = (self._messageType == 0x00)
if self.isDirectACK or self.isDirectNAK:
direct = True
return direct | def isDirect(self) | Test if the message is a direct message type. | 7.48734 | 5.97849 | 1.25238 |
flags = MessageFlags(None)
if messageType < 8:
flags._messageType = messageType
else:
flags._messageType = messageType >> 5
if extended in [0, 1, True, False]:
if extended:
flags._extended = 1
else:
... | 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 = 3
MESSAGE_TYPE_BROADCAST_MESSAGE = 4
MESSAGE_TYPE... | 2.72558 | 2.661183 | 1.024199 |
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 self._hopsMax is None else self._hopsMax
hopsLeft = 0 if self._hop... | def bytes(self) | Return a byte representation of the message flags. | 3.311404 | 2.843408 | 1.16459 |
norm = None
if isinstance(flags, MessageFlags):
norm = flags.bytes
elif isinstance(flags, bytearray):
norm = binascii.hexlify(flags)
elif isinstance(flags, int):
norm = bytes([flags])
elif isinstance(flags, bytes):
norm = b... | def _normalize(self, flags) | Take any format of flags and turn it into a hex string. | 2.71769 | 2.549429 | 1.066 |
flagByte = self._normalize(flags)
if flagByte is not None:
self._messageType = (flagByte[0] & 0xe0) >> 5
self._extended = (flagByte[0] & MESSAGE_FLAG_EXTENDED_0X10) >> 4
self._hopsLeft = (flagByte[0] & 0x0c) >> 2
self._hopsMax = flagByte[0] & 0x0... | def _set_properties(self, flags) | Set the properties of the message flags based on a byte input. | 3.0891 | 2.733515 | 1.130083 |
value = 0
if dry_wet == self._dry_wet_type:
value = 1
self._update_subscribers(value) | def set_value(self, dry_wet: LeakSensorState) | Set the value of the state to dry or wet. | 7.433546 | 5.885873 | 1.262947 |
for callback in self._dry_wet_callbacks:
callback(self._dry_wet_type)
self._update_subscribers(0x01) | def _dry_wet_message_received(self, msg) | Report a dry or a wet state. | 7.880949 | 7.142555 | 1.103379 |
if dry_wet == LeakSensorState.DRY:
self._update_subscribers(0x11)
else:
self._update_subscribers(0x13) | def set_value(self, dry_wet: LeakSensorState) | Set the state to wet or dry. | 4.703433 | 3.781008 | 1.243963 |
for callback in self._dry_wet_callbacks:
callback(LeakSensorState.DRY)
self._update_subscribers(0x11) | def _dry_message_received(self, msg) | Report a dry state. | 20.514463 | 16.22077 | 1.264703 |
for callback in self._dry_wet_callbacks:
callback(LeakSensorState.WET)
self._update_subscribers(0x13) | def _wet_message_received(self, msg) | Report a wet state. | 18.607147 | 15.117874 | 1.230804 |
if override:
if isinstance(callback, list):
self._dict[msg] = callback
else:
self._dict[msg] = [callback]
else:
cb = self[msg]
cb.append(callback)
self._dict[msg] = cb | 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
Default is False | 2.692644 | 2.814651 | 0.956653 |
if callback is None:
self._dict.pop(msg, None)
else:
cb = self._dict.get(msg, [])
try:
cb.remove(callback)
except ValueError:
pass
if cb:
_LOGGER.debug('%d callbacks for message: %s', len... | 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. | 2.659636 | 2.655524 | 1.001549 |
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) | Return the callbacks associated with a message template. | 4.4733 | 3.941917 | 1.134803 |
x10_product = None
for product in self._x10_products:
if feature.lower() == product.feature:
x10_product = product
if not x10_product:
x10_product = X10Product(feature, None)
return x10_product | def x10(self, feature) | Return an X10 device based on a feature.
Current features:
- OnOff
- Dimmable | 3.148815 | 2.9472 | 1.068409 |
return AllLinkRecordResponse(rawmessage[2],
rawmessage[3],
rawmessage[4:7],
rawmessage[7],
rawmessage[8],
rawmessage[9... | def from_raw_message(cls, rawmessage) | Create message from raw byte stream. | 5.661862 | 5.452024 | 1.038488 |
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--device', default='/dev/ttyUSB0',
help='Path to PLM device')
parser.add_argument('--verbose', '-v', action='count',
help='Set logging level to verbose')
parser.add_argument('-... | 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
:param: linkcode
... | 2.788687 | 2.72944 | 1.021706 |
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--device', default='/dev/ttyUSB0',
help='Path to PLM device')
parser.add_argument('-v', '--verbose', action='count',
help='Set logging level to verbose')
parser.add_argument('-... | def interactive() | Create an interactive command line tool.
Wrapper for an interactive session for manual commands to be entered. | 2.741445 | 2.726846 | 1.005354 |
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 self.device
self.workdir = workdir if workdir else self.workdir
conn = await insteo... | async def connect(self, poll_devices=False, device=None, workdir=None) | Connect to the IM. | 3.061955 | 2.935994 | 1.042902 |
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) | Place the IM in monitoring mode. | 7.712468 | 6.823397 | 1.130297 |
_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 device.states:
device.states[state].register_updates(
self.async_s... | def async_new_device_callback(self, device) | Log that our new device callback worked. | 4.19236 | 3.915837 | 1.070617 |
_LOGGING.info('Device %s state %s value is changed to %s',
addr, state, value) | def async_state_change_callback(self, addr, state, value) | Log the state change. | 9.63735 | 8.195883 | 1.175877 |
if self.aldb_load_lock.locked():
self.aldb_load_lock.release()
_LOGGING.info('ALDB Loaded') | def async_aldb_loaded_callback(self) | Unlock the ALDB load lock when loading is complete. | 5.715443 | 4.21209 | 1.356914 |
_LOGGING.info('Starting the All-Linking process')
if address:
linkdevice = self.plm.devices[Address(address).id]
if not linkdevice:
linkdevice = create(self.plm, address, None, None)
_LOGGING.info('Attempting to link the PLM to device %s. ',
... | async def start_all_linking(self, linkcode, group, address=None) | Start the All-Linking process with the IM and device. | 3.911265 | 3.703018 | 1.056237 |
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,
device.description)
else:
... | def list_devices(self) | List devices in the ALDB. | 3.494627 | 3.412308 | 1.024124 |
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.aldb.status in [ALDBStatus.LOADED, ALDBStatus.PARTIAL]:
if device.aldb... | def print_device_aldb(self, addr) | Diplay the All-Link database for a device. | 2.949266 | 2.897571 | 1.017841 |
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 for device %s', addr)
self.print_device_aldb(addr)
els... | def print_all_aldb(self) | Diplay the All-Link database for all devices. | 4.292649 | 3.971368 | 1.080899 |
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:
device.aldb.clear()
device.read_aldb()
... | async def load_device_aldb(self, addr, clear=True) | Read the device ALDB. | 2.743949 | 2.702154 | 1.015467 |
for addr in self.plm.devices:
await self.load_device_aldb(addr, clear) | async def load_all_aldb(self, clear=True) | Read all devices ALDB. | 8.415903 | 5.531068 | 1.521569 |
dev_addr = Address(addr)
target_addr = Address(target)
device = self.plm.devices[dev_addr.id]
if device:
_LOGGING.debug('calling device write_aldb')
device.write_aldb(mem_addr, mode, group, target_addr,
data1, data2, data3)
... | 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. | 3.574091 | 3.271477 | 1.092501 |
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, loop=self.loop)
while device.aldb.status == ALDBStatus.LOADING:
... | async def del_aldb(self, addr, mem_addr: int) | Write a device All-Link record. | 4.368311 | 3.821707 | 1.143026 |
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) | Add a device override to the PLM. | 2.171793 | 2.031614 | 1.068999 |
device = None
try:
device = self.plm.devices.add_x10_device(self.plm, housecode,
unitcode, dev_type)
except ValueError:
pass
return device | def add_x10_device(self, housecode, unitcode, dev_type) | Add an X10 device to the PLM. | 3.622473 | 2.94343 | 1.230698 |
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].async_refresh_state() | def kpl_status(self, address, group) | Get the status of a KPL button. | 9.999147 | 10.040703 | 0.995861 |
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].on() | def kpl_on(self, address, group) | Get the status of a KPL button. | 8.918708 | 9.537238 | 0.935146 |
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].off() | def kpl_off(self, address, group) | Get the status of a KPL button. | 8.848414 | 9.328602 | 0.948525 |
addr = Address(address)
device = self.plm.devices[addr.id]
device.states[group].set_on_mask(mask) | def kpl_set_on_mask(self, address, group, mask) | Get the status of a KPL button. | 6.705499 | 6.367136 | 1.053142 |
self.loop.create_task(self._read_line())
self.loop.create_task(self._greeting()) | def start(self) | Start the command process loop. | 5.587726 | 4.909029 | 1.138255 |
params = args.split()
device = '/dev/ttyUSB0'
workdir = None
try:
device = params[0]
except IndexError:
if self.tools.device:
device = self.tools.device
try:
workdir = params[1]
except IndexError:
... | 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 | 3.592759 | 3.475924 | 1.033613 |
for task in asyncio.Task.all_tasks(loop=self.loop):
_LOGGING.info(task) | def do_running_tasks(self, arg) | List tasks running in the background.
Usage:
running_tasks
Arguments: | 6.194546 | 10.503519 | 0.589759 |
linkcode = 1
group = 0
addr = None
params = args.split()
if params:
try:
linkcode = int(params[0])
except IndexError:
linkcode = 1
except ValueError:
linkcode = None
try:
... | 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 responder
Default 1
... | 3.04456 | 2.661112 | 1.144093 |
params = args.split()
addr = None
try:
addr = params[0]
except IndexError:
_LOGGING.error('Device address required.')
self.do_help('print_aldb')
if addr:
if addr.lower() == 'all':
self.tools.print_all_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 devices
This method requires that ... | 3.616931 | 3.210208 | 1.126697 |
params = args.split()
username = None
password = None
host = None
port = None
try:
username = params[0]
password = params[1]
host = params[2]
port = params[3]
except IndexError:
pass
if... | 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 [default 25105] | 2.752784 | 2.398839 | 1.147548 |
params = args.split()
try:
filename = params[0]
logging.basicConfig(filename=filename)
except IndexError:
self.do_help('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. | 3.109485 | 3.320908 | 0.936336 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.