Gauge and feed value not showing after update 9.8.3-->9.8.30

Hi,
I’ve just updated from version 9.8.3 to 9.8.30
Updating went smoothly everything looked ok.

But I can’t see the Gauge, feed value, sun and cylinder widget on the dashboard if i’m not logged in (it works fine if I’m logged in)

In this case the browser console logs a lot of

jgauge_render.js:48 Review config for feed id of jgauge
3feedvalue_render.js:253 Review config for feed id of feedvalue

Also (not sure if this is the same problem or an other one) in the browser network monitor I’m seeing the following error for requests goint to feed/list.json?userid=1:

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone ()' in /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/process/process_processlist.php:961 Stack trace: #0 /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/process/process_processlist.php(961): DateTimeZone->__construct('') 
#1 [internal function]: Process_ProcessList->getstartday(1528373449, Object(Process)) 
#2 /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/process/process_model.php(62): call_user_func_array(Array, Array) 
#3 /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/feed/engine/VirtualFeed.php(81): Process->__call('process__getsta...', Array) 
#4 /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/feed/engine/VirtualFeed.php(81): Process->process__getstartday(1528373449) 
#5 /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/feed/feed_model.php(351): VirtualFeed->lastvalue(' in /var/www/vhosts/MY_SERVER/httpdocs/statistic/Modules/process/process_processlist.php on line 961

(I’ve removed the real name and replaced it with “MY_SERVER” in the error texts above)

There’s a similar topic here, but it never got a response https://community.openenergymonitor.org/t/dial-and-gauge-dont-showing/5521

Can someone please help?
All components (emoncms, dashboard, …) were freshly clones 2 hours ago.

Have you set a (correct) timezone in the user account?

The way TZ are represented has changed at some point, I do not know off hand if that’s since 9.8.3 or before then so just try re-selecting your TZ.

Also, have you run the “update and check” database tables from the admin page since updating?

Was everything working ok immediately before updating today?

Hi,
thanks for the reply.
Yes, everything worked fine before the update and I’ve also updated the database.

I’ve tried to reset the timezone for my user, but this had no effect since everything is working fine as long as I’m logged in.
The problem only occures if I’m not logged in.

I’ve now hardcoded the timezone in the file process_processlist.php (Line 961) to $now->setTimezone(new DateTimeZone('Europe/London')); an suddenly my dashboard is working again.

My assumtion: there is no timezone set for an anonymous user since there’s no user account. (fallback missing?)

Yes you are right, the timezone is inherited from it’s parent, in this case the VirtualFeed.php. the getstartofday() function is called from line 81 after it has tried to get the timezone in line 78

I suspect you are right in that there may not be a $session due to not being logged in, but the userid can be determined from the dashboard or the feeds etc, even if the dash was public (rather than using an apikey) the users (account user) timezone could be determined.

I have many account for various clients that are almost identical so my emoncms server displays the full account name (not the user name) on the nav bar even when navigating public dashboards without an apikey OR logged in user session.

This fits in nicely with another discussion I’ve had recently where a some of us think the timezone of any dashboard or visualization should be determined from the account (ie the geographical location and therefore the timezone) of the property being monitored (certainly in the case of home energy monitoring at least).

I think this might be occurring for you because you have Virtual Feeds with Daily totals that need an account TZ to work, other visualisations just use the browser TZ, (see Timezone in EmonCMS) .

Perhaps @nchaveiro or @TrystanLea can offer some wise words?

I’ve removed the hardcoded value “Europe/London” again and instead modified process_model.php Line 46:
Old: if (!($timezone === NULL)) $this->timezone = $timezone;
New: if (!($timezone === NULL && $timezone != '')) $this->timezone = $timezone;
Which nicely prevents the overwriting of the defualt value UTC with an empty string.
Should I create a pull request for this?