Its not quite that easy. I have the Emninent energy reader. This device only registers the pulses from the kWh meter .
I use the RRD engine to save the counter values but also to substract the previous value from the last value and convert this amount of pulses to total wattage per hour. The “Derive” function takes care of that. Before plotting the graph i also multiply these pulses per secound by 9600 to get the correct wattage.
Long story short the sensor only measures the amount of pulses from the kWh meter. The "wattage"variable is the value i would like to show.
It was the easyest way for me to convert the amount of pulses to current usage. (My electricitymeter gives 375 pulses when 1 kWh is used.) I read out the sensor every two minutes so when the difference between the last and teh previous reading is 375 my current usage is 1000Watts.
Thats exactly the way i started to do this. But, i can’t seem to get this working. Sometimes after reboot it works but most of the time it does nothing, i just can’t get it right. It probably has something to do with reading the last and the previous version.
I put the new rule in my controller to see if all is working. Unfortunately there is one error in the new part of the rule and i don’t now how to fix it.
Heres the part from the bootlog;
ERROR 2016-08-27 10:38:40,592 : Rule definition ‘modeler_rules.drl’ could not be deployed. See errors below.
ERROR 2016-08-27 10:38:40,593 : Rule Compilation error The method setValue(int) in the type PulseCount is not applicable for the arguments (double)
INFO 2016-08-27 10:38:40,714 : Started event processor : Drools Rule Engine
INFO 2016-08-27 10:38:40,786 : Started event processor : RRD4J Data Logger
i am googling to find some kind of drools for dummies to understand the basics of drools. I havent got a clue what to change now. Does this have something to do with the value from my Zwave counter (“Pulsen”). the counter has a negative value when i display the value in OR. at the the moment its -1625712
Ok. i understand. The problem with this eminent zwave energy meter reader is that it is not fully supported. Thats why i got the advice to poll the energy reader every 2 minutes. I tried leaving the heartbeat out but did not receive any update from the sensor.
I’m not familiar with Z wave but that sounds a little limiting.
So you have a rule that fires off a ‘send pulses’ command (which according to your heartbeat rule the command is called ‘Pulsen’ also - ensure this command name is unique) to the z wave module; is there then another command to receive this value and link it to a sensor?
Provided that the sensor named ‘Pulsen’ has a value and that value changes then there is no reason why the rule would not fire. When you link the sensor to a label on your panel do you see the pulse value and does it change over time (obviously putting your heartbeat rule back in place to get the z wave module to broadcast its’ value).
That's correct, the rule triggers a command Pulsen which is linked to a sensor named Pulsen as well. I made a label linked to this sensor so I can monitor if the data changes every two minutes, and it does! I did the same with oldValue en newValue, to monitor if there is any data written to these. But unfortunately they stay empty.
That's why I think the rule is not triggered.
Hurray, the rule works! Big Thank You for all the tips and tricks and off course a nice working rule!!
I did a step by step debug (thanks for the WRITE SOME TEXT) tip! Somewhere down the line i missed a line ( insert(counter); was missing). After that the rule finally fired but did not get past the // Check if old value is initialized line. For some reason the output from “Pulsen” is a negative value so oldValue will always stay < 0. so i changed the initialisation to 0.
This is the working rule;