X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=smart_home%2Foutlets.py;h=c079cfd09d9cbbfbb8595379770ebc1c8d7497ae;hb=822454f580c1ff9eb207b8da46cdfae24e30cde1;hp=8fd09487a48b5c49478bb5d84b91d481dc36adfc;hpb=e8671a716da868332d3ac1f66d4d2f7f8d33fc28;p=python_utils.git diff --git a/smart_home/outlets.py b/smart_home/outlets.py index 8fd0948..c079cfd 100644 --- a/smart_home/outlets.py +++ b/smart_home/outlets.py @@ -48,14 +48,16 @@ def tplink_outlet_command(command: str) -> bool: 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)) + 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: - logger.warning(f'{command} failed, exited {exit_value}') - logging_utils.hlog("%s failed, exit %d" % (command, exit_value)) + msg = f'{command} failed, exited {exit_value}' + logger.warning(msg) + logging_utils.hlog(msg) return False logger.debug(f'{command} succeeded.') return True