Change Logging Interval (PHPFINA)

Is it possible to change the logging interval that’s already been setup on feeds?
Reason is that my feeds are already 90Mb on my system that’s been running for three months and I’m struggling to backup, ie its not backing up.


Have you found a way to reduce the interval? I am asking myself the very same question.

It’s not possible to change an existing feed, due to the way the database is organised. You can read how it works in Learn→Electricity Monitoring→Timeseries
The clue is in the name – FI = Fixed Interval. In short, the interval is fixed and the starting time recorded in the metadata when the database is created, thereafter the time is calculated from the start time and the number of records.

1 Like

Hello @Ecoterrien it’s been on my list to look at this. There is a script in the usefulscripts directory that does this developed by @mattjgalloway. I haven’t tested it recently so cant be sure it will work. Assuming you have a relatively new system with the new directory structure.

Looking through the code you will need to change line 9 from:

$dir = "/var/lib/phpfina/";


$dir = "/var/opt/emoncms/phpfina/";

and then run the script (already installed on the pi) with:

sudo php /opt/emoncms/modules/usefulscripts/phpfina_convert_interval.php -i feedid -n newinterval

Here’s the script source code:
usefulscripts/phpfina_convert_interval.php at master · emoncms/usefulscripts · GitHub

You may want to backup your data first just in case something goes wrong.

1 Like