From 5f1d0338c999c4f092675b9dd998aafbbae87e53 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 3 Jun 2024 09:11:21 +0400 Subject: [PATCH] [Revert if incompatible] ?time=&name= is for device, not sensor --- models.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/models.py b/models.py index 9a9c919..b26164a 100644 --- a/models.py +++ b/models.py @@ -72,11 +72,18 @@ class Device: for s in self.sensors: res += f'&{s.mac}={s.value}' + # if s.time is not None: + # res += f'&time={s.time}' + # if s.name is not None: + # res += f'&name={quote(s.name)}' + + if self.sensors: + s = self.sensors[0] if s.time is not None: res += f'&time={s.time}' - if s.name is not None: - res += f'&name={quote(s.name)}' + if self.name is not None: + res += '&name=' + quote(self.name) if self.owner is not None: res += '&owner=' + quote(self.owner)