Emoncms and water consumption - How?

Hello and thx from this nice software.

I get pulse from water meter after every 10l consumtion (I send every time single HTTP request to my emoncms server). This works fine and i can see times from realtime graph.

How i can make daily bar graph which shows whole day cumulative consumption?

How i can make hourly dial whick shows last 60min consumption?


TrystanLea's picture

Re: Emoncms and water consumption - How?

Hello Prelude, you could probably do this using the kwhinc to kwhd input processor as this is a daily suming of individual posts type processor.

The hourly dial would be a feature to add to the to do list, that will involve quite a bit of coding :)

Tommi76's picture

Re: Emoncms and water consumption - How?


I had a similar Problem.

I have a power meter (Ferraris Counter) and a gas meter which gives me counts (375 incs / kWh and 100 incs / m3).

Wanted to have incs to Power.

So i added some code in ..../emoncms3/Models/process_model.php:

At "function get_process_list()" i added:

  $list[20] = array(
    _("Wh_inc to Power"),

And added an new function:

// Wh_inc to Power

function wh_inc_to_power($feedid, $time_now, $value)
  $new_kwh = 0;

  // Get last value
  $last = get_feed_timevalue($feedid);
  $last_kwh = $last['value'];
  $last_time = strtotime($last['time']);

  if ($last_time)
    // Power calculation
    $time_elapsed = ($time_now - $last_time);
    $kwh_inc = ($value * 3.6 / $time_elapsed);
    $new_kwh = $kwh_inc;

  insert_feed_data($feedid, $time_now, $time_now, $new_kwh);

  return $value;

I hope its really so easy like i thougt.

When i send "......json={power:2.666}" i get the correct Power for every puls.

The 2.666 comes from 1000W / 375 incs per kWh.


Hope that helps!


filartrix's picture

Re: Emoncms and water consumption - How?

Hi all,

this function has not yet been implemented in current emoncms version, am I right?

I'm not very familiar with php, so I would prefer perform such operations in the perl script that reads the data from serial port? is this a good idea?



ukmoose's picture

Re: Emoncms and water consumption - How?

No the function is not part of the standard emoncms build.


The standard equipment uses arduino code (C) on the base stations or 

php on the server. If you know perl you will find that php is similar.

so if you are running your own emoncms have a go!


Comment viewing options

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