aboutsummaryrefslogtreecommitdiff
path: root/rrd/mqtt.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2023-12-27 13:10:01 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2023-12-29 07:29:22 +0100
commite9c843a4eb817daf249167b79ba3c60237bb93e9 (patch)
treeea60527374dc05f333dd6122fc1517e68558b8bf /rrd/mqtt.py
parent27bc8de7c7f8e29ba10324b56fef9fc4e80a9fd6 (diff)
Generate graphs when data is updated.
Diffstat (limited to 'rrd/mqtt.py')
-rw-r--r--rrd/mqtt.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/rrd/mqtt.py b/rrd/mqtt.py
index 09589c3..94bd772 100644
--- a/rrd/mqtt.py
+++ b/rrd/mqtt.py
@@ -66,10 +66,9 @@ class MQTTClient:
topic = msg.topic.removeprefix(settings.MQTT_TOPIC)
dss = models.DataSource.objects.filter(topic=topic)
if not dss:
- dss = [models.DataSource.objects.create(
+ dss = (models.DataSource.objects.create(
topic=topic,
path=slugify.slugify(topic) + ".rrd",
- )]
- dss[0].save()
+ ),)
for ds in dss:
ds.update(ts, msg.payload.decode())