Just churning some power usage data, via emoncms and looking at data on a ‘weekly bases’.
And from what I can see ‘Monday’, seems to be being used as the ‘start of a week’.
Can I change this to Sunday,. so as to align with other data, ( a physical meter reading ) I take every Sunday morning. I have I have checked forums, and emonPi i/f,.. but nothing jumps out at me..
Many Tx
Hello Mark, this is hardcoded at the moment e.g if you use the fixed interval timeseries engine PHPFina: emoncms/Modules/feed/engine/PHPFina.php at master · emoncms/emoncms · GitHub. You could modify this if it’s on your local emonPi if you want?
Hi Trystan,..Yes followed your hints,.. and all seems to work as expected, it might be nice to add this as a feature to be able to select week start day, in the admin section,.. but I do not appreciate what up stream issues this may cause.
Many Tx
Mark
For those wondering on details:- here is what I did.
On my Local emoncms,.. I navigated to:-/var/www/emoncms/Modules/feed/engine
made copy, then edited the PHPFina.php
file as follows:-
( with a simple substitution of Monday → Sunday on line 512 )
503 if (in_array($interval,array("weekly","daily","monthly","annual"))) {
504 $fixed_interval = false;
505 // align to day, month, year
506 $date = new DateTime();
507 $date->setTimezone(new DateTimeZone($timezone));
508 $date->setTimestamp($start);
509 $date->modify("midnight");
510 $modify = "+1 day";
511 if ($interval=="weekly") {
512 $date->modify("this Sunday");
513 $modify = "+1 week";
514 } elseif ($interval=="monthly") {
515 $date->modify("first day of this month");
516 $modify = "+1 month";
517 } elseif ($interval=="annual") {
518 $date->modify("first day of january this year");
519 $modify = "+1 year";
Just to note, you will have to manually update in future as GitHub will complain when you try and update.
IIRC, you will need to stash your changes, pull the new version, then pop your changes (unless something else is different in the file).
Ah Brian,.. tx for pointing that out,.. I was assuming (hoping) it it would just over-write when upgrading,.. but yes thinking about any locally modified files are kept… I recall some network updates (other machines) etc with locally updated files,.. keep/ delete /overwrite options at update..
So,.. for my limited knowledge what is my best option,.. force update and run a small ‘sed’ script,.. but how do I force an update for emoncms,..
sudo apt install emoncms -force (pls correct, or shoot me down as required)
Or something else?.. so that I may maintain the integrity of my install.
Many tx
emoncms is installed from GitHub via git
, not via APT
.
You will need to understand how git
works as it may be different for different changes.
Broadly, this post may help
I suggest you do some research on git
though.
Tx for the feedback Brian,.. I will do some homework..
Glad it worked, I vary rarely use the week interval so it’s not one that I’ve given that much attention to. The easiest place to break out the setting would be to the settings.ini file but that would only allow system wide settings and not be as useful for a hosted install such as emoncms.org.
Something to think about for future development!