From 5973b7ca26e63880e9d74a52fa9e2ec61c811401 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 8 Dec 2023 10:20:36 +0100 Subject: Management command for the mqtt loop --- rrd/management/__init__.py | 0 rrd/management/commands/__init__.py | 0 rrd/management/commands/listen_mqtt.py | 10 ++++++++++ 3 files changed, 10 insertions(+) create mode 100644 rrd/management/__init__.py create mode 100644 rrd/management/commands/__init__.py create mode 100644 rrd/management/commands/listen_mqtt.py (limited to 'rrd/management') diff --git a/rrd/management/__init__.py b/rrd/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rrd/management/commands/__init__.py b/rrd/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rrd/management/commands/listen_mqtt.py b/rrd/management/commands/listen_mqtt.py new file mode 100644 index 0000000..758a4f2 --- /dev/null +++ b/rrd/management/commands/listen_mqtt.py @@ -0,0 +1,10 @@ +from django.core.management.base import BaseCommand + +import rrd.mqtt + +class Command(BaseCommand): + help = "Listen to mqtt events and update rrd files and graphs" + + def handle(self, *args, **kw): + mqtt_client = rrd.mqtt.MQTTClient() + mqtt_client.loop_forever() -- cgit v1.2.3