aboutsummaryrefslogtreecommitdiff
path: root/rrd/mqtt.py
diff options
context:
space:
mode:
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())