IotaWatt EmonCMS upload issue

When I migrated my EmonCMS over to a new server I performed a backup and import. The problem I’m having is with IotaWatt picking back up from that time I stopped it. Since a picture is worth a thousand words I will post it below.

So, I stopped IotaWatt and ran a backup in EmonCMS. Migrated over to the new device and imported the backup. I expected IotaWatt to pickup from that moment and load the missing data, but from the picture above it didn’t. I’ve been attempting to fix this by stopping IotaWatt and running the HTTP://[IP]/input/post?time=1634255970&node=[node]&csv=0,0,0,0 to attempt to get it to start right at the stop point of the data. I’ve modified the Unix time stamp to either start right at the last posting or even 5 seconds ahead to no avail. No matter what I do IotaWatt keeps basically picking up from when I stopped it and moving forward. So, now my gap is huge.

I think the switchover can be done seamlessly, but it is tricky. When you stop the uploader, it will always do a query when it restarts, so Emoncms must be setup to respond with the desired last input time.

With a local Emoncms instance, I don’t believe the inputs are restored. So when IoTaWatt queries for time of last input, it doesn’t get the correct date/time. By doing the manual post, you do set the input time, but I think the damage was already done in that IoTaWatt had already resumed from the current time.

After that, I’m not sure exactly what happens. Either you didn’t set all of the inputs (IoTaWatt looks for the most recent) or it did restart at the desired date/time but Emoncms threw away the updates because they were older than the most recent feed entries.

Long story short, I think you need to very carefully:

  • Stop the IoTaWatt Emoncms uploader.
  • Restore the Emoncms database again
  • Restart Emoncms (I’d reboot the host)
  • Run the input/post transaction
  • Run an input/get transaction for the node and be sure the times are correct
  • Start the IoTaWatt uploader

No shortcuts.

Can certainly do all of that, the only part I’m fuzzy with is the get transaction command.

Also, if the times are not correct on EmonCMS. I would figure if that’s the case I’m kind of screwed in that I will have to remove the inputs, correct?

Scratch that, figured out the input/get. My input was 1634255970 using the command above, the output shows.


It would appear that some of the values are coming back with today’s date at the bottom there.


The time you gave above is

It looks like you stop a little before that, so you may want to check it. If you give me your timezone and the time you want to resume, I’ll give you the correct UNIXtime.

You cannot go back from that time. So yeah - square one again.

Well, a follow on. Tried it again but this time I didn’t set the time and just ran the GET command. All times in the output were NULL. Figured I would just set the start time for the upload and see what happens. When I started IotaWatt it began to upload right from when I set it in IotaWatt. Looks like it’s backfilling the missing data as expected this time and removing the gap.

1 Like