save
This commit is contained in:
parent
21b39f245c
commit
2996e4b22e
@ -181,11 +181,14 @@ def _get_timestamp_as_string(timestamp: int) -> str:
|
|||||||
|
|
||||||
@bot.handler(message='watering_status')
|
@bot.handler(message='watering_status')
|
||||||
def watering_status(ctx: bot.Context) -> None:
|
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:
|
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 += 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 += '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)
|
ctx.reply(buf)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user