Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 2b82577

Browse files
committed
v0.9.12:Add data timestamp
1 parent 1366b6f commit 2b82577

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

libfreeiot/adapters/mqtt/Parse/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Updated at: 2018-2-2
55
"""
66
from bson import DBRef, ObjectId
7+
from datetime import datetime
78
from .. import Constant
89
from . import sys, mongo
910

@@ -39,15 +40,17 @@ def main(client, topic, payload):
3940
"device": DBRef("devices", topic[0]),
4041
"topic": topic[1],
4142
"flag": topic[2],
42-
"content": payload
43+
"content": payload,
44+
"created_at": datetime.now()
4345
})
4446
mongo.db.devices.update_one({"_id": ObjectId(topic[0])},
4547
{
4648
"$set": {
4749
"lastdata." + topic[1]: {
4850
"flag": topic[2],
4951
"content": payload,
50-
"original": DBRef("datas", res.inserted_id)
52+
"original": DBRef("datas", res.inserted_id),
53+
"created_at": datetime.now()
5154
}
5255
}
5356
})

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
setup(
77
name = "libfreeiot",
8-
version = "0.9.11",
8+
version = "0.9.12",
99
description = 'A free, open-source IoT Framework',
1010
author = 'Noah Gao',
1111
author_email = 'noahgaocn@outlook.com',
1212
url = 'https://github.com/noahziheng/freeiot',
13-
download_url = 'https://github.com/noahziheng/freeiot/archive/0.9.11.tar.gz',
13+
download_url = 'https://github.com/noahziheng/freeiot/archive/0.9.12.tar.gz',
1414
packages = find_packages(),
1515
install_requires=[ # 依赖列表
1616
'Flask>=0.12.2',

0 commit comments

Comments
 (0)