diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2023-12-27 13:10:01 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2023-12-29 07:29:22 +0100 |
commit | e9c843a4eb817daf249167b79ba3c60237bb93e9 (patch) | |
tree | ea60527374dc05f333dd6122fc1517e68558b8bf /rrd/mqtt.py | |
parent | 27bc8de7c7f8e29ba10324b56fef9fc4e80a9fd6 (diff) |
Generate graphs when data is updated.
Diffstat (limited to 'rrd/mqtt.py')
-rw-r--r-- | rrd/mqtt.py | 5 |
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()) |