-@timeout(5.0, use_signals=False, error_message="Timed out waiting for tplink.py")
-def tplink_outlet_command(command: str) -> bool:
- result = os.system(command)
- signal = result & 0xFF
- if signal != 0:
- msg = f'{command} died with signal {signal}'
- logger.warning(msg)
- logging_utils.hlog(msg)
- return False
- else:
- exit_value = result >> 8
- if exit_value != 0:
- msg = f'{command} failed, exited {exit_value}'
- logger.warning(msg)
- logging_utils.hlog(msg)
- return False
- logger.debug('%s succeeded.', command)
- return True
-
-