repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedReceive.py#L58-L81 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedReceive.py#L114-L122 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/dimmable.py#L193-L205 |
nugget/python-insteonplm | insteonplm/states/dimmable.py | DimmableSwitch.brighten | 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) | python | 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) | [
"def",
"brighten",
"(",
"self",
")",
":",
"brighten_command",
"=",
"StandardSend",
"(",
"self",
".",
"_address",
",",
"COMMAND_LIGHT_BRIGHTEN_ONE_STEP_0X15_0X00",
")",
"self",
".",
"_send_method",
"(",
"brighten_command",
")"
] | Brighten the device one step. | [
"Brighten",
"the",
"device",
"one",
"step",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/dimmable.py#L207-L211 |
nugget/python-insteonplm | insteonplm/states/dimmable.py | DimmableSwitch.dim | 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) | python | 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) | [
"def",
"dim",
"(",
"self",
")",
":",
"dim_command",
"=",
"StandardSend",
"(",
"self",
".",
"_address",
",",
"COMMAND_LIGHT_DIM_ONE_STEP_0X16_0X00",
")",
"self",
".",
"_send_method",
"(",
"dim_command",
")"
] | Dim the device one step. | [
"Dim",
"the",
"device",
"one",
"step",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/dimmable.py#L213-L217 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/dimmable.py#L269-L279 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L108-L112 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L114-L118 |
nugget/python-insteonplm | insteonplm/states/cover.py | Cover.close | 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) | python | 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) | [
"def",
"close",
"(",
"self",
")",
":",
"close_command",
"=",
"StandardSend",
"(",
"self",
".",
"_address",
",",
"COMMAND_LIGHT_OFF_0X13_0X00",
")",
"self",
".",
"_send_method",
"(",
"close_command",
",",
"self",
".",
"_closed_message_received",
")"
] | Turn the device off. | [
"Turn",
"the",
"device",
"off",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L120-L124 |
nugget/python-insteonplm | insteonplm/states/cover.py | Cover.close_fast | 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) | python | 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) | [
"def",
"close_fast",
"(",
"self",
")",
":",
"close_command",
"=",
"StandardSend",
"(",
"self",
".",
"_address",
",",
"COMMAND_LIGHT_OFF_FAST_0X14_0X00",
")",
"self",
".",
"_send_method",
"(",
"close_command",
",",
"self",
".",
"_closed_message_received",
")"
] | Turn the device off. | [
"Turn",
"the",
"device",
"off",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L126-L130 |
nugget/python-insteonplm | insteonplm/states/cover.py | Cover.set_position | 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(
... | python | 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(
... | [
"def",
"set_position",
"(",
"self",
",",
"val",
")",
":",
"if",
"val",
"==",
"0",
":",
"self",
".",
"close",
"(",
")",
"else",
":",
"setlevel",
"=",
"255",
"if",
"val",
"<",
"1",
":",
"setlevel",
"=",
"val",
"*",
"100",
"elif",
"val",
"<=",
"0x... | Set the devive OPEN LEVEL. | [
"Set",
"the",
"devive",
"OPEN",
"LEVEL",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L132-L144 |
nugget/python-insteonplm | insteonplm/states/cover.py | Cover.set_position_fast | 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... | python | 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... | [
"def",
"set_position_fast",
"(",
"self",
",",
"val",
")",
":",
"if",
"val",
"==",
"0",
":",
"self",
".",
"close_fast",
"(",
")",
"else",
":",
"setlevel",
"=",
"255",
"if",
"val",
"<",
"1",
":",
"setlevel",
"=",
"val",
"*",
"100",
"elif",
"val",
"... | Set the devive OPEN LEVEL. | [
"Set",
"the",
"devive",
"OPEN",
"LEVEL",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/cover.py#L146-L158 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/climateControl.py#L86-L98 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L22-L25 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L28-L30 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L33-L40 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/utils.py#L58-L66 |
nugget/python-insteonplm | insteonplm/messages/standardSend.py | StandardSend.from_raw_message | 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... | python | 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... | [
"def",
"from_raw_message",
"(",
"cls",
",",
"rawmessage",
")",
":",
"if",
"(",
"rawmessage",
"[",
"5",
"]",
"&",
"MESSAGE_FLAG_EXTENDED_0X10",
")",
"==",
"MESSAGE_FLAG_EXTENDED_0X10",
":",
"if",
"len",
"(",
"rawmessage",
")",
">=",
"ExtendedSend",
".",
"receiv... | Create a message from a raw byte stream. | [
"Create",
"a",
"message",
"from",
"a",
"raw",
"byte",
"stream",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardSend.py#L47-L61 |
nugget/python-insteonplm | insteonplm/messages/extendedSend.py | ExtendedSend.from_raw_message | 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]},
... | python | 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]},
... | [
"def",
"from_raw_message",
"(",
"cls",
",",
"rawmessage",
")",
":",
"userdata_dict",
"=",
"Userdata",
"(",
"rawmessage",
"[",
"8",
":",
"22",
"]",
")",
"return",
"ExtendedSend",
"(",
"rawmessage",
"[",
"2",
":",
"5",
"]",
",",
"{",
"'cmd1'",
":",
"rawm... | Create a message from a raw byte stream. | [
"Create",
"a",
"message",
"from",
"a",
"raw",
"byte",
"stream",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedSend.py#L57-L65 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedSend.py#L69-L93 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedSend.py#L143-L149 |
nugget/python-insteonplm | insteonplm/messages/extendedSend.py | ExtendedSend.set_crc | 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... | python | 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... | [
"def",
"set_crc",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"bytes",
"[",
"6",
":",
"20",
"]",
"crc",
"=",
"int",
"(",
"0",
")",
"for",
"b",
"in",
"data",
":",
"# pylint: disable=unused-variable",
"for",
"bit",
"in",
"range",
"(",
"0",
",",
... | Set Userdata[13] and Userdata[14] to the CRC value. | [
"Set",
"Userdata",
"[",
"13",
"]",
"and",
"Userdata",
"[",
"14",
"]",
"to",
"the",
"CRC",
"value",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/extendedSend.py#L151-L166 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardReceive.py#L43-L49 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardReceive.py#L114-L122 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/standardReceive.py#L125-L133 |
nugget/python-insteonplm | insteonplm/messages/allLinkComplete.py | AllLinkComplete.from_raw_message | 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... | python | 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... | [
"def",
"from_raw_message",
"(",
"cls",
",",
"rawmessage",
")",
":",
"return",
"AllLinkComplete",
"(",
"rawmessage",
"[",
"2",
"]",
",",
"rawmessage",
"[",
"3",
"]",
",",
"rawmessage",
"[",
"4",
":",
"7",
"]",
",",
"rawmessage",
"[",
"7",
"]",
",",
"r... | Create a message from a raw byte stream. | [
"Create",
"a",
"message",
"from",
"a",
"raw",
"byte",
"stream",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/allLinkComplete.py#L30-L37 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L56-L86 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L89-L115 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L118-L185 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/__init__.py#L193-L203 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L52-L66 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L69-L73 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L82-L87 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L167-L197 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L238-L248 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L256-L275 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/messageFlags.py#L277-L290 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L316-L321 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L324-L328 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L408-L413 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L416-L420 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/sensor.py#L423-L427 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messagecallback.py#L64-L81 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messagecallback.py#L83-L105 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messagecallback.py#L107-L113 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/ipdb.py#L386-L401 |
nugget/python-insteonplm | insteonplm/messages/allLinkRecordResponse.py | AllLinkRecordResponse.from_raw_message | def from_raw_message(cls, rawmessage):
"""Create message from raw byte stream."""
return AllLinkRecordResponse(rawmessage[2],
rawmessage[3],
rawmessage[4:7],
rawmessage[7],
... | python | def from_raw_message(cls, rawmessage):
"""Create message from raw byte stream."""
return AllLinkRecordResponse(rawmessage[2],
rawmessage[3],
rawmessage[4:7],
rawmessage[7],
... | [
"def",
"from_raw_message",
"(",
"cls",
",",
"rawmessage",
")",
":",
"return",
"AllLinkRecordResponse",
"(",
"rawmessage",
"[",
"2",
"]",
",",
"rawmessage",
"[",
"3",
"]",
",",
"rawmessage",
"[",
"4",
":",
"7",
"]",
",",
"rawmessage",
"[",
"7",
"]",
","... | Create message from raw byte stream. | [
"Create",
"message",
"from",
"raw",
"byte",
"stream",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/allLinkRecordResponse.py#L32-L39 |
nugget/python-insteonplm | insteonplm/tools.py | monitor | 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... | python | 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... | [
"def",
"monitor",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
")",
"parser",
".",
"add_argument",
"(",
"'--device'",
",",
"default",
"=",
"'/dev/ttyUSB0'",
",",
"help",
"=",
"'Path to PLM device'",
")",
... | 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
... | [
"Connect",
"to",
"receiver",
"and",
"show",
"events",
"as",
"they",
"occur",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1150-L1200 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1203-L1240 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L79-L102 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L104-L109 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L111-L119 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L122-L125 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L127-L131 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L133-L153 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L155-L173 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L221-L241 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L243-L256 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L258-L277 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L279-L282 |
nugget/python-insteonplm | insteonplm/tools.py | Tools.write_aldb | 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... | python | 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... | [
"async",
"def",
"write_aldb",
"(",
"self",
",",
"addr",
",",
"mem_addr",
":",
"int",
",",
"mode",
":",
"str",
",",
"group",
":",
"int",
",",
"target",
",",
"data1",
"=",
"0x00",
",",
"data2",
"=",
"0x00",
",",
"data3",
"=",
"0x00",
")",
":",
"dev... | Write a device All-Link record. | [
"Write",
"a",
"device",
"All",
"-",
"Link",
"record",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L284-L297 |
nugget/python-insteonplm | insteonplm/tools.py | Tools.del_aldb | 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... | python | 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... | [
"async",
"def",
"del_aldb",
"(",
"self",
",",
"addr",
",",
"mem_addr",
":",
"int",
")",
":",
"dev_addr",
"=",
"Address",
"(",
"addr",
")",
"device",
"=",
"self",
".",
"plm",
".",
"devices",
"[",
"dev_addr",
".",
"id",
"]",
"if",
"device",
":",
"_LO... | Write a device All-Link record. | [
"Write",
"a",
"device",
"All",
"-",
"Link",
"record",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L299-L309 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L311-L316 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L318-L326 |
nugget/python-insteonplm | insteonplm/tools.py | Tools.kpl_status | 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() | python | 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() | [
"def",
"kpl_status",
"(",
"self",
",",
"address",
",",
"group",
")",
":",
"addr",
"=",
"Address",
"(",
"address",
")",
"device",
"=",
"self",
".",
"plm",
".",
"devices",
"[",
"addr",
".",
"id",
"]",
"device",
".",
"states",
"[",
"group",
"]",
".",
... | Get the status of a KPL button. | [
"Get",
"the",
"status",
"of",
"a",
"KPL",
"button",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L328-L332 |
nugget/python-insteonplm | insteonplm/tools.py | Tools.kpl_on | 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() | python | 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() | [
"def",
"kpl_on",
"(",
"self",
",",
"address",
",",
"group",
")",
":",
"addr",
"=",
"Address",
"(",
"address",
")",
"device",
"=",
"self",
".",
"plm",
".",
"devices",
"[",
"addr",
".",
"id",
"]",
"device",
".",
"states",
"[",
"group",
"]",
".",
"o... | Get the status of a KPL button. | [
"Get",
"the",
"status",
"of",
"a",
"KPL",
"button",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L334-L338 |
nugget/python-insteonplm | insteonplm/tools.py | Tools.kpl_off | 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() | python | 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() | [
"def",
"kpl_off",
"(",
"self",
",",
"address",
",",
"group",
")",
":",
"addr",
"=",
"Address",
"(",
"address",
")",
"device",
"=",
"self",
".",
"plm",
".",
"devices",
"[",
"addr",
".",
"id",
"]",
"device",
".",
"states",
"[",
"group",
"]",
".",
"... | Get the status of a KPL button. | [
"Get",
"the",
"status",
"of",
"a",
"KPL",
"button",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L340-L344 |
nugget/python-insteonplm | insteonplm/tools.py | Tools.kpl_set_on_mask | 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) | python | 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) | [
"def",
"kpl_set_on_mask",
"(",
"self",
",",
"address",
",",
"group",
",",
"mask",
")",
":",
"addr",
"=",
"Address",
"(",
"address",
")",
"device",
"=",
"self",
".",
"plm",
".",
"devices",
"[",
"addr",
".",
"id",
"]",
"device",
".",
"states",
"[",
"... | Get the status of a KPL button. | [
"Get",
"the",
"status",
"of",
"a",
"KPL",
"button",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L346-L350 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L364-L367 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L422-L448 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L451-L459 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L503-L546 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L581-L611 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L613-L648 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L650-L666 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L668-L712 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L714-L790 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L792-L832 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L834-L853 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L855-L875 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L877-L903 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L905-L927 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L945-L992 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L994-L1039 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1041-L1062 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1064-L1085 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1087-L1108 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L1110-L1138 |
nugget/python-insteonplm | insteonplm/messages/userdata.py | Userdata.human | def human(self):
"""Emit the address in human-readible format (AA.BB.CC)."""
strout = ''
first = True
for i in range(0, 28, 2):
if first:
first = False
else:
strout = strout + '.'
strout = strout + self.hex[i:i + 2]
... | python | def human(self):
"""Emit the address in human-readible format (AA.BB.CC)."""
strout = ''
first = True
for i in range(0, 28, 2):
if first:
first = False
else:
strout = strout + '.'
strout = strout + self.hex[i:i + 2]
... | [
"def",
"human",
"(",
"self",
")",
":",
"strout",
"=",
"''",
"first",
"=",
"True",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"28",
",",
"2",
")",
":",
"if",
"first",
":",
"first",
"=",
"False",
"else",
":",
"strout",
"=",
"strout",
"+",
"'.'",
... | Emit the address in human-readible format (AA.BB.CC). | [
"Emit",
"the",
"address",
"in",
"human",
"-",
"readible",
"format",
"(",
"AA",
".",
"BB",
".",
"CC",
")",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L53-L63 |
nugget/python-insteonplm | insteonplm/messages/userdata.py | Userdata.bytes | def bytes(self):
"""Emit the address in bytes format."""
byteout = bytearray()
for i in range(1, 15):
key = 'd' + str(i)
if self._userdata[key] is not None:
byteout.append(self._userdata[key])
else:
byteout.append(0x00)
... | python | def bytes(self):
"""Emit the address in bytes format."""
byteout = bytearray()
for i in range(1, 15):
key = 'd' + str(i)
if self._userdata[key] is not None:
byteout.append(self._userdata[key])
else:
byteout.append(0x00)
... | [
"def",
"bytes",
"(",
"self",
")",
":",
"byteout",
"=",
"bytearray",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"15",
")",
":",
"key",
"=",
"'d'",
"+",
"str",
"(",
"i",
")",
"if",
"self",
".",
"_userdata",
"[",
"key",
"]",
"is",
"not"... | Emit the address in bytes format. | [
"Emit",
"the",
"address",
"in",
"bytes",
"format",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L71-L80 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L83-L87 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L90-L94 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L103-L106 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L108-L120 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L150-L159 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/userdata.py#L162-L176 |
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",
":",
"# pylint: disable=unused... | Hexideciaml representation of the message in bytes. | [
"Hexideciaml",
"representation",
"of",
"the",
"message",
"in",
"bytes",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/message.py#L131-L157 |
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",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/messages/message.py#L164-L184 |
nugget/python-insteonplm | insteonplm/states/onOff.py | OnOffStateBase._register_messages | def _register_messages(self):
"""Register messages to listen for."""
template_on_group = StandardReceive.template(
commandtuple=COMMAND_LIGHT_ON_0X11_NONE,
address=self._address,
target=bytearray([0x00, 0x00, self._group]),
flags=MessageFlags.template(MESS... | python | def _register_messages(self):
"""Register messages to listen for."""
template_on_group = StandardReceive.template(
commandtuple=COMMAND_LIGHT_ON_0X11_NONE,
address=self._address,
target=bytearray([0x00, 0x00, self._group]),
flags=MessageFlags.template(MESS... | [
"def",
"_register_messages",
"(",
"self",
")",
":",
"template_on_group",
"=",
"StandardReceive",
".",
"template",
"(",
"commandtuple",
"=",
"COMMAND_LIGHT_ON_0X11_NONE",
",",
"address",
"=",
"self",
".",
"_address",
",",
"target",
"=",
"bytearray",
"(",
"[",
"0x... | Register messages to listen for. | [
"Register",
"messages",
"to",
"listen",
"for",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/onOff.py#L85-L177 |
nugget/python-insteonplm | insteonplm/states/onOff.py | OnOffSwitch.on | def on(self):
"""Send ON command to device."""
on_command = StandardSend(self._address,
COMMAND_LIGHT_ON_0X11_NONE, 0xff)
self._send_method(on_command,
self._on_message_received) | python | def on(self):
"""Send ON command to device."""
on_command = StandardSend(self._address,
COMMAND_LIGHT_ON_0X11_NONE, 0xff)
self._send_method(on_command,
self._on_message_received) | [
"def",
"on",
"(",
"self",
")",
":",
"on_command",
"=",
"StandardSend",
"(",
"self",
".",
"_address",
",",
"COMMAND_LIGHT_ON_0X11_NONE",
",",
"0xff",
")",
"self",
".",
"_send_method",
"(",
"on_command",
",",
"self",
".",
"_on_message_received",
")"
] | Send ON command to device. | [
"Send",
"ON",
"command",
"to",
"device",
"."
] | train | https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/onOff.py#L196-L201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.