summaryrefslogtreecommitdiff
path: root/src/pump_bot.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-05-31 23:16:08 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-05-31 23:16:08 +0300
commit2996e4b22ef72719d07423657e70256b2e2d207b (patch)
treec5efb1a1230af463d37a73ee0ffe6341c58e002f /src/pump_bot.py
parent21b39f245cd0000cf7a42cca891f32328ba0953e (diff)
save
Diffstat (limited to 'src/pump_bot.py')
-rwxr-xr-xsrc/pump_bot.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pump_bot.py b/src/pump_bot.py
index 0e2b71d..ea39351 100755
--- a/src/pump_bot.py
+++ b/src/pump_bot.py
@@ -181,11 +181,14 @@ def _get_timestamp_as_string(timestamp: int) -> str:
@bot.handler(message='watering_status')
def watering_status(ctx: bot.Context) -> None:
- buf = f'last report time: <b>{_get_timestamp_as_string(watering_mcu_status["last_time"])}</b>\n'
+ buf = ''
+ if 0 < watering_mcu_status["last_time"] < time()-1800:
+ buf += '<b>WARNING! long time no reports from mcu! maybe something\'s wrong</b>\n'
+ buf += f'last report time: <b>{_get_timestamp_as_string(watering_mcu_status["last_time"])}</b>\n'
if watering_mcu_status["last_boot_time"] != 0:
buf += f'boot time: <b>{_get_timestamp_as_string(watering_mcu_status["last_boot_time"])}</b>\n'
buf += 'relay opened: <b>' + ('yes' if watering_mcu_status['relay_opened'] else 'no') + '</b>\n'
- buf += f'ambient temp & humidity: <b>{watering_mcu_status["ambient_temp"]} C, {watering_mcu_status["ambient_rh"]}%</b>'
+ buf += f'ambient temp & humidity: <b>{watering_mcu_status["ambient_temp"]} °C, {watering_mcu_status["ambient_rh"]}%</b>'
ctx.reply(buf)