summaryrefslogtreecommitdiff
path: root/src/pump_bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/pump_bot.py')
-rwxr-xr-xsrc/pump_bot.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pump_bot.py b/src/pump_bot.py
index fa884ab..48efec4 100755
--- a/src/pump_bot.py
+++ b/src/pump_bot.py
@@ -13,7 +13,7 @@ from home.api.types import BotType
from home.mqtt import MqttNode, MqttModule, MqttPayload, add_mqtt_module
from home.mqtt.module.relay import MqttPowerStatusPayload
from home.mqtt.module.temphum import MqttTemphumDataPayload
-from home.mqtt.module.diagnostics import InitialDiagnosticsPayload
+from home.mqtt.module.diagnostics import InitialDiagnosticsPayload, DiagnosticsPayload
config.load('pump_bot')
@@ -210,7 +210,16 @@ def markup(ctx: Optional[bot.Context]) -> Optional[ReplyKeyboardMarkup]:
def mqtt_payload_callback(payload: MqttPayload):
global watering_mcu_status
- watering_mcu_status['last_time'] = int(time())
+ types_the_node_can_send = (
+ InitialDiagnosticsPayload,
+ DiagnosticsPayload,
+ MqttTemphumDataPayload,
+ MqttPowerStatusPayload
+ )
+ for cl in types_the_node_can_send:
+ if isinstance(payload, cl):
+ watering_mcu_status['last_time'] = int(time())
+ break
if isinstance(payload, InitialDiagnosticsPayload):
watering_mcu_status['last_boot_time'] = int(time())