AsyncTCP & timestamp /?


I have questions about the Cayenne system.

  1. I use the Arduino ESP library on ESP32 hardware, could it be used to communicate with the AsyncTCP Client library server? I am talking about non-blocking communication.
  2. I would like to send data to the server always have timstamp but from the device that sends this data. I mean the exact time of the event, because as you know before the data will be sent and inserted into the database, the time passes.
    Is there any possibility to give a timestamp from the arduino program?



tagging @jburhenn for this.

Are you referring to appending the timestamp along with data send. i am not sure about this. But if you want to monitor at what time the data was send you can view the data tab and check. there is few second delay between the device data send timestamp and the server data received timestamp.


int CayenneBuildDataPayload (char * payload, size_t * length, const char * type, const CayenneValuePair * values, size_t valueCount) {…

I am just reviewing and unfortunately there is no possibility to specify the exact time of occurrence of the event / value.

It would be ideal if this option was added.
Mainly it’s about datetime, and TimeTick (millis ()).
I care about such notation because the order of occurrence of values is important for data analysis.


I’m not sure exactly what you are trying to do. The Cayenne ESP library connects to the Cayenne server at Are you trying to get it to connect to a local server that’s using AsyncTCP?

Or do you mean you want to try and modify the Cayenne library to use asynchronous communication with AsyncTCP? In theory, that would be possible though it would probably require a lot of rewriting the Cayenne library to work asynchronously.

One other option you could try is getting an asynchronous MQTT Arduino client (here is one that seems to be based on AsyncTCP, though I’ve never used it so I don’t know how well it works: and then manually building the MQTT topics used by Cayenne either with your own code or using the code in CayenneUtils:


this option is interesting for me.


I can check it, maybe I can cure myself somehow

it would still be nice if this timestamp from the device side could be sent


Thanks for the timestamp suggestion. We may look into adding support for that at some point in the future though it isn’t in the immediate plans. So for now the only data timestamps would be the ones shramiksalgaonkar mentioned on the data tab.


I would do it so that everything would work as it is now, only in the content of mqtt message I will provide with the value of timestamp and tick, then the server will put it in the database. If there is no additional timestamp value then server will insert the timestamp as before.


Looks like it just dropped off the Slack history, but one of the Cayenne team members posted that it was possible (or soon to be) to send time stamps when using JSON to send data to the Cayenne servers. I think it was @ecoqba?

The MQTT topic is: v1/USERNAME/things/THING_ID/data/json

Payload format is:

    {"channel":3,"type": "digital_sensor","unit":"d","value":0,"name":"Digital Input 2"},
    {"channel":27,"type": "rssi","unit":"dbm","value":12,"name":"GSM Signal Strength"},
    {"channel":6,"type": "temp","unit":"c","value":31,"name":"Modem Temperature"},
    {"channel":29,"type": "voltage","unit":"v","value":12.193,"name":"Power Supply Voltage mV"}


just, here in the frame of JSON I miss the timestamp and tickstamp fields. Only 2 x 32 bit value presented in a hexadecimal way text. for example,

{"channel":3,"type": "digital_sensor","unit":"d","value":0,"name":"Digital Input 2","timestamp":$23232443,"tickstamp":$00130143},


Does that work? If so where did you find the docs for that?


it certainly does not work, I would like it to look like this :slight_smile:


Just heard back that it is planned but not a top priority right now.


The simplest and fastest solution would be to add a new table to the database so as not to rebuild the columns of the existing database. The new table would have relations to the entry with the value and timestamp and tickstamp. Everything would work so far only projects that transmit timestamp would have recorded these values in the new table,