From 04b69f1a496511d53ae9bb8e3ebf5a03eb8b2b2d Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sun, 27 Feb 2022 01:10:42 -0800 Subject: [PATCH] Timestamp should be an integer. --- chime/sensor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chime/sensor.py b/chime/sensor.py index 61d8408..e2d1f7d 100644 --- a/chime/sensor.py +++ b/chime/sensor.py @@ -38,10 +38,13 @@ class Reading: def __str__(self): return f'{self.time.strftime("%F %T %Z")},{self.time.timestamp()},{self.temp},{self.press},{self.hum}' + def timestamp(self): + return int(self.time.timestamp()) + def list(self): return [ self.time.strftime("%F %T %Z"), - self.time.timestamp(), + self.timestamp(), self.temp, self.press, self.hum @@ -68,7 +71,7 @@ class Reading: def json(self) -> bytes: return bytes(json.dumps({ - 'timestamp': self.time.timestamp(), + 'timestamp': self.timestamp(), 'temperature': self.temp, 'pressure': self.press, 'relative_humidity': self.hum,