Add 2 or more feeds together on EmonCMS and display the result

Is there a way of adding and subtracting one of more fields together in EmonCMS and displaying the result? I've tried various options but they don't seem to work out. I would like to display as one value:

Incoming Grid Power Plus Solar Power LESS Power diverted to HWC and Spa pool. In other words

CT1 + CT2 - CT3 - CT4

I can see the + Feed function but I can't get it to work with another feed.

TimSmall's picture

Re: Add 2 or more feeds together on EmonCMS and display the result

You can create a separate feed for this by adding additional operations to an input and then placing the result in a separate feed.

e.g. on the CT1 input, edit so that after the first "log to feed" add in:

add input CT2, 

subtract add input CT3, 

subtract add input CT4, 

log to feed myNewFeed

Along similar lines, i​t would be nice to have more flexi display options which will do this tho'.

e.g. I'd like to be able to show two bars next to each other e.g.

Left show total supply:

Grid with solar stacked on top

On the right show usage breakdown e.g. something like a multi-part stack showing:

Upstairs sockets,  Kitchen, Lighting, everything else (i.e. the sum of the left bar, minus the three things which I'm specifically tracking) - all stacked on top of each other.

You could do something like this using the technique I outlined above, but it would create loads of otherwise meaningless feeds, and really sounds like a job for a GUI element instead (As a one-off, I was thinking of creating a bit of javascript to do that by getting the required data using JSON, and then processing it on the web page).

Hopefully I've just missed some cunning/obvious way of doing this, and there will be someone who actually knows what they're doing along in a minute to put me straight!

sheppy's picture

Re: Add 2 or more feeds together on EmonCMS and display the result

I got it working thanks.

I added it to the existing grid feed on the next line down so it now reads:

1 Log to Feed (Node:10:Grid)

2 Power to KWh (Node:10:Grid KWh)

3 +input (Node 10:2)

4 + 31 (to get around after dark solar inverter noise)

5 Log to Feed (Node:10:total)

 

I tried using a spare input but it locked up the input updating until I deleted it

Comment viewing options

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