I posted some reasonably robust Python code to insert backdated state data into the states table. The code also adds the corresponding statistics to the statistics and short_term_statistics tables.
The source can be either a CSV file or a SQLite db – with 2 columns (one for timestamp in UTC, other for data to be entered) See the following link: