Power Arithmetic plugin

Ok, sadly this was my fault. Narrowing it down based on your suggestion I found the problem entry.

One of the devices did not have the UserSuppliedWattage added yet…and I guess that causes the whole formula to fail if any of the devices don’t have the energy service ID’s.

Thanks so much for your help! :slight_smile:

[s]Do you support the three variables (based on state) that the thermostat UserSuppliedVoltage variable?

http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions#EnergyMetering1

For example, I’m using “300,1000,300” as I have natural gas heat (heat and fan only the same). Even though it’s included as power(46) in the arithmatic, nothing is shown in the HVAC cools.[/s]

PS - I use a Nest thermostat if that makes a difference.

[Update] I’ve traced it to the Nest device not providing the right values, nothing wrong with your plugin.

Hi Futzle,

Thanks for a great plug in. I’m using it to along with a Gasmart device (reed switch) on a CurrentCost setup to convert the pulses from m3 at the meter to kW using the formula - power (110) * 1.02264 * 38.9 / 3.6 / 100

It works a treat.

One request, the CurrentCost device also reports a running total in KWH (which in reality is total m3 at the meter so also needs to be converted again). I’d like to use your plug in to convert this total, however your plugin only takes the Watt value. Would it be possible to enhance it to also take the KWH field ? (or a choice to select either, maybe like ‘KWH (110) * 1.02264 * 38.9 / 3.6 / 100’ )

I toss kWh on the to-do list. Obviously it’s up to you to use this value wisely, and not conflate energy with power…

Thanks Futzle,

Any ideas why the Power Arithmetic plugin which displays similar to any other Power monitoring device within Vera, is not picked up by Imperihome as a Power device ?

I’ve also got the author of Imperihome looking at this, but wondered if you’ve got any ideas ? It’s got to be something simple I feel

Different device type, probably.

Power Meter: urn:schemas-micasaverde-com:device:PowerMeter:1
Power Arithmetic plugin: urn:schemas-futzle-com:device:PowerArithmetic:1

(They have to be different, otherwise I can’t attach the Lua code to the latter. It’s a consequence of the LuaUPnP design that MCV made. In their defence, MCV does recommend that control point applications look at the service ID (both have the urn:micasaverde-com:serviceId:EnergyMetering1 service) and not at the device type. Most apps don’t follow this advice. I’m not convinced that even MCV’s own apps do.)

Hi, I’m using a calculation which is using division. The module works great but the answer to my calculation has 11 trailing digits after the decimal point. Is there a way I can use an Integer type function to shave the digits off?
I have tried using Int() and Integer() without success.
Thanks, Doug

The plugin’s formula language doesn’t have a rounding function. I’ll try and remember to add one to the plugin in the next update. It’ll be something like round(expr, n) where n is the number of decimal places to keep.

I can’t get it running. I have Vera 3 with latest firmware 1.7.318 . Could that be the problem? I even didn’t use formula. I tried with putting a simple number in the formula field but still it shows Power:W and nothing else comes out. I tried with formula as well - I used power(8) where 8 is the id of my refrigerator which of course always has more than 0 watts (mine is between 1 and 150 watts). I use Fibaro wall plug to control the fridge.

I would really like to have this app cause i can’t use scenes for what I need. For example I want my aspirator in the kitchen to turn on when my hob starts using more than 0 watts but with the regular scene options I can’t do that.

vzhivkov, I did get this going on my Veralite (1.7.318) but I recall that it took at least one manual Luup restart and possibly one or more browser refreshes too. Keep in mind that this plugin updates its value only when the power on the devices it’s watching (8 in your case) changes. Persevere with it. At some point it’ll start working.

It somehow started working and it’s great plug in.

[quote=“ddochstader, post:47, topic:176302”]Hi, I’m using a calculation which is using division. The module works great but the answer to my calculation has 11 trailing digits after the decimal point. Is there a way I can use an Integer type function to shave the digits off?
I have tried using Int() and Integer() without success.
Thanks, Doug[/quote]

Hello Doug!
Install the Variable Container plugin and write in this plugin the value with scene luup!
Etc. luup code is:

luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,string.format (“%.0f” ,LUL_ID), VC_ID)

where %.0f is 0 decimal, etc. %.1f with only one decimal value

LUL_ID is your Power Arithmetic Device ID
VC_ID is the Variable Container ID

Hi futzle

I like pluging a lot, but I have the same problem than Savonarole.
If we have power(10)= 4 and power(11)=3
power(10) - power(11) = 1

but If we have power(10)= 4 and power(11)=0
The plugin freezz

I don’t know if anybody get a workaround.

Thansk in advance

Hi NAC, I extend to you the same request I extended to Savorarole: If you can capture a Luup log of your Vera at the moment when the problem first happens (I’m guessing when the power involved in the sum first becomes zero) then I’ve got a chance of reproducing it and fixing it. I can’t presently reproduce the bug on my Vera.

Can the Power Arithmetic plugin handle UI7?

Will it display negative numbers?

I have grid power, expressed as a positive number.

I have solar power, and it is also a positive number.

If I subtract solar from grid and the number is negative, I’m feeding power into the grid. If it is positive, I’m pulling power from the grid.

My formula is simple;

power (470) - power (473)

…but no luck so far. The two power meters are HEM Gen2 by Aeon if it makes a difference.

[quote=“hmspain”]Can the Power Arithmetic plugin handle UI7?
Will it display negative numbers?[/quote]
Short answer: I don’t know. I don’t use this plugin any more.

Displaying negative powers was always a bit of a hack in the Vera UI. The data type of the Power service is specified by Vera as an unsigned integer. In UI5 you could put negative numbers into the Power variable and Vera didn’t do any kind of verification. Maybe that’s changed in UI7. Take a look at the list of variables in the Advanced tab and see if the “Power” variable starts with a minus sign. That’ll identify whether it’s the plugin or a display issue in UI7.

[quote=“futzle, post:56, topic:176302”][quote=“hmspain”]Can the Power Arithmetic plugin handle UI7?
Will it display negative numbers?[/quote]
Short answer: I don’t know. I don’t use this plugin any more.

Displaying negative powers was always a bit of a hack in the Vera UI. The data type of the Power service is specified by Vera as an unsigned integer. In UI5 you could put negative numbers into the Power variable and Vera didn’t do any kind of verification. Maybe that’s changed in UI7. Take a look at the list of variables in the Advanced tab and see if the “Power” variable starts with a minus sign. That’ll identify whether it’s the plugin or a display issue in UI7.[/quote]

Thank you Futzle! I suspect I’ll have to do the math in my head LOL. I was hoping the Home Energy Monitor (HEM Gen2 by Aeon) would show which way the electrons were flowing, but no such luck.

Hi Futzle

I’m on Veraedge (last firmware) and I installed five Aeon HEM 2nd edition to monitoring the power prodution (watt and Kwh) of five photovoltaic inverter.

I’m trying to use the Power Arithmetic plugin to sum the five value but it seems not to work.

Have you any idea or alternative ?

tnks

donato

Same answer as above: I don’t use this plugin any more and don’t know if it works on recent UI7 releases.

You could help by expanding on what you mean by “it doesn’t work”. What did you do, what do you expect to happen, what actually happened?

[quote=“futzle, post:59, topic:176302”]Same answer as above: I don’t use this plugin any more and don’t know if it works on recent UI7 releases.

You could help by expanding on what you mean by “it doesn’t work”. What did you do, what do you expect to happen, what actually happened?[/quote]

Hi Futzle,

I’m using the plugin to sum the value of Watt of five HEM with a formula (power(id1) + power(id2) + etc…) but the value of plugin doesn’t change when the single value changes.

I’m trying to use PLEG using the properties of HEM-Watts variable and Lua code to sum when the properties changes.

tnks

donato