Can a time stamp be sent with data

When using mqtt can one include a time stamp with the data?
If yes then where can I find info regarding what the data should look like?
If no then the question is how does one resolve the problem of perhaps wifi going down but data is still collected and when wifi comes back the data is sent to emoncms. How is it matched with regards to time on the graphs?
Or perhaps the power goes out at point of collection so when data stream continues a couple hours have passed?

Yes

I was going to point you to the docs, but realised that it isn’t actually there :frowning:

You need to enable JSON format instead of the node format as well.

    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,

        timestamped = True
        node_JSON_enable = 1
        node_JSON_basetopic = emon/
        node_format_enable = 0
        node_format_basetopic = emonhub/
        nodevar_format_enable = 0
        nodevar_format_basetopic = emon/

With MQTT you cannot (well possibly you can with a different QOS but we do not use that). The HTTP Interface can buffer data until the network connection is restored (I think there is a limit, but not sure what it is).

Do you perhaps have an example of what this json record looks like?
I found this but it did not seem to be agreed on what it should be??

Publishing: emon/emonpi {"power1": 145, "power2": 0, "pulsecount": 0, "time": 1677705847.7624357}

Nothing to do with emonhub.

Thanks will give it a try - I am generating it in C using an ESP32

1 Like

So I have tried this but am not sure what emonpi is doing with the time parameter.
I sent something like this: `emon/powertime {“power2”: 145, “time”: 1677705847}
It displays powertime power2 in a graph. I am not sure if it is actually doing anything with the time parameter.
Is there a list anywhere of which mqtt parameters the emonpi actually uses for graphing or any other purpose?

Try it on a test input to a time a minute ago. In the ‘Inputs’ page, it will appear as being updated x minutes/seconds ago.

It helps to ensure an even time between readings - if you want it at 10s, then that is what you will get :slight_smile:

emoncms is not using any ‘MQTT Parameters’ fro graphing.

The Time element tells it where to put it in the database timeseries, which then uses that for the graphs.

The two are independent. MQTT is just a data delivery method. You can set Time on the HTTP interface as well (if JSON).

Perhaps I should not have said graphing. I meant which labels / topics doe it actually use for things such as calculations, time marking etc

The answer is the same. Data comes in via MQTT/HTTP into the timeseries database. the outputs are generated from that data.

Suggest you read Emoncms Core Concepts — OpenEnergyMonitor 0.0.1 documentation