Skip to content

Commit

Permalink
v0.9.12:Add data timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
noahziheng committed Jun 12, 2018
1 parent 1366b6f commit 2b82577
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions libfreeiot/adapters/mqtt/Parse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Updated at: 2018-2-2
"""
from bson import DBRef, ObjectId
from datetime import datetime
from .. import Constant
from . import sys, mongo

Expand Down Expand Up @@ -39,15 +40,17 @@ def main(client, topic, payload):
"device": DBRef("devices", topic[0]),
"topic": topic[1],
"flag": topic[2],
"content": payload
"content": payload,
"created_at": datetime.now()
})
mongo.db.devices.update_one({"_id": ObjectId(topic[0])},
{
"$set": {
"lastdata." + topic[1]: {
"flag": topic[2],
"content": payload,
"original": DBRef("datas", res.inserted_id)
"original": DBRef("datas", res.inserted_id),
"created_at": datetime.now()
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

setup(
name = "libfreeiot",
version = "0.9.11",
version = "0.9.12",
description = 'A free, open-source IoT Framework',
author = 'Noah Gao',
author_email = '[email protected]',
url = 'https://github.com/noahziheng/freeiot',
download_url = 'https://github.com/noahziheng/freeiot/archive/0.9.11.tar.gz',
download_url = 'https://github.com/noahziheng/freeiot/archive/0.9.12.tar.gz',
packages = find_packages(),
install_requires=[ # 依赖列表
'Flask>=0.12.2',
Expand Down

0 comments on commit 2b82577

Please sign in to comment.