Energy Metering Sensor plugin

I have created an energy mettering sensor plugin, mainly because I haven’t found any one doing the job…

Work only on UI5, including latest beta 1.5.408.

I have written it taking care of (my own requirements…):

[ul][li]When the switch turn on, the connected equipment generates a high power usage during a few seconds before it enter sleep mode, for example my Denon amplifier consume more than 30W during this power on phase, then goes down to around 10W. So I need to ignore this initial event.[/li]
[li]Need of a different On->Off and Off->On threshold, useful for devices which has a overlap watts usage between sleep mode and on mode.
For example my Boston amplifier report 5-8W when off, 8-12W when on.[/li]
[li]Need for fast reactivity to events (goal: a very few seconds), to do this I use luup.watch on variables “Watts” and optionnaly variable “Status”.
For example when I switch off my TV, the evening, then slowly dimming up the room lights.[/li]
[li]Need to ignore an initial startup phase.
For example my washing machine run a couple of minutes to calculate the cycle time, then enter sleep mode if a deffered finish is requested.[/li][/ul]

So the sensor has the following configuration variables:

[ul][li]EnergyMeteringDeviceID[/li]
[li]WatchSwitchOn[/li]
[li]StartupSeconds[/li]
[li]ThresholdWattsLow[/li]
[li]ThresholdWattsHigh[/li][/ul]

EnergyMeteringDeviceID is the device to monitor.

WatchSwitchOn:

[ul][li]0 don’t watch “Status” variable[/li]
[li]1 watch “Status” variable[/li][/ul]

StartupSeconds:

[ul][li]number of seconds to ignore any report of change “Watts” variable[/li]
[li]if WatchSwitchOn is 1, ignore “Watts” change after the “Status” of the EnergyMeteringDeviceID has change from 0 to 1.[/li]
[li]if WatchSwitchOn is 0, ignore “Watts” change after the first “Watts” of the EnergyMeteringDeviceID has change from a value lower or equal to ThresholdWattsLow to a value higher or equal to ThresholdWattsHigh.[/li][/ul]

ThresholdWattsLow, ThresholdWattsHigh:

[ul][li]The two Watts thresholds, Watts lower or equal than the first one then the EMSensor is not tripped. Watts higher or equal to the second one then the EMSensor is tripped.[/li][/ul]

I do it for my own purposes but if there are some interests, I will be happy to share it :).

Jean-François

Hello and welcome.

Good job for a first post and If you add the files to your first post, I would be interested in it.

Thanks,

here is a zip file which contains all the necessary materials.

Great work, Jean-François. I’ve been thinking of something like this to remind me to put the coffee machine to bed at night, after detecting the power spike of running the steam boiler.

Hi jfp

I’m curious of your set up, Can I ask what (zwave) hardware you are using for this ?

Thanks

Hello,

I used :

[ul][li]Everspring switch AN158,[/li]
[li]Aeon Labs Smart Energy Switch,[/li]
[li]Aeon Labs Smart Energy Illuminator.[/li][/ul]

jf

Thank you, the ignore startup watts at the beginning is very useful.

Hi, I’m a new Vera3 user. I’m not that technical but I managed to connect several devices inc. the RFCtrx433 tranceiver. Now I connected 2 6-nodes from greenway (bought at Nuon Netherlands). No problem at all. Now my problem. Besides the 6-Node I have 2 Everspring AN158 connectors. Now my problem.
I’m looking for some software to measure and store my energy consumption. Your plugin looks like what I am looking for but… how do I install and test/use it? I downloaded the zipfile.

Thanks in advance,

Norbert.

@norbert

Sorry missed your question,
You can take a look at the following reply, same procedure:
http://forum.micasaverde.com/index.php/topic,6916.msg109409.html#msg109409

JF

thats a great plugin !!
very little footprint but does the work !

by the way, what i do not understand is ThresholdWattsLow, ThresholdWattsHigh

if low set to 50 and high set to 100 … what happen then at 75 ? :wink:
would be smarter to have it ThresholdWattsFrom, ThresholdWattsTo (i guess)

Basically, at 75 nothing happen…

The sensor keep it’s state (tripped or not)

JF

So at 50 it change to tripped right ? And below 50 it changes back ?
What is the “high” value for then ?

Sorry i can not really figure this out since i have only 0, 35 and 755 watts on the module in the kitchen.

So i not really know the trigger is min or max

The min and max are for some kind of hysteresis.

Need of a different On->Off and Off->On threshold, useful for devices which has a overlap watts usage between sleep mode and on mode.

If current state is not tripped then you need a value higher than the high value (ThresholdWattsHigh) to change the state to tripped.
and
If current state is tripped then you need a value lower than the low value (ThresholdWattsLow) to change the state to not tripped.

View the example about my Boston amplifier.

So in you example at 100 it change to tripped and at 50 it change to not tripped.
If you have only 0,35, 755 watts set ThresholdWattsLow to 50 and ThresholdWattsHigh to 100 will work.
Any values between 35-755 are suitable.

ah okay i think i got it now …

well 0 is just “off”
35 Watts is the idle Power the coffeemaker needs. and 755 is if the machine is bobbeling arround :wink:

so to trigger “coffe is beeing made”

ThresholdWattsLow 45 (much lower than operation but higher than idle)
ThresholdWattsHigh 500 (higher than idle but lower than operation)

right ?
its working just fine with this settings since 2 days or so … just wanted to clarify and enlighten myself :wink:

its really a nice piece of work!

oh one more thing. whats the “WatchSwitchOn” do exactly ? sort of shortcut to not check if device is “off state” i assume ?

Correct ;D

The WatchSwitchOn is usefull if you want to ignore a initial startup phase.

I have also the, never published, patch for a workaround to a bug in my Everspring switch AN158 which return a not null power usage when it is off…
Just ignore any received value if the switch is off.

[code]— L_EMSensor1_prev.lua 2012-07-04 18:19:03.408987100 +0200
+++ L_EMSensor1.lua 2012-07-23 16:59:57.161475900 +0200
@@ -80,6 +80,16 @@
end
end

  • – Bug workaround: Sometimes switch with an off status return an EnergyMetering > 0
  • – Force a poll in this case
  • local isOn = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, lul_device) == “1”
  • if not isOn and not tripped and newVal > thresholdWattsHigh then
  •  debug("EMSensor EnergyMetering bug...")
    
  •  luup.call_action("urn:micasaverde-com:serviceId:HaDevice1","Poll",{}, lul_device)
    
  •  return
    
  • end
  • – Less than StartupSeconds since last switch on has occured
    – ignore event
    if dtime < startupSeconds then
    [/code]

[quote=“jfp, post:9, topic:171976”]@norbert

Sorry missed your question,
You can take a look at the following reply, same procedure:
http://forum.micasaverde.com/index.php/topic,6916.msg109409.html#msg109409

JF[/quote]
Hello, I uploaded all 6 files and restarted luup,but no sensor/device appeared under devices to be configured…
I checked and all the files are present under Luup files, also I had power off/power on my Vera,but no device …
I do not have any power meters yet in my system…Can this be the cause?

Oh the device comes on its own ? I did not know that…

Go to apps → Develop Apps → Create device

Type a name in “Description”

Upnp Device Filename: D_EMSensor1.xml
Upnp Implementation Filename: I_EMSensor1.xml

Click create and reload, refresh your browser window, and you should have adevice with the name you habe typed.

I actually did not know its supposed to be created automatic :slight_smile:

Hi

Is anyone able to share some screen shots of this plugin in use? It’s always nice to what you’re likely to see in advance. Thanks

my TV Sensor

i have a Aeon Smart Switch on All the Devices there, thats why the lowWatts are quite high (sometime use a fan on the same Plug … with about 100 watts)

the power on both screen-shoots is on, but the TV-ON (use energy plugin) is tripped only if the TV has been turned on.

[quote=“nullx8, post:17, topic:171976”]Oh the device comes on its own ? I did not know that…

Go to apps → Develop Apps → Create device

Type a name in “Description”

Upnp Device Filename: D_EMSensor1.xml
Upnp Implementation Filename: I_EMSensor1.xml

Click create and reload, refresh your browser window, and you should have adevice with the name you habe typed.

I actually did not know its supposed to be created automatic :)[/quote]

Thanks for help