Skip to content

Commit

Permalink
Add timestamp to camera messages
Browse files Browse the repository at this point in the history
  • Loading branch information
WillB97 committed Jul 8, 2024
1 parent dc0cd61 commit 339384f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sbot/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import logging
import os
import time
from typing import Any, Callable, TypedDict
from urllib.parse import urlparse

Expand Down Expand Up @@ -150,7 +151,10 @@ def wrapped_publish(
payload = payload.decode('utf-8')
self.publish(
topic,
json.dumps({"data": payload}),
json.dumps({
"timestamp": time.time(),
"data": payload,
}),
retain=retain, abs_topic=abs_topic)

def _on_connect(
Expand Down

0 comments on commit 339384f

Please sign in to comment.