log-viewer/emitter/emitter.py

22 lines
539 B
Python

from datetime import datetime
from pymongo import MongoClient
from bson.objectid import ObjectId
from time import sleep
MONGO_URI="mongodb://127.0.0.1:27017/default"
db = MongoClient(MONGO_URI).get_default_database()
while True:
db.eventlog.insert_one({
"timestamp": datetime.utcnow(),
"event": "motion-detected",
"started": "...",
"finished": "...",
"component": "motion-detect",
"camera": "Server room",
"action": "event",
"screenshot_count": 1
})
sleep(1)