Timestamp should be an integer.
This commit is contained in:
parent
31b5c55894
commit
04b69f1a49
|
@ -38,10 +38,13 @@ class Reading:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.time.strftime("%F %T %Z")},{self.time.timestamp()},{self.temp},{self.press},{self.hum}'
|
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):
|
def list(self):
|
||||||
return [
|
return [
|
||||||
self.time.strftime("%F %T %Z"),
|
self.time.strftime("%F %T %Z"),
|
||||||
self.time.timestamp(),
|
self.timestamp(),
|
||||||
self.temp,
|
self.temp,
|
||||||
self.press,
|
self.press,
|
||||||
self.hum
|
self.hum
|
||||||
|
@ -68,7 +71,7 @@ class Reading:
|
||||||
|
|
||||||
def json(self) -> bytes:
|
def json(self) -> bytes:
|
||||||
return bytes(json.dumps({
|
return bytes(json.dumps({
|
||||||
'timestamp': self.time.timestamp(),
|
'timestamp': self.timestamp(),
|
||||||
'temperature': self.temp,
|
'temperature': self.temp,
|
||||||
'pressure': self.press,
|
'pressure': self.press,
|
||||||
'relative_humidity': self.hum,
|
'relative_humidity': self.hum,
|
||||||
|
|
Loading…
Reference in New Issue