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.
image

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.

{“1”:{“time”:1634255960,“value”:0,“processList”:“1:3,35:emon/IotaWatt/HouseVoltage,2:2,1:1”},“2”:{“time”:1634255960,“value”:0,“processList”:""},“3”:{“time”:1634255960,“value”:0,“processList”:“11:20,29:88,1:2,5:94,35:emon/IotaWatt/HouseUseTotal,30:79,35:emon/IotaWatt/SolarExcess,1:91,24:,1:82,4:83,5:92,37:,11:20,29:88,30:82,1:96,24:,5:95,37:,11:20,29:88,30:79,25:,1:97,2:-1,5:98”},“4”:{“time”:1634255960,“value”:0,“processList”:“1:4”},“5”:{“time”:null,“value”:null,“processList”:""},“6”:{“time”:null,“value”:null,“processList”:“11:23,1:5”},“7”:{“time”:null,“value”:null,“processList”:""},“8”:{“time”:null,“value”:null,“processList”:“11:25,1:6,4:68”},“9”:{“time”:null,“value”:null,“processList”:“1:7”},“12”:{“time”:null,“value”:null,“processList”:“1:8”},“13”:{“time”:null,“value”:null,“processList”:“1:9”},“14”:{“time”:null,“value”:null,“processList”:""},“15”:{“time”:null,“value”:null,“processList”:“11:30,1:10”},“16”:{“time”:null,“value”:null,“processList”:“1:11”},“17”:{“time”:null,“value”:null,“processList”:“1:12”},“18”:{“time”:null,“value”:null,“processList”:“1:13”},“19”:{“time”:null,“value”:null,“processList”:“1:14”},“20”:{“time”:null,“value”:null,“processList”:“1:15”},“21”:{“time”:null,“value”:null,“processList”:“1:16”},“22”:{“time”:null,“value”:null,“processList”:“1:17”},“23”:{“time”:null,“value”:null,“processList”:“1:18,29:102,8:19,37:,29:89,2:0.001,14:66”},“24”:{“time”:null,“value”:null,“processList”:“1:21”},“25”:{“time”:null,“value”:null,“processList”:“1:22”},“26”:{“time”:null,“value”:null,“processList”:“1:23,8:24,37:,2:0.001,14:67”},“27”:{“time”:null,“value”:null,“processList”:“1:47”},“SolarExcess”:{“time”:1636421269,“value”:7.9200000762939,“processList”:""},“HouseUseTotal”:{“time”:1636421269,“value”:7.9200000762939,“processList”:""},“SolarGenTotal”:{“time”:1636421278,“value”:0,“processList”:""},“HouseVoltage”:{“time”:1636421269,“value”:0,“processList”:""}}

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

/input/get?node=yournode&apikey=yourkey

The time you gave above is
image

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