input process return value not the real value?

Hi

So I've been tinking with emoncms for a while now.

Question for emoncms developers - why don't input processes, actually return the result of processing back? Like they are supposed to?

I've created an accumulator_hourly function, that basically accumulates data on an hourly basis.

The plan was to feed in kwh, to this, to then get an idea of power user per hour ---

I was always getting strange results. Doing some debugging, I found this, in power_to_kwh - it always returns power?

ie:

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

...$this->feed->insert_data($feedid, $time_now, $time_now, $new_kwh);

return $value

I change it to -

$this->feed->insert_data($feedid, $time_now, $time_now, $new_kwh);

        return $new_kwh;

 

Am i missing something?

 

Sean

 

 

Schism's picture

Re: input process return value not the real value?

They are inconsistent. The use cases are complex. Suppose you want to log to two accumulators with the second covered by a logic condition - it's not possible because the first accumulator returns the total value, so you can't add it to the second (without a bit of fancy footwork). At the same time, if the accumulator didn't return the new total, it wouldn't be possible to feed it into a daily aggregate feed.

Comment viewing options

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