Possible to rewrite/rebase PHPFINA files?

I have been logging, but ignoring, energy data for several years. I just started trying to use the data in Home Assistant, but noticed that my energy feeds are really odd. While the deltas between data points are correct, the starting point of each file is not zero, so my current values are all really large negative or positive numbers. For example, my Air Conditioner is currently showing -300920543 KWh. After an update, the new value is -300920508 KWh – so it’s moving in the correct direction. If I graph it and go to the very first data point from back in 2015, it is -303004704 KWh.

If this was rrd, I could use rrddump to dump the data, pipe it into a script to rebase the starting value to zero, and recreate the file. Is there a way to do something similar with PHPFINA? Or if it stores the deltas, is there a way to fix the starting value in each file?

Thanks!

Hello @sjthespian , yes you should be able to use the emoncms postprocessing module to do this, it has a process for adding an offset called offset feed, you should be able to enter a suitable value and it will adjust each datapoint accordingly. It’s available under the setup menu. Let me known if you need any more pointers on getting this to work

@TrystanLea I finally have some time to dig into this, and I sort-of have it working… I was able to create an offsetfeed process for one of my feeds and it looks like it creates a new feed. However, I can’t find that feed anywhere in the filesystem, does it only exist in redis?

My hope was that I could just replace the original feed file with the one that the postprocess creates, but that doesn’t appear to be the case. Is there a way for me to update the original file with the data from the postprocessor?

Never mind - I figured it out (I just stared at the process output a bit more and it made sense). The name I was using was just a name, the actual file names were 112.dat and 112.meta.

offsetfeed
**input:**89:Air Conditioner 240V Energy
**offset:**300754496
**output:**112:89-fix
54 points behind

1 Like

Great to hear that you got this sorted @sjthespian did you replace the files?

I ended up not needing to. Eventually, the Home Assistant Energy module caught up since it is only interested in the deltas. I may eventually go through the effort of replacing all of my feeds, but for now I’m just going to leave it as is rather than risking breaking anything.