description=None,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
fromfile_prefix_chars="@",
- epilog=f'------------------------------------------------------------------------------\n{program_name} uses config.py ({__file__}) for global, cross-module configuration setup and parsing.\n------------------------------------------------------------------------------'
+ epilog=f'{program_name} uses config.py ({__file__}) for global, cross-module configuration setup and parsing.'
)
# Keep track of if we've been called and prevent being called more
result = os.system(command)
signal = result & 0xFF
if signal != 0:
+ logger.warning(f'{command} died with signal {signal}')
logging_utils.hlog("%s died with signal %d" % (command, signal))
return False
else:
exit_value = result >> 8
if exit_value != 0:
+ logger.warning(f'{command} failed, exited {exit_value}')
logging_utils.hlog("%s failed, exit %d" % (command, exit_value))
return False
+ logger.debug(f'{command} succeeded.')
return True
cmd = self.get_cmdline(child) + f"-c {cmd}"
if extra_args is not None:
cmd += f" {extra_args}"
+ logger.debug(f'About to execute {cmd}')
return tplink_light_command(cmd)
def turn_on(self, child: str = None) -> bool:
>>> to_bitstring('test', delimiter=' ')
'01110100 01100101 01110011 01110100'
+ >>> to_bitstring(b'test')
+ '01110100011001010111001101110100'
+
"""
+ etxt = to_ascii(txt)
bits = bin(
int.from_bytes(
- txt.encode(encoding, errors),
+ etxt,
'big'
)
)