mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2025-01-28 22:53:52 +00:00
fixing type of timestamp
This commit is contained in:
parent
00a35a6080
commit
c445531989
@ -1,5 +1,6 @@
|
|||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@ -89,7 +90,8 @@ class OrionAPI(LoggerMixin):
|
|||||||
"type": self._get_type(data_senml["v"]),
|
"type": self._get_type(data_senml["v"]),
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
"value": data_senml["t"],
|
"value": datetime.fromtimestamp(float(data_senml["t"])).replace(microsecond=0).isoformat()
|
||||||
|
if data_senml["t"] != "none" else data_senml["t"],
|
||||||
"type": "String"
|
"type": "String"
|
||||||
},
|
},
|
||||||
"bn": {
|
"bn": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user