arduino-dsmr
arduino-dsmr copied to clipboard
Not able to read timestamps from TimestampedFixedValue
Hi, thanks for this awesome library! Works great!
I have an issue accessing the timestamp corresponding to the gas_delivered value (TimestampedFixedValue type). The readme states that there is an additional timestamp() function which would return a timestamp string. The compiler however throws an error:
DSMR:376:65: error: no match for call to '(String) ()'
mqttGasStruct["timestamp"] = data.gas_delivered.timestamp();
exit status 1
no match for call to '(String) ()'
I am not that familiar with the C++ template structures used, but I cannot find any function named timestamp() in fields.h. I can directly access gas_delivered.timestamp (the variable, not the function), but that is not how it is documented and it seems that this value is not updated after receiving new telegrams.
Am I doing something wrong? Unfortunately, the examples do not cover these TimestampedFixedValue timestamps.
but I cannot find any function named timestamp() in fields.h. I can directly access gas_delivered.timestamp (the variable, not the function), but that is not how it is documented
It seems the README was wrong, timestamp is indeed a field, not a method. I'll update the README in a minute.
and it seems that this value is not updated after receiving new telegrams.
Hm, that is weird. However, the examples use a local variable for storing new data, so then there would be no way for the old value to show up. Maybe you are re-using the "MyData" (or whatever you called it) variable and not clearing it (though I would expect you to get duplicate field errors the). See #17.