Feeds stopped working after firmware and emoncms upgrade

Hi Trystan, could you provide me some basic steps how to get the results from emoncms/feed/list.json ?
I cannot find a way to download that through the administration section of emoncms. Do I have to get this data through SSH?

SSH is not needed. Go to the Feeds web page. Then add .json to the URL.

Mine is:

http://emonpi.localdomain/emoncms/feed/list

becomes:

http://emonpi.localdomain/emoncms/feed/list.json

Thanks Jon

results are:

Fatal error: Uncaught exception ‘Exception’ with message ‘DateTimeZone::__construct(): Unknown or bad timezone ()’ in /var/www/emoncms/Modules/schedule/schedule_model.php:194 Stack trace: #0 /var/www/emoncms/Modules/schedule/schedule_model.php(194): DateTimeZone->__construct(’’) #1 /var/www/emoncms/Modules/schedule/schedule_model.php(147): Schedule->match_engine(NULL, NULL, ‘1501941600’, false) #2 /var/www/emoncms/Modules/schedule/schedule_processlist.php(54): Schedule->match(‘2’, ‘1501941600’) #3 [internal function]: Schedule_ProcessList->if_not_schedule_zero(‘2’, ‘1501941600’, 2926.8198762981, Array, Object(Process)) #4 /var/www/emoncms/Modules/process/process_model.php(60): call_user_func_array(Array, Array) #5 /var/www/emoncms/Modules/process/process_model.php(103): Process->__call(‘schedule__if_no…’, Array) #6 /var/www/emoncms/Modules/process/process_model.php(103): Process->schedule__if_not_schedule_zero(‘2’, ‘1501941600’, 2926.8198762981, Array) #7 /var/www/emoncms/Modules/feed/engine/VirtualFeed.php(84): Process in /var/www/emoncms/Modules/schedule/schedule_model.php on line 194

Thanks @philip, the quick fix might be to set your timezone in the emoncms account profile page.
You can do this by going to Setup > My Account and selecting your timezone from the dropdown menu.

We will look into the error and how to catch it so that it fails more graciously (if it is the result of a missing timezone setting) in the mean-time.

hmm, I have checked the time zone and it is correct and not missing. I have changed it to a similar time zone, rebooted and checked the feeds but the problem is still there.
I think it is not that the timezone is missing but maybe it has the wrong format or something else. The json file still shows the same error…

Please could you try and run emonPi update again? We have just made a stable release of Emoncms V9.8.8 which should have fixed this issue.

See discussion on this thread on this thread:

ok, I have done emonpi update to version 9.8.8, rebooted and have the same problem with the feeds page trying to load. I get the same json error below on the feed page. I did have virtual feeds before but I think my problem is slightly different to that of the other forum topic.
It seems for others the virtual feeds stopped working but normal feeds were ok. In my case both normal and virtual feeds will not display on the feeds page.
I am thinking maybe the best way is to do a fresh install of the latest version. What would be the best way to do that? I think something got corrupted and it might take a long time to work out what it actually is.

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone ()' in /var/www/emoncms/Modules/schedule/schedule_model.php:194 Stack trace: #0 /var/www/emoncms/Modules/schedule/schedule_model.php(194): DateTimeZone->__construct('') #1 /var/www/emoncms/Modules/schedule/schedule_model.php(147): Schedule->match_engine(NULL, NULL, '1502114400', false) #2 /var/www/emoncms/Modules/schedule/schedule_processlist.php(54): Schedule->match('2', '1502114400') #3 [internal function]: Schedule_ProcessList->if_not_schedule_zero('2', '1502114400', 2930.4362792969, Array, Object(Process)) #4 /var/www/emoncms/Modules/process/process_model.php(60): call_user_func_array(Array, Array) #5 /var/www/emoncms/Modules/process/process_model.php(103): Process->__call('schedule__if_no...', Array) #6 /var/www/emoncms/Modules/process/process_model.php(103): Process->schedule__if_not_schedule_zero('2', '1502114400', 2930.4362792969, Array) #7 /var/www/emoncms/Modules/feed/engine/VirtualFeed.php(84): Process in /var/www/emoncms/Modules/schedule/schedule_model.php on line 194

Any Idea? Anyone?

Hi Trystan, I have posted the results and error logs. Do you have any idea how to fix it or should I just do a fresh installation? If so, how to do it?

regards,

Philip

I’m not one of the experts but I was wondering if you had checked two places for timezones?

One is in the Setup > My Account and then look for Timezone:

And the other timezone is confirmed via SSH and then at the prompt type in date.

pi@emonpi(ro):~$ date
Mon Aug 14 21:30:31 CDT 2017

 

If the timezone abbreviation is wrong it can be fixed with:

pi@emonpi(rw):~$ sudo raspi-config

Current default time zone: 'America/Chicago'
Local time is now:      Mon Aug 14 21:50:42 CDT 2017.
Universal Time is now:  Tue Aug 15 02:50:42 UTC 2017.

then:

  • 4 Localisation Options
  • I2 Change Timezone

To set time or fix timezone:

 
Sorry you’re going thru all of this. It shouldn’t be this hard!

Thanks Jon for your reply. I have checked my date in my account in emoncms and the timezone is correct. I am trying to check by SSH and now having problems logging in via SSH.

I am using putty with username: pi and password raspberry

I managed to login before but not it gives me error that authorization failed.

Is there a new password to login via SSH?
If I can do that , then the fault might be there is a timezone mismatch between emoncms and the firmware.

Hello philip, the password should be emonpi2016

@philip Do you have any schedules in Extras > Schedules ? Could you try rebuilding them to see if the issue is related to a configuration there?

ok, managed to login via SSH

checked the time settings as per Jon,

The current time is incorrect on emonpi

Emoncms local time (GMT +10) this is correct time

Emonpi via SSH time: Tue 15 Aug 11:26:59 UTC 2017 (this is incorrect time zone)

I have tried to update the time zone as per Jon’s instructions and then after I select everything and confirm , I get the below error:

“There was an error running option I2 Change Timezones”

I have no schedules setup.

image

Hi

Did you put sd card in writable mode? rpi-rw

thanks Ian. I forgot to make the file system writable. Anyhow, I managed to chang the time via SSH. It now matches and both times are synchronized
I rebooted but still cannot see the feeds page as it has the same problem.

I checked the json file out put and it seems to be the same error relating to the time zones.

json file output:

Fatal error: Uncaught exception ‘Exception’ with message ‘DateTimeZone::__construct(): Unknown or bad timezone ()’ in /var/www/emoncms/Modules/schedule/schedule_model.php:194 Stack trace: #0 /var/www/emoncms/Modules/schedule/schedule_model.php(194): DateTimeZone->__construct(’’) #1 /var/www/emoncms/Modules/schedule/schedule_model.php(147): Schedule->match_engine(NULL, NULL, ‘1502719200’, false) #2 /var/www/emoncms/Modules/schedule/schedule_processlist.php(54): Schedule->match(‘2’, ‘1502719200’) #3 [internal function]: Schedule_ProcessList->if_not_schedule_zero(‘2’, ‘1502719200’, 2979.4113769531, Array, Object(Process)) #4 /var/www/emoncms/Modules/process/process_model.php(60): call_user_func_array(Array, Array) #5 /var/www/emoncms/Modules/process/process_model.php(103): Process->__call(‘schedule__if_no…’, Array) #6 /var/www/emoncms/Modules/process/process_model.php(103): Process->schedule__if_not_schedule_zero(‘2’, ‘1502719200’, 2979.4113769531, Array) #7 /var/www/emoncms/Modules/feed/engine/VirtualFeed.php(84): Process in /var/www/emoncms/Modules/schedule/schedule_model.php on line 194

O dear!

@nchaveiro do you have any ideas?

From the error it looks like that schedule with id 2 got a NULL timezone.
Don’t know how it may happen from an upgrade, the setting is on the database. Corrupt database?
Schedules inherit the timezone of the user that last edited it.
Try to make any change to the schedule, save then revert and save again, it should update the database again.

Ok, I created a new schedule with expresion: Mon-Fri | 00:00-23:59 , saved it and viewed it . It displays message “schedule expression returned true” and some additional data. So it seems the schedule is working fine. I have rebooted and then checked the feeds page but have the same problem.

I think you are right about the database being corrupted. Is there a way I can reset the database back to default settings and I can start over again?
I think that to find the exact problem might take some time and it might be easier to just reset the whole emonpi back to factory settings with old firmware and then do the update to latest version. After that I can then create the feeds and it should be ok from there.

But did you try to edit the existing schedule that is giving the problem as i said?