Meter kwh countdown

Hi

I want to track my meters kwh left. What I think should happen is that I input a value from the dashboard into a input or feed [is this possible?] - lets call it unitsLeft. Then as I use power from the total kwh feed, it gets subtracted from unitsLeft. 

Once units left drops below a threshold, the event module is to send an email of the low units.

 

How do I manually update a input or feed from the dashboard?

How do i subtract power used in total kwh from unitsLeft?

 

thanks

Jason

pb66's picture

Re: Meter kwh countdown

Hi Jason

Although there isn't a specific process to do what you want nor is there an input method to use in a dashboard built in, however you should be able to do something along those lines.

Firstly you need to set up a chain of processes in the "total power" input page to switch the input value to a negative so it subtracts some thing like

reset to zero
add input "total power"
x -1
Power to kWh "unitsLeft" phpfina 5secs

Then to add the unitsLeft balance to countdown from you can use something like

http://emoncms_url/input/post.json?node=2&json={unitsNow:123.45}

to add 123.45Kw/h from any logged in browser or if not logged in add

&apikey=xxxxxxxxxxxxxxxxxxxxxxxxxx

After using for the first time a new node and input will appear in the inputs page and to this input you should add one process tp use the existing feed you have not long set up.

log to feed "unitsLeft"

What this should give you is a feed called "unitsLeft" in Kwh, that is being continually reduced by the "total" power in watts and can be topped up to any amount at any time by using the url above to adjust the "unitsNow" Kwh value.

hope this helps

Paul

nubble's picture

Re: Meter kwh countdown

Hi,

Thanks for the reply. This makes sense to me and I have the first couple of items going:

processing on the total input:

reset to zero, add input 'total', x -1, power to kwh [unitsNow]

I also got the creation of the unitsLeft input via json going using what you suggested: http://emoncms_url/input/post.json?node=2&json={unitsLeft:123.45}

Since I am using MQTT as the backbone for my entire architecture, I will use Openhab to update the unitsLeft, and publish it as MQTT which becomes an input into emoncms via the mqttwarn script.

What I dont get is the last part of what youre saying: "you should add one process tp use the existing feed you have not long set up.

log to feed "units""

So now I have the 'manual' input of unitsLeft, and I have a feed coming from the 'total' input called 'unitsNow' that is negative.

Whats missing is where the unitsLeft =unitsLeft+(-unitsNow)

What i tried was processing on the 'unitsLeft' input:

+feed(unitsNow), log to Feed

but this doesnt work as the input is seldomly updated manually [say once a month], and Im guessing input processing doesnt run unless in the input is updated.

Thanks in advance

Jason

 

 

pb66's picture

Re: Meter kwh countdown

Hi Jason

You seem have used the names the other way round to me, which doesn't matter in operation but this discussion may become a little confusing, for the moment I shall use valueA and valueB instead so there is no implied term.

So you have added "valueA" feed to the "total power" input processing, which is constantly being reduced by the negative "total power" and you have created a new node with an input called "valueB" using the json api url, good.

The input processing for the new input "valueB" should just be one item log-to-feed "valueA".

As you correctly note this process will only be updated when the input is updated. So when you update "valueB" via mqtt or url etc to the "newly topped up total kwh available" you are directly adjusting the "valueA" feed that is being reduced each time the "total power" input changes.

Therefore the subtraction is done automatically.

Paul

nubble's picture

Re: Meter kwh countdown

Hi Paul, 

Thanks for this. It works now and I have my kwh counting down in the feed UnitsNow. I myself was going to change the names but I have to delete the input and start from scratch as in 8.3.5 I cannot edit input processing.

I need to get my head wrapped around input processing.

Thanks again.

pb66's picture

Re: Meter kwh countdown

Yeah, I saw your post about the "process list problem" and didn't have anything more to offer I thought that issue was resolved, have you definitely cleared the browser cache ? I had very odd results for a while after the fix but they eventually cleared.

If you have done the fixes try logging in from a completely different machine (work pc, netbook smartphone etc) or at least browser and see if you get the same results. As it's odd only you appear to still have the issue and on 2 installs, that can't be a coincidence surely.

Paul

Comment viewing options

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