Setting clock on EmonPi


I’ve bought an EmonPi to monitor the output of my solar panels. It has been running it on my desk for a few days while I waited for an electrician to come and install it. While it was running on my desk, it was showing the correct time. Now that the electrician has installed it, the EmonPi’s clock, is about 8 hours slow (2:16am when it should be 10:10am). How do I reset the clock? I’ve tried rebooting the unit, and I’ve checked that time zone is set to UTC in the local EmonCMS.

I’m running the latest SD card, EmonSD-03May16. The incorrect time is shown on the front panel display and on the log page of EmonCMS. The feeds on the local EmonCMS are being logged at the incorrect time, but feeds on are working correctly.

Did the emonPi have an internet connection when it booted up? It should get time from NTP. If not follow the steps in the troubleshooting section of the user guide:

Assuming Pi has got internet connection, connecting via ssh then running the following should do the trick to trigger an NTP update.

$ sudo service ntp restart

1 Like

Hi Glyn,

Thanks for the link to the user guide, I should have been able to find that myself before asking.

I’ve tried using Putty to log in with ssh, but nothing happens after I type in the password and press enter. If I enter the wrong password I get the error message “access denied”, but with the correct password it doesn’t do anything at all - there’s no message to say that the connection has been closed, and nothing is displayed in the Putty window.

I didn’t have Putty installed on this laptop before, so all the settings are still on their defaults.

The emoncms timezone is only relative to emoncms and should be set to a local timezone rather than UTC, but that won’t effect the Pi’s time or timezone.

When you ssh in with putty and enter the correct password you should see something like this

Once at the command prompt you can type your commands eg

to check the Pi’s time, date and timezone you can use the date command eg

[email protected]:~ $ date
Tue  6 Dec 12:39:19 UTC 2016

To change the Pi’s timezone you can use raspi-config eg

sudo raspi-config

using the menu go through “internationalisation options” and then “change timezone”, make your selection, once you exit you should see something like

[email protected]:~ $ sudo raspi-config

Current default time zone: 'Etc/UTC'
Local time is now:      Tue Dec  6 12:41:46 UTC 2016.
Universal Time is now:  Tue Dec  6 12:41:46 UTC 2016.

Current default time zone: 'Europe/London'
Local time is now:      Tue Dec  6 12:42:20 GMT 2016.
Universal Time is now:  Tue Dec  6 12:42:20 UTC 2016.

To force the Pi to correct it’s time automatically you can use

sudo ntpd -qg

at any point you can use the date command again to confirm the changes have been made.

The ssh password and instructions are in the ‘Service Credentials’ section of the user guide:

Hi Glyn,

Thanks very much for the help. I’ve just tried logging in again, and this time it worked as expected and I was able to set the date from the command line.