"allow positive" disappears after adding

I have an input displaying instantaneous and daily net import correctly. I am now trying to log positive values only so that I can record daily import from grid.

If I select "Allow Positive" and click add on the Inputs screen, then the process appears in the list and as an icon on the process list below the config section for a few seconds. Then the icon disappears, and the change is not saved.

 

This happens at least with

Allow Positve

Allow Negative

Reset to Zero.

 

But it allows me to add inputs and log to feeds, and kw to kwh without any issues. I havent tried the other processes.

 

is this a bug, or am I doing something incorrecly. I am using the low write version dated 13 August on an SD card, on a PI B+.

 

Cheers.

serbat's picture

Re: "allow positive" disappears after adding

it happens to me the same thing !!?

 

Saluti

bradtpt's picture

Re: "allow positive" disappears after adding

I'm running emonSD-13-08-14.img.zip on two separate installations and have found the same thing.  These features certainly appear to be broken/disabled in the low-write version.

I have managed to make these input processes work on this version by looking at /var/www/emoncms/Modules/input/process_model.php and looking up the numerical codes used in the sql tables to define the input processes.  The relevant ones here which we can't insert on the low-write version are:

24: Allow Positive

25: Allow Negative

33: Reset to zero

These can be manually entered into the processList field for your particular input under the inputs table in the sql database.  The easiest way to do this (for a beginner like me) is to install phpMyAdmin and edit the sql database interactively.  Previously I was achieving the functionality of "Reset to zero" by multiplying by 0, but with having solar I wanted to log import and export power separately so I really needed the "allow positive" and "allow negative" operations to work.  Thankfully, directly adding them to the process list using sql does the trick.  To insert a 'reset to zero' entry on an existing input of mine I had an input process list which looked like this:

1:93,4:94,2:0,11:11,11:15,1:115,4:116

This translates to:

1:93 - Log to feed 93

4:94 - Power to kWh log to feed 94

2:0 - Multiply by 0

11:11 - +input 11

11:15 - +input 15

1:115 - Log to feed 115

4:116 - Power to kWh log to feed 116

Replace the "multiply by zero" (2:0) with 33 and save in phpMyAdmin.  The modified process list becomes: 1:93,4:94,33,11:11,11:15,1:115,4:116

The low-write version uses the redis server to buffer data to reduce writes to the SD card, before this change will appear in your inputs back in emoncms you have to run  $ sudo redis-cli flushall (or wait until the redis server next writes to disk, could be a few seconds to several minutes depending on how full the buffer is). A look at the input process list for that input in emoncms now shows [=0] in place of the [x] which was there previously.  The same process applies to insert "allow positive and "allow negative".  The great thing is, once these entries are present in the process list, they can be manipulated as in their order in the process list changed through the web browser without issue.

I'd love to know why this doesn't work in the low write version natively, hopefully some of the more knowledgeable members can help here.

DavidW's picture

Re: "allow positive" disappears after adding

Hi,

I've just found the same issue. Glad to see there's a workaround. Thanks. :)

bradtpt wrote: The easiest way to do this (for a beginner like me) is to install phpMyAdmin and edit the sql database interactively

Pardon my ignorance (I'm a beginner too) but I think that means install phpMyAdmin on the rPi base (e.g. as per this tutorial I found, http://www.raspipress.com/2012/09/tutorial-install-phpmyadmin-on-your-ra...)?

Can you (or someone) please confirm?

bradtpt's picture

Re: "allow positive" disappears after adding

Hi David,

That is correct, the tutorial you linked above will get phpMyAdmin installed.  Then you can edit and change things in the SQL database to fix these little glitches.

DavidW's picture

Re: "allow positive" disappears after adding

Thanks for the confirmation. :)

pb66's picture

Re: "allow positive" disappears after adding

The only change that my untrained eye could see that could effect this was the addition of these "curly" brackets in  Modules/input/process_model.php, I'm not good with php but I can see the problematic processes all have "None" as $inputprocess[1] so maybe related as this is a v8.4 change to "low-write" emoncms only. 

if (isset($inputprocess[1])) {
$arg = $inputprocess[1];          // Can be value or feed id
 }

https://github.com/emoncms/emoncms/compare/v8.3.6...bufferedwrite#diff-61102ea5f198b440603234fbc9465ac5R107

​I don't have a "low-write" emoncms running at the moment to try removing the brackets to test.

DavidW's picture

Re: "allow positive" disappears after adding

The phpMyAdmin workaround worked a treat. :) All we need now is a some decent daylight to test the "allow negative" bit (there's barely enough light to wake up the inverter today, let alone reach export level).

In the interests of investigation I took a first look around the code. I'm more a C++ guy (& a Windows one at that), but looking in input_model.php.

public function add_process($process_class,$userid,$inputid,$processid,$arg)

has a line

$processtype = $process[1];   // Array position 1 is the processtype: VALUE, INPUT, FEED
 

However, the switch that follow tries to make use of 4 different values, VALUE, INPUTID, FEEDID and NONE.

I've managed to find that add_process is called from input_controller.php.

I'm not clear how the $process parameter in the call has been built up, but it does looks from the above as though the NONE concept might have been added to existing code, so maybe it's an avenue for some one more familiar with the code to check?

 

 

 

 

Comment viewing options

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