I am currently working on a plugin that gathers data from a REST API, digests it and updates relevant device states. The API also provides historical data, which I am also digesting, but can't quite figure out how to properly store in SQL Logger. Specifics follow, any pointers appreciated!
The data being collected is realtime production from a solar system. To this point, everything is working properly. On the hour, the API also makes available total production for the last hour (same for day, month and year). This data is easily stored in device states, however the problem occurs when trying to graph the data using for example INDIGOPlotD. While the data is historical, the timestamp is current (so for example, production for 10am would appear as an entry at just past 11am). Clearly, the impact increases as the interval gets larger (i.e. we don't want summary data from the year 2017 to show up as 2018).
Is there a way to insert this data into the SQL Logger with an adjusted ts value for the hour [day, month, year] before?
Thanks!