SOLVED - The / input process broken on emoncms.org?

on emoncms.org  when I use the '/ input' process the form is left blank and it does nothing. bit of a showstopper right now for me. Just wondering if anyone else has see this? 

Eamonn

TrystanLea's picture

Re: SOLVED - The / input process broken on emoncms.org?

Will look into it

IanGibbons's picture

Re: SOLVED - The / input process broken on emoncms.org?

Hi Trystan,

It looks like the "/ input" processor (is that the right word?) is not implemented in the same way as the "+ input" processor.  The latter seems to add the current input value to value from another input.  Wheras the former seems to just divide the current value by the argument.

In other words "/ input" should probably just be "/".

To fix, add the following (adapted from add_input):

function divide_input($id, $time, $value)
{
  $result = db_query("SELECT value FROM input WHERE id = '$id'");
  $row = db_fetch_array($result);
 
  if($row['value'] > 0){
      return $value / $row['value'];
  }else{
      return null; // should this be null for a divide by zero?
  }
 
}

then change the $list[12] to:

  $list[12] = array(
    _("/ input"),
    ProcessArg::INPUTID,
    "divide_input",
    0,
    DataType::UNDEFINED
  );

None of this tested!

Regards

Ian

--

 

 

TrystanLea's picture

Re: SOLVED - The / input process broken on emoncms.org?

That's it Ian, great!

EnergyRnR's picture

Re: SOLVED - The / input process broken on emoncms.org?

Ian, thanks a lot for taking the time to look at this one. Eamonn

TrystanLea's picture

Re: SOLVED - The / input process broken on emoncms.org?

Correct / input is now on github, thanks Ian

logic's picture

Re: SOLVED - The / input process broken on emoncms.org?

Now that this / input function has been changed/corrected, it has made my temperature displays not work.

With the emonGLCD multiplying the temperature by 100, I used this / input with an arguement of 100 so that it displayed correctly on emoncms (also with additional temperatures via my emontx).  Is there another way of dividing my inputs by 100 in emoncms?

Dennis

Robert Wall's picture

Re: SOLVED - The / input process broken on emoncms.org?

Multiply by the reciprocal?  - It works for me    (  x 0.01  ).

logic's picture

Re: SOLVED - The / input process broken on emoncms.org?

Thanks Robert

Simple fix when there's a brain to figure it out ;)

Comment viewing options

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