Hi, I’m trying to read the energy consumption from a KNX network with OpenRemote. I programmed the device US/U4.2 from ABB with ETS5 to count the pulses from an energy meter. After importing this program to OpenRemote Designer I don’t know how to proceede to show the meter values on a Label text for example. Maybe my problem is in the “Command type”, I’ve already tried “Range 0-255”, “Range status” and even “Temperature status” to show the 1 byte response of the counter but it always shows 0.
Does anyone have a solution?
Greetings form Brazil!
showing the value from a sensor in a label is quite simple. You should define a sensor with a given protocol and in the UI designer place a label and link it with the sensor. Please, show as your sensor and label definition (make screenshots) so we can see and explain what is wrong.
I’ve already tried to link the label with a sensor, I think I’m not defining this sensor correctly. I’m sending what I’ve done in ETS5 and in OpenRemote. By the way, the energy meter I’m using is the C11 110-300 also from ABB.
Thanks for your help.
Never mind! I found my error. I was connecting de meter to the KNX device wrong
But now I’m trying to multiply the pulse counter to give me the response in kWh, any idea how to do some basic math operation in OpenRemote?
Take a look at this post http://mqlservice.net/openremote/2013/05/22/temperature-sensors-calibration/
There is a simple example of converting temperature. You can adopt this for your needs.
Michal, I adopted your code to my needs, but it didn’t work.The sensor I get te real measurement from is range type, is this my problem? I tried to change the VTEMP sensor to range type but it didn’t work as well.
Just a though ( I dont have any experience with KNX) - when i read values from zwave sensors and if i want to perform calculations/ conversion i have to assign them to a in-memory virtual sensor as an "integer" first throughr rules and then do the math operations.
If i try to directly do mathematical calculations on the values read from the sensor, it does not seem to work.
I use only custom sensors for all my needs and they return strings, therefore there is Double.parseDouble for converting this string to double. A range sensor should return a number therefore there is no need for this conversion.
double kWh = $v / 100.0;
should do, but I haven't tested it and have no real experience with other sensors than custom. You can also try to define your "Active Energy" as custom sensor and the rule should do. It can use the same underlying command.
Looks like a good solution. And do you know how can I do it? Sorry, this is my first contact with rules.
I have this “Active Enrgy” sensor which gives me the pulse response from the energy meter, it is a range type sensor (imported directly from KNX network). And created a new custom sensor with an in-memory command, “kWh”, command and adress of the in-memory command are “status” and “kWh” respectively, the sensors name is “Energy”.
Thanks for your help.
In this line:
CustomState(source==“Active Energy”, $v: value)
Where it says “Active Energy” I must write the sensors or the commands name?
Here you need to put the sensor name. Also don't forget about headers in the rule files, search for it in the docs. When you get it done, check logs/boot.log f there are no syntax errors in the drl file.
This is what I got:
ERROR 2017-05-31 09:36:16,607 : Rule definition ‘modeler_rules.drl’ could not be deployed. See errors below.
ERROR 2017-05-31 09:36:16,607 : Unable to resolve ObjectType ‘CustomState’
ERROR 2017-05-31 09:36:16,607 : Rule Compilation error $v cannot be resolved
ERROR 2017-05-31 09:36:16,607 : Cannot start event processor ‘Drools Rule Engine’ : Cannot find KieModule: org.default:artifact:1.0.0-SNAPSHOT
I have no idea whats it means.
The header I found in the docs is this one:
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
Change CustomState() to Event() and add the following line at the top after the package line and before global:
It worked! Thank you very much!!
Just one ore question. If I wanted to add one more decimal place in my string? Would it be “%.11f”?
Saved the day my friend. Thanks again!
Never, mind. The “%.2f” worked fine.