You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MQTT doesn't contain timestamps in the protocol. So if a message is sent with QoS 1 or QoS 2, cached at the message broker and retrieved at a later time, it is impossible to get the initial time it was sent.
What did you expect to happen
Have an option to add a timestamp to each message (current timestamp from the system running zigbee2mqtt)
How to reproduce it (minimal and precise)
Connect a client with QoS > 0 and Persistent Session, subscribe to a topic that gets sensor data from zigbee2mqtt
disconnect client
configure zigbee2mqtt with QoS>0, start zigbee2mqtt, wait until at least one message is sent to the topic subscribed in 1.
reconnect client
receive message
try to find out the time for the received sensor values
you can't
My proposal would be to just add the current unixtime in UTC from the host to each message as JSON property and make this configurable.
e.g. instead of {"temperature":8.77,"linkquality":94,"humidity":85.15,"pressure":948,"battery":74,"voltage":2955} have {"temperature":8.77,"linkquality":94,"humidity":85.15,"pressure":948,"battery":74,"voltage":2955,"timestamp":1576959102}
Usecase for me is this: I have some zigbee sensors at home and collect all data of temp/humidity/rain/... sensors in InfluxDB.
My parents now also have some zigbee stuff setup, with own MQTT broker.
I want to store at least the outside weather data from their place in my InfluxDB. If everything works, no problem. But if the internet connection or VPN fails, I am missing data. The MQTT broker stores this data, but it is useless if received later. (The sensors send based on changes, so if connection was down for 10 hours and there are 6 messages with different temperatures, it is impossible currently to find out which time this temperatures have been measured)
The text was updated successfully, but these errors were encountered:
Bug Report
What happened
MQTT doesn't contain timestamps in the protocol. So if a message is sent with QoS 1 or QoS 2, cached at the message broker and retrieved at a later time, it is impossible to get the initial time it was sent.
What did you expect to happen
Have an option to add a timestamp to each message (current timestamp from the system running zigbee2mqtt)
How to reproduce it (minimal and precise)
My proposal would be to just add the current unixtime in UTC from the host to each message as JSON property and make this configurable.
e.g. instead of
{"temperature":8.77,"linkquality":94,"humidity":85.15,"pressure":948,"battery":74,"voltage":2955}
have{"temperature":8.77,"linkquality":94,"humidity":85.15,"pressure":948,"battery":74,"voltage":2955,"timestamp":1576959102}
Usecase for me is this: I have some zigbee sensors at home and collect all data of temp/humidity/rain/... sensors in InfluxDB.
My parents now also have some zigbee stuff setup, with own MQTT broker.
I want to store at least the outside weather data from their place in my InfluxDB. If everything works, no problem. But if the internet connection or VPN fails, I am missing data. The MQTT broker stores this data, but it is useless if received later. (The sensors send based on changes, so if connection was down for 10 hours and there are 6 messages with different temperatures, it is impossible currently to find out which time this temperatures have been measured)
The text was updated successfully, but these errors were encountered: