[SOLVED] Persistence with own timestamp?


is there a method how to store the current readings with original timestamps instead of with the current date & time?

My use case is that some data are gathered off-line and sent to network cca each 30 minutes with original timestamps of the readings (there is unknown number of readings, varying between tens to thousands, theoretically). The external device will probably publish the data to mqtt broker (mosquitto). In fact, these are pulse counting sensors for reading water, electricity and gas flow.

I would like to

  1. store the data in db without compression over time;
  2. use openHAB to chart the data
  3. use openHAB to show the cumulative value in sitemap.

So far, I have not found how to send any data to openHAB so that it stores them with some user defined timestamp. Is that even possible?

Some thoughts of mine on how to workaround the limitation (if it exists):

  • process the data independently from openHAB, i.e. to have an own script subscribed to mosquitto broker, which would split the batched data to separate messages (timestamp, reading value) and store them to database directly (say, MySQL);

  • set openHAB persistance for the sensors, but never ever send openHAB any update re. the readings; as a result, it should read last known value from the db;

For this to work, openHAB would have to check the db in intervals to update the values shown in sitemap. Is this possible?

If not, well, I could have yet another external script messaging openHAB regularly and forget about persistence in openHAB completely. But then, the whole process becomes more complex and error prone.

Any other idea?

Take a look at this rule example, this might give you an idea …

I see.

Hence going the way of externally populated DB and triggering openHAB (via event-based command or so) to refresh its status from persistence might be a way to go…