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: {_get_timestamp_as_string(watering_mcu_status["last_time"])}\n' + buf = '' + if 0 < watering_mcu_status["last_time"] < time()-1800: + buf += 'WARNING! long time no reports from mcu! maybe something\'s wrong\n' + buf += f'last report time: {_get_timestamp_as_string(watering_mcu_status["last_time"])}\n' if watering_mcu_status["last_boot_time"] != 0: buf += f'boot time: {_get_timestamp_as_string(watering_mcu_status["last_boot_time"])}\n' buf += 'relay opened: ' + ('yes' if watering_mcu_status['relay_opened'] else 'no') + '\n' - buf += f'ambient temp & humidity: {watering_mcu_status["ambient_temp"]} C, {watering_mcu_status["ambient_rh"]}%' + buf += f'ambient temp & humidity: {watering_mcu_status["ambient_temp"]} °C, {watering_mcu_status["ambient_rh"]}%' ctx.reply(buf)