Hi,
As per the subject, I have noticed my feeds that use a process “Power to kWh/d” rollover back to zero, but only do so at 1 AM and not midnight.
Time zone of my user account is set to “Europe/London”, which is now using DST since the weekend. Previous to this, feeds rolled over correctly at midnight, but since the change-over, it seems any process of the type “Power to kWh/d” is still internally referencing UTC.
I have a schedule setup to flag day an night rates, and this works fine and as expected, accounting for DST. in this graph, I show my night rate cost, which starts increasing at midnight (per my schedule and is correct), but then at 1 AM it resets to zero, and starts counting up again…
That graph looks like it comes from HomeAssist ? So you might need to check the time/zone/settings and or synchronisation between your EmonCMS system and your HA system ?? Maybe?
Given your sending feed data across ? Just a suggestion
Hi @muzza , it did come from HA yes, it was just easier to screenshot it there. The “Power to kWh/d” processing is still done in my emonPI and then pushed out to via MQTT. The exact same reset at 1am pattern can be seen in the native graphs in emon…and to confirm, both my emonpi and my HA box are set to “Europe/London”. The resetting is being done in the emonpi somewhere…but I cant find exactly where or why yet…
OK, so try this:
ssh into your emonpi
and issue: timedatectl status
What do you see?
For example I get this…
pi@emonpi:~ $ timedatectl status
Local time: Thu 2024-04-04 10:48:59 AEDT
Universal time: Wed 2024-04-03 23:48:59 UTC
RTC time: n/a
Time zone: Australia/Melbourne (AEDT, +1100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
I set my timezone on the emonpi with:
sudo raspi-config
then select: Option 5 (Localisation)
and then: L2 TimeZone
pi@emonpi:~ $ timedatectl status
Local time: Thu 2024-04-04 01:34:44 BST
Universal time: Thu 2024-04-04 00:34:44 UTC
RTC time: n/a
Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
and here is a portion of one of my input/feed processing chains. Any feed that is created via the Power to kWh/d processor is resetting at 1AM BST / Midnight UTC:
To confirm, I am on daylight saving time and my kWhd feeds are resetting ok at midnight here (Aus).
And next Sunday we return to ‘standard’ time … so will keep an eye on this …
Time is a wonderful thing! We have had loads of issues with this in the past.
Firstly, all data is stored as UTC within the emoncms system, when you view that data, it gets converted by the viewer to the Browser (local machine) time.
In emoncms, if you look at the UNIX Timestamp in the data, what time does that integer convert to?
Cheers - so I picked a random feed that resets at midnight, and it went back to zero at 1714431600, which was 11pm UTC and Midnight in “Europe/London”, so that’s all good… but a good way to check this, thank you.
So I should have updated this post a while ago, I think I have fixed my issue. However, and admittedly a bit stupidly , I changed three things at once, now I need to figure out which one fixed it… I rebooted the system (coz that always helps), I performed the in-place github pull full update on the admin page (although I do this reasonably often, it was no more than 5 or 6 weeks out in any case), and then I also found the file ‘/etc/php/7.3/apache2/php.ini’ actually had the entry “date.timezone " line commented out, so I set it to “date.timezone = Europe/London”.
And now it works…I can undo the php.ini file change as a test to see if it goes wrong again…