Single mqtt message translated to multiple sensor events with custom creation time

Hi,

I’m building a esp8266 with temp/hum which has deep sleep functionality as a lot of people. But I want to wakeup it, save it to rtc memory, go to sleep and avoid connecting to internet multiple times. So once every 3 hours, it would publish all messages to mqtt (or maybe a single message to avoid the connection overhead).

My question would be: is it possible to translate a single mqtt message into multiple sensor reads? Also, how could I set a custom date?

For example:
10:10 esp8266 message publish 6 entries (2 for each hour) this is transformed in 6 sensor entries with first being:
Last message + 30 min (10:40)
Last message + 30 min (11:10)
Last message + 30 min (11:40)
Last message + 30 min (12:10)

So I guess I would need some type of processing of the mqtt message and being able to set a custom datetime for when the event happened. So when I plot this, even if everything was received at once, I would still see a nice graph.

I thought on using appdaemon + connecting to the dabatase and inserting the data manually but this seems so hacky. I hope it is possible in a different way.

Any suggestions? Thanks.

I don’t believe it is possible to ‘backdate’ a sensor reading, so if I am right the answer is no.

As was previously mentioned, I don’t think that you can backdate any sensor measurements in Home Assistant.

If these things are batched up, maybe you could write the measurements into, e.g., InfluxDB directly to capture the historical data as it arrives in batches and then make some sensors that query the last InfluxDB value to produce an entity in Home Assistant? I believe there is a way to do this, but I’ve not tried myself. See the latter part of the https://www.home-assistant.io/integrations/influxdb/ page where it discusses the InfluxDB sensor: configuration.

Even then, you’re probably only going to get pretty graphs using the InfluxDB data (I use grafana for that purpose) since Home Assistant is only going to see the most recent of a set of batched entries that get inserted into the external database.