Hi,
- Home Assistant 11.2 on a Raspberry Pi 4
- Home Assistant Core 2023.12.4
I have an Arduino sending data via the MQTT integrationt to home assistant. This works like a charm, but I have the problem that my WiFi is shut down over night, and I do not have a permanent connection from the Arduino to HA (a well-discussed problem, I know that this is not easy, but I have some idea where I do not know how to implement - see below).
Therefore I buffer the data in the Arduino (in fact its an ESP32, enough RAM), and I would like to send the buffered data including a timestamp to HA.
After reading many posts, I understood:
- it is not possible to add timestamps in the past to an event, HA always takes the current time
- it is very hard to add values to the statistics DB
With spook recorder.import_statistics it should be possible to add (hourly) values to the statistics DB.
I would send the buffered data in a separate MQTT topic (with entity ID, value, timestamp) to HA, and then prepare the data and call the service recorder.import_statistics
Does this make sense? Better ideas?
What I do not know is how I can implement this (preparing the data) in some higher-level-language (e.g. python), triggered by the separate MQTT topic, and prepare the data there for the service recorder.import_statistics, and then call the recorder.import_statistics service.
It would be great if someone can point me to the right direction / examples. No need to relate them to storing statistics, just regarding calling self-implemented services (?), and call an existing service (like Recorder: Purge entities) from there. Thanks!