Lots of errors with Virtual Feeds Emoncms 9.8.6

I ran the emonPi update on May 15. And today I just created a new virtual feed. But I am getting LOTS of these errors (below). This happens when creating a new virtual feed and with existing virtual feeds.

Request error 
Notice: Undefined variable: dbinputs in /var/www/emoncms/Modules/feed/engine/VirtualFeed.php on line 144
Notice: Undefined variable: nodeid in /var/www/emoncms/Modules/feed/engine/VirtualFeed.php on line 144
Notice: Undefined variable: name in /var/www/emoncms/Modules/feed/engine/VirtualFeed.php on line 144
Notice: Undefined variable: dbinputs in /var/www/emoncms/Modules/feed/engine/VirtualFeed.php on line 144
Notice: Undefined variable: nodeid in /var/www/emoncms/Modules/feed/engine/VirtualFeed.php on line 144

I tried with FireFox, Safari and Chrome and get the same error. This is with low-write 9.8.6 | 2017.05.10

EDIT: It looks like line 144 of VirtualFeed.php was updated ~10 weeks ago. I changed it back to the original line and all works as expected. I don’t understand the code update so I don’t want to make a change.

@nchaveiro & @Paul,

in March Line 144 of the Modules/feed/engine/VirtualFeed.php file was updated from:

$opt_timearray = array('start' => $t, 'end' => $tb, 'interval' => $interval);

to this:

$opt_timearray = array('start' => $t, 'end' => $tb, 'interval' => $interval, 'sourcetype' => processOriginType::VIRTUALFEED, 'sourceid'=>$dbinputs[$nodeid][$name]['id']);

As best I can tell the $dbinputs, $nodeid, $name variables are causing the hiccup within this area of the code:

'sourceid'=>$dbinputs[$nodeid][$name]['id']);

I am unable to find a reference to those variables. Can you assist?

1 Like

I’ve got the same error :frowning:
Is there any news on this issue?

@Jon I can confirm looking at the code that there is no definition of $dbinputs there. I did not develop or use virtual feeds so Im not 100% sure about the fix but it looks like it needs to load the dbinputs with the following line:

$dbinputs = $this->input->get_inputs($session['userid']);

If this is added as so on line 135 of VirtualFeed.php it might fix it:

    // Lets instantiate a new class of process so we can run many proceses recursively without interference
    global $session,$user;
    require_once "Modules/process/process_model.php";
    $process = new Process($this->mysqli,$this->input,$this->feed,$user->get_timezone($session['userid']));
    $dbinputs = $this->input->get_inputs($session['userid']);

@nchaveiro does this fix look ok to you?

Hi guys, I have the same problem as described by John. I’m using virtual feeds for graphs. Before updating it was O.K. Now, no virtual feeds work… :frowning: (Before update version 9.8.6., now 9.8.7)

Same here, updated yesterday and found the described problem afterwards.

Is there any resolution to this? It would be very helpful to have virtual feeds working again.

This should be fixed on 9.8.8.

Just to add 9.8.8 is currently on the master branch of emoncms (GitHub - emoncms/emoncms: Web-app for processing, logging and visualising energy, temperature and other environmental data) and will be merged into stable in the coming days - at which point a standard EmonPi update will download the changes.

If anyone familiar with git and command line would like to help with testing the master branch in the mean time please do.

Great. @jon could you checkout Emoncms master branch and confirm issue has been fixed with 9.8.8?

rpi-rw
cd /var/www/emoncms
git pull
git checkout master

then to go back to stable:

git checkout stable

will do!

EDIT: The issue above is fixed! Thank you @nchaveiro, @TrystanLea & @glyn.hudson. :slight_smile:

@TrystanLea & @glyn.hudson - The fix for virtual feeds (and 9.8.8) doesn’t look like it made it to from master branch to stable branch. Was there an issue with 9.8.8?? Something I can help test?

Sorry, It’s our fault. Never got round to releasing. It’s been done now, master branch has been merged into stable.

Here is the changelog for Emoncms core V9.8.8.

1 Like