Upgrading

So I upgraded from the master to 8.5 and two things have changed that I can't figure out:

1. All of my feeds say they were last updated at "Nans ago". They do keep updating though.

2. All of my kWh feeds show the current value as 0.00. If I view the feed it is correctly updating and has the correct value, but will not show it in the feed list or in the dashboard anymore.

 

Any ideas?

 

Thanks,

Grim

mking007's picture

Re: Upgrading

Same problem here. The data is being added to the DB as I downloaded it - example below. Unix time stamps and a power reading....

Any ideas welcome.

1433947100 93
1433947110 92
1433947120 93
1433947130 92
1433947140 94
1433947160 93
1433947170 92
1433947180 92
1433947190 93
1433947200 93
1433947210 92
1433947220 92
1433947230 94
1433947240 93
1433947250 92
1433947260 93
1433947270 94
1433947280 93
1433947290 93
1433947300 94
1433947310 94
1433947320 92
1433947330 93

TrystanLea's picture

Re: Upgrading

I think it may be a browser cache issue using the old javascript, can you try reloading the page with a full refresh or forcing a browser cache clear?
 

mking007's picture

Re: Upgrading

Just tried @TrystanLea but no difference. 

Still getting updates for my feeds marked as "NaNs ago" even though the data is refreshing and saving to the feed DB. The unix time stamps seem ok too although they are out by an hour - I've checked it's Europe/London but will check again....

Unix TS     val   Time

1433968180 32 20:29:40
1433968190 32 20:29:50
1433968200 32 20:30:00
1433968210 32 20:30:10

Any other suggestions appreciated

mking007's picture

Re: Upgrading

I'm getting closer to isolating my problem, but not how to fix it. 

On the inputs page the updates field all works fine - showing the time.

It's on the feeds page that problems occur. Within <custom-table-fields.js> it's the following section that causes me a problem:

*************

// Calculate and color updated time
function list_format_updated(time)
{
 time = time * 1000;
  var now = (new Date()).getTime();
  var update = (new Date(time)).getTime();
  var lastupdate = (now-update)/1000;

  var secs = (now-update)/1000;
  var mins = secs/60;
  var hour = secs/3600

  var updated = update;//MJK mod this to debug. secs.toFixed(0)+"s ago";
*************

By moding the above code for the following variables then I am seeing the following behaviour:

time                      fine on inputs page                                        NaN on feeds page

now                      fine on inputs page                                        fine on feeds page

update                  fine on inputs page                                        NaN on feeds page

All of the above are unix time stamps when they display (i.e. if it isn't NaN)

So the feeds page can at least display a unix timestamp. It's just not displaying the passed time variable or the calculated update variable. Feels like something to do with timezones again....?

I'm a lapsed hacker, so if anyone has any insights from this I'd appreciate it.

 

pb66's picture

Re: Upgrading

"The unix time stamps seem ok too although they are out by an hour - I've checked it's Europe/London but will check again...."

Plus or minus?

I think are more than likely right about it being a timezone issue, Are you in the UK? What platform are you on? 

Is the host machines time correct? localtime or UTC?

Do you have a timezone set in emoncms ? Does changing the timezone have any effect (may take sometime to filter through)?

"All of the above are unix time stamps when they display (i.e. if it isn't NaN) 

So the feeds page can at least display a unix timestamp."

Just to confirm, do you mean it is correctly displayed but a UTC time or do you mean it is a unformatted timestamp (143??????) ?

Paul

mking007's picture

Re: Upgrading

Hi @pb66 and thanks for the help.

I'm in the UK and the emoncms installation is hosted in a shared LAMP environment also in the UK. I've only just moved to this hosting provider. My previous emoncms installation (and still running as I plan to port the data later) is on a personal debian linux server in my home office. The original emoncms is v8 in my environment and runs fine. The emoncms I am having this problem with is v 8.5 and is in a hosted environment.

Here's a link: http://www.innovys.co.uk/emoncms/feed/list

Without any mods to debug then this is what I see:

Inputs view                                     displays last updated: xs ago                   TICK

Feeds view                                     displays last updated: NaNs ago               CROSS (!)

If I mod <custom-table-fields.js> as follows:

*******

// Calculate and color updated time
function list_format_updated(time)
{
  var updated = time;//MJK secs.toFixed(0)+"s ago";

  time = time * 1000;
  var now = (new Date()).getTime();
  var update = (new Date(time)).getTime();
  var lastupdate = (now-update)/1000;

  var secs = (now-update)/1000;
  var mins = secs/60;
  var hour = secs/3600;

//  var updated = secs.toFixed(0)+"s ago";

*******

..then I see the following:

Inputs view                                     displays last updated: 1434019989                   TICK

Feeds view                                     displays last updated: 0000-00-00 00:00:00               CROSS (!)

So I'm getting a date format and also a zero value.

I'm trying to follow the code flow and work this back, but any pointers appreciated.....

Michael

mking007's picture

Re: Upgrading

A quick addendum. If I export the data for the feed then it's all there and looks fine: e.g. here are the last few rows:

1434020290 32
1434020300 32
1434020310 32
1434020320 32
1434020330 32
1434020340 32
1434020350 32
1434020360 32

 

pb66's picture

Re: Upgrading

Have you seen this "unix time instead of date string for last time-values" it has already been merged to emoncms v8.5 (9days ago is that pre or post your uprade?) but may give you some pointers where to look for issues, something like this block maybe not catching the variable still holding the old string time format that is causing your issue?

Paul

PS - You have no public access set up via that link

mking007's picture

Re: Upgrading

Hi Paul

Yes, I had seen that post and my installation is post that upgrade. I've just checked again manually and the changes are in my files.

Thanks for your steer on where to look. I'm going to keep trying to track it down and teach myself the joys of debugging PHP and JS! :P

Any further ideas still welcome. 

I'll post back here if / when I find out more or solve it.

Michael

mking007's picture

Re: Upgrading

I've been trying to fix this for 2 days but still non-plussed...I've done a fresh install of emoncms files to clear all my debugging attempts. 

The <updated> value for my feeds still shows "NaNs ago"

The <Last updated> value for my inputs page works fine and shows "13s ago" etc.for all of the inputs.

I've made my feeds public now:

http://www.innovys.co.uk/emoncms/feed/list

http://www.innovys.co.uk/emoncms/vis/auto?feedid=20

The actual data visible in the data viewer or via CSV export has the unix timestamps and values. 

So it only seems to be the feeds page presentation of the time that's screwed up. Puzzling.....

Any ideas appreciated....it's been driving me mad!

 

mking007's picture

Re: Upgrading

My problem seems to be driven from the process_model.php function below. When power_to_kwhd makes this call:

$last_slot = $this->getstartday($last_time);

....I am seeing a negative number being passed to the getstartday function: (-62169984000 fwiw)  which then causes getstartday to fail and a fatal error.

I'm still trying to understand the flow of all of this, but thought I'd post this update in case it triggered a thought in anyone else.

Corrupted database? Still timezone problems?

********

    public function power_to_kwhd($feedid, $time_now, $value)
    {
        $new_kwh = 0;

        // Get last value
        $last = $this->feed->get_timevalue($feedid);

        if (!isset($last['value'])) $last['value'] = 0;
        $last_kwh = $last['value']*1;
        $last_time = $last['time']*1;
        
        //$current_slot = floor($time_now / 86400) * 86400;
        //$last_slot = floor($last_time / 86400) * 86400;
        $current_slot = $this->getstartday($time_now);
        $last_slot = $this->getstartday($last_time);    

thamir_a's picture

Re: Upgrading

Hello Mking007,

Did you installed Redis on your server?

I have exactly the same issue, and i think the problem we can solve it by redis installation. Unfortunately, redis need to have some independence to be installed and shared servers are limited in regard of this.

Gerardo's picture

Re: Upgrading

Hello , I wanted to know if you solved this problem ? I installed version 8.4 of shared hosting and linux gives me the same error . What do you advise me to do? thanks
 

Grimshad's picture

Re: Upgrading

I gave up and switched back to the master 

Gerardo's picture

Re: Upgrading

the master is 8.4 ? and gives me the error .

sending power in timestamp , the kwh / d is zero or negative value.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.