diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-07-01 21:44:16 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-07-01 21:44:16 +0300 |
commit | 5578736cf715627b747a950de02e9ef2078760a6 (patch) | |
tree | 249fc81d05607e95ba6b897970123458bbf52f31 /src | |
parent | c09de798b4874f9a7158507b5fc5660fea64b44e (diff) |
polaris_kettle_bot: fix
Diffstat (limited to 'src')
-rwxr-xr-x | src/polaris_kettle_bot.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/polaris_kettle_bot.py b/src/polaris_kettle_bot.py index b0d3fb7..748e8de 100755 --- a/src/polaris_kettle_bot.py +++ b/src/polaris_kettle_bot.py @@ -664,14 +664,15 @@ class KettleBot(Wrapper): current_temp=kc.info.temperature, mode=kc.info.mode) message = ctx.reply(html, markup=markup) - logger.info(f'ctx.reply returned message: {message}') + logger.debug(f'ctx.reply returned message: {message}') - mut = MessageUpdatingTarget(ctx, message, - initial_power_mode=kc.info.mode, - user_enabled_power_mode=power_mode, - user_target_temp=temp) - mut.set_rendered_content((html, markup)) - kc.add_updating_message(mut) + if ok: + mut = MessageUpdatingTarget(ctx, message, + initial_power_mode=kc.info.mode, + user_enabled_power_mode=power_mode, + user_target_temp=temp) + mut.set_rendered_content((html, markup)) + kc.add_updating_message(mut) run_tasks(tasks, done) @@ -688,13 +689,14 @@ class KettleBot(Wrapper): else: html, markup = Renderer.turned_off(ctx, mode=kc.info.mode) message = ctx.reply(html, markup=markup) - logger.info(f'ctx.reply returned message: {message}') - - mut = MessageUpdatingTarget(ctx, message, - initial_power_mode=kc.info.mode, - user_enabled_power_mode=PowerType.OFF) - mut.set_rendered_content((html, markup)) - kc.add_updating_message(mut) + logger.debug(f'ctx.reply returned message: {message}') + + if ok: + mut = MessageUpdatingTarget(ctx, message, + initial_power_mode=kc.info.mode, + user_enabled_power_mode=PowerType.OFF) + mut.set_rendered_content((html, markup)) + kc.add_updating_message(mut) tasks = queue.SimpleQueue() tasks.put(['set_power', PowerType.OFF]) |