Power Arithmetic plugin

The plugin uses the standard service ID of “urn:micasaverde-com:serviceId:EnergyMetering1”. Perhaps AutHomationHD needs to recognize the device type (“urn:schemas-futzle-com:device:PowerArithmetic:1”) too. Garrett will know for sure.[/quote]

I added the device type to the energy meter portion of my app. So it should show up as an energy device and report the watt usage. Currently this will only be available in the alpha builds.

  • Garrett

Hi,

very strange, fews month ago i was saying that the formula was not refreshed every time to use it with datamine. (using ergy plugin)

today the formula power(id) or switch(id) is not recognised ! what could be the issue ? Thanks

(i have already delete the module and create a new one , and restart the box )

in datamine the formula is seen as textTEXT ! return ‘POWER(id)’, id is the id of fibaro wall plug.

i don t use ergy plugin is it the problem ? > say power function not recognised
if ergy plugin created > value is TEXT ?

[quote=“Savonarole, post:33, topic:176302”]…
power(id)

POWER(id)
…[/quote]

I just installed the latest files and created a power arithmetic device with a formula [tt]power(186) + 10[/tt] and it correctly displayed 10 more watts than device 186. The function name must be entered in lower case, so if you’ve written [tt]POWER[/tt], there is no such function.

I don’t use dataMine so I can’t offer any insight there.

No, the Ergy plugin won’t be involved in any way. You are IMO correct to not use it.

power arithmetic is OK now and graph too , i have poor eyesight ::slight_smile:

exact is ‘power(id)’, where ‘id’ is the number of module NOT ‘id module’, (an error in a sum of 5 plug !)

for the draft in datamine not take ‘formula’ but ‘watts’ variable.

and restart the vera UI5 after loading plug to be sure …

THANKS futzle nice job

Great app.
Is there a function to look at the percentage value of a dimmer switch so the wattage can be calculated from the switch % value?

There isn’t, but it’s a good idea. Do you need anything more than the percentage (e.g. sqrt() or exp() or some other algebraic operation)?

I’m not showing any data after an hour…and after reloading like 10 times.

Thought it was simple formula:

power(8) + power(10) + power(12) + power(14) + power(16) + power(18) + power(20) + power(22) + power(24) + power(26) + power(28) + power(30) + power(32) + power(34) + power(36) + power(38) + power(40) + power(42) + power(205) + power(206) + power(214) + power(216) + power(218) + power(219) + power(228) + power(233) + power(242) + power(243) + power(244) + power(252) + power(256) + power(259) + power(265) + power(271) + power(272) + power(276) + power(282) + power(287) + power(289) + power(294) + power(295) + power(362) + power(375) + power(303) + power(446) + power(448) + power(449) + power(465) + power(486) + power(487) + power(363)

Half of these have UserSuppliedWattage providing the watts values, the rest have real power meters (like an Aeon smart switch or smart strip)

It might be the formula length. Try a shorter one and see if it works. Then expand it a bit with another term or two.

This plugin uses a recursive-descent parser so it’s not the most efficient in terms of CPU or memory use. It’s easily possible that your formula overflows a stack.

Edit: you can reduce the depth of the parse tree by using parentheses to halve the length of each bit being added.

((A + B) + (C + D)) + ((E + F) + (G + H))

or just divide it in two

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.