Historic data to new emoncms server


I’ve been having loads of issues running EmonCMS as a docker and today, I decided to set up an RPi as a dedicated unit for EmonCMS.

I configured everything and changed the Webserver on my IoTaWatt to point to the new RPi, setting the start date as 13/08/2018. It seemed all the data started uploading.

I then messed around with EmonCMS a bit and wanted to restart. If only I read the forum post before doing this, but I ended up deleting my current log using iotawatt.local/command?deletelog=current, based on this post - Graphs no longer working - #6 by overeasy. I know it was something completely unrelated, but I figured if I delete the current log, then everything will be uploaded from the history log.

Anyway, after some further reading I reset the RPi EmonPi installation to factory default, removing all data, etc.

I delete the webserver config on IoTaWatt and reconfigured everything again. But now when it starts sending data, it starts only with current data from today.

Is there any way I can get the IoTaWatt to start posting data from 13/08/2018 again. I’ve checked and I do have the history log still. It’s about 150mb in size.



The IoTaWatt looks at the time of the latest input for the node name that you specify. Dont know if you cleared those out. There is a little catch-22 here as you can’t upload history if there are recent inputs, yet you need to have the inputs present to configure the process lists.

There are Emoncms APIs to create inputs with a specific time (your starting time), or I think you could use a manual (URL) post to force a historic input time, but that is a little complicated and tedious.

I’d probably just delete all of the inputs and start up the IoTaWatt history upload, stopping it shortly after it begins. Now the inputs should be recreated with the historic times. At that point, you can add the process lists and than restart the IoTaWatt historic upload.

It’s a little clunky, but that’s how Emoncms works. I usually avoid complicated process lists, choosing instead to develop computed feed values with the IoTaWatt calculatorand sending the result to Emoncms. Then each input process list is typically just “log to feed” and “power to kWh”.

You understand that the history log is at 1 minute intervals so if your Emoncms is 10 second intervals, there is going to be a lot of null data until you get to the current log data. If you are just looking at daily or longer timeframes, it might be worthwhile to set the feed intervals in Emoncms to 60 seconds and the same in the IoTaWatt interval. If nothing else, the history upload will go a lot faster. You would not be able to change it later though. It’s too bad that the billing structure of Emoncms is per feed, regardless of size. There is no incentive to reduce the resolution, and thus the storage size, of each feed.

Thanks for the quick response. I’m good with 60 second intervals. I’ve just tried changing the node under webserver interface of IoTaWatt and saved.

It immediately created the new inputs in EmonCMS under the new node name, but only started uploading data from today (about 2.5 hours ago)… It’s still not starting at 13/08/2018…

Am I missing something else?



I’ve just tried again…

Factory reset emoncms, deleting all data directories, database, user, etc. Stopped the EmonService on iotawatt, edited the webserver config, changing the node name and saved. Rebooted iotawatt. Checked the status page and the service was still stopped. Then I started the service and checked the log.

10/13/19 15:48:53 historyLog: service started.
10/13/19 15:48:54 historyLog: Last log entry 10/13/19 15:47:00
10/13/19 15:49:20 EmonService: started. url=, node=Monitor, interval=10
10/13/19 15:49:21 EmonService: Node doesn't yet exist.
10/13/19 15:49:21 EmonService: Start posting at 10/13/19 13:07:15

It’s still starting today at 13:07 instead of 13/08/2018.



Can I see your Emoncms configuration display? You should obfuscate or remove the write key.

Sure… Here it is…

Not sure how the date is being interpreted by your browser. I can look into it tomorrow, but I always use mm/dd/yy format. You might give that a try, with yet another new node name.

Thank you! I appreciate the assistance…

I’ve checked the date (and tried to change it without success), but it seems correct. I actually used the date selector to input the date.

See below…


I’ll wait to hear from you tomorrow.

Thanks again…

If you could send me a copy of your config.txt file in a PM, it would help to diagnose. Thanks.

I’m sending it now, thanks!

The node name in the config.txt file is still “iotawatt”. What you are reporting would be consistent with the node name not changing. ARe you sure you are using a new node name when this happens?

Here’s what I would recommend you try:

  • Check the Emoncms inputs display to see what node the IoTaWatt appears to be updating.
  • Insure that your new node is not listed. If it is, delete all of the inputs.
  • Edit the IoTaWatt’s Emoncms service to change the node to your new node.
  • Take a screenshot of the IoTaWatt’s Emoncms service specifications and save it.
  • Take a screenshot of the IoTaWatt message log display to see the Emoncms restart logged with the new node name.
  • Look at the Emoncms inputs display and see what node name is being updated.

Thanks for the response. I’ve followed the steps exactly, but still have the same results. Here’s what I’ve done:

And I’m also sending you the current config.txt in a PM.


Got some bad news…

It’s been awhile since I looked at the Emoncms handler and just went through the logic that sets the historical upload date. It’s dependent on the start date/time of the current-log. So even though you have history in the history log, the handler only operates out of the current log (which is normally a year).

Oh no! So when I removed the current log, I basically shot myself in the foot? :cry:

Is there no way we can recreate a current log based on the data from the history log? Even if it is at 60 second intervals?

Otherwise, I guess I’ll need to write off the data and start over…

Thanks for the help!

There’s a reason why I haven’t provided a button to delete the logs, and why you can’t delete them with the file manager. The post you referenced was from a year and a half ago. At that time, there was an issue with log integrity that affect ten or so users before the problem was fixed. It has been gone for a long time. I don’t believe I have had to recommend current log deletion more than once or twice since then, and I always insure that is the problem first. It’s not a go-to fix-all solution.

You still have the ability to access all of that history directly from the IoTaWatt, and the new Graph+ application makes it easier and more useful. It’s in ALPHA now and should track quickly through BETA and MINOR.

I fully understand… It’s my own fault for randomly running commands without fully evaluating the potential impact.

I should have done more research and reach out prior to just running commands. Thanks for spending time on this and assisting. I’ll making use of the IoTaWatt unit for historic data.

Thanks again! :smiley: