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,