Reading energy from KNX

113 views
Skip to first unread message

João Pedro Schauff

unread,
May 24, 2017, 11:07:02 AM5/24/17
to OpenRemote
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!

Michal Rutka

unread,
May 24, 2017, 12:41:50 PM5/24/17
to OpenRemote
Hi,

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.

Kind regards,
Michal 

João Pedro Schauff

unread,
May 25, 2017, 10:03:37 AM5/25/17
to OpenRemote

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.


 

 

 

 

 

João Pedro Schauff

unread,
May 26, 2017, 8:43:14 AM5/26/17
to OpenRemote
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?

Michal Rutka

unread,
May 26, 2017, 8:53:04 AM5/26/17
to 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.

Kind regards,
Michal

João Pedro Schauff

unread,
May 30, 2017, 8:55:02 AM5/30/17
to OpenRemote

   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.


orct...@gmail.com

unread,
May 30, 2017, 9:31:11 AM5/30/17
to OpenRemote
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.

Michal Rutka

unread,
May 30, 2017, 10:09:31 AM5/30/17
to OpenRemote
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.

João Pedro Schauff

unread,
May 30, 2017, 10:15:12 AM5/30/17
to OpenRemote
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.

João Pedro Schauff

unread,
May 30, 2017, 10:32:57 AM5/30/17
to OpenRemote
In this line:

CustomState(source=="Active Energy", $v: value)

Where it says "Active Energy" I must write the sensors or the commands name?

Michal Rutka

unread,
May 30, 2017, 10:56:37 AM5/30/17
to OpenRemote
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.

João Pedro Schauff

unread,
May 31, 2017, 9:39:24 AM5/31/17
to Michal Rutka, OpenRemote
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:

package org.openremote.controller.protocol

global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;



2017-05-30 11:56 GMT-03:00 Michal Rutka <michal...@gmail.com>:
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.

--
You received this message because you are subscribed to a topic in the Google Groups "OpenRemote" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openremotecommunity/5dnTJfXjf2s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openremotecommunity+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/openremotecommunity.
To view this discussion on the web visit https://groups.google.com/d/msgid/openremotecommunity/a77479c4-201e-4dec-9280-3131b6c8fb2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michal Rutka

unread,
Jun 2, 2017, 9:40:11 AM6/2/17
to OpenRemote
Change CustomState() to Event() and add the following line at the top after the package line and before global:

import org.openremote.controller.model.event.*; 

João Pedro Schauff

unread,
Jun 2, 2017, 10:40:12 AM6/2/17
to OpenRemote
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! :)

João Pedro Schauff

unread,
Jun 2, 2017, 10:55:56 AM6/2/17
to OpenRemote
Never, mind. The "%.2f" worked fine.
Reply all
Reply to author
Forward
0 new messages