Move temperature from weather service to knx

60 views
Skip to first unread message

Koen Hendrickx

unread,
Jun 3, 2017, 8:15:22 AM6/3/17
to OpenRemote

Hello all,

I'm trying to get this working: I read the temperature in OR2 from a weather service. This works fine.
Now i want to use it in my KNX installation. 
Is this possible to move the value that i get from http to knx. (i was thinking of macro but i don't find a way to do...)

Already thanks.

Michal Rutka

unread,
Jun 3, 2017, 8:22:08 AM6/3/17
to OpenRemote
You will need a rule to do this. There should be an example of doing this in the old forum. In shout you should read your http sensor on the LHS (after when) and feed it to the knx command in the RHS (after then).

Koen Hendrickx

unread,
Jun 3, 2017, 9:36:25 AM6/3/17
to OpenRemote
Hello,

Thanks for it.
I'm searching but i don't find the topic. (on the old forum, i get an error message...)

On the other hand, i found out how rules work for timers etc, but i don't find how to copy the value (LHS/RSH)
Do you know where i can find more about it, (or the example)

tx.

Op zaterdag 3 juni 2017 14:22:08 UTC+2 schreef Michal Rutka:

Stuart Hanlon

unread,
Jun 3, 2017, 1:58:25 PM6/3/17
to OpenRemote

Koen Hendrickx

unread,
Jun 6, 2017, 12:40:57 AM6/6/17
to OpenRemote
Hello,

Thanks for the link, although i already read.
As i told, i found out how rules work. I manage to make a timer that activates/deactivates a lamp every minute.
What i don't find, is how to copy a value from the http weather service to a KNX value.
I tried "temperature_knx = temperature_ws;"
I tried it in the vice verse, i tried it with :=,... but nothing works...

In the documentation i find a lot of stuff, but not for a simple copy of value...

Already thanks!

Op zaterdag 3 juni 2017 19:58:25 UTC+2 schreef Stuart Hanlon:
https://github.com/openremote/Documentation/wiki/OpenRemote-Rules-examples
Message has been deleted

Stuart Hanlon

unread,
Jun 6, 2017, 1:42:30 AM6/6/17
to OpenRemote
Hi
There are a couple of rules in those examples that do exactly what you're asking for.

Granted they use a regex to match multiple sources to a single command, or the more advanced version matches multiple sources to thier matching commands​.


Look very closely at this example.

https://github.com/openremote/Documentation/wiki/OpenRemote-Rules-examples#extract-a-text-string-from-a-custom-sensor-and-pass-to-a-command

Just imagine that your required value is a text string for this example.


I know what you are needing, as I've used this solution to link room temperature values in a Velbus system to Loxone valve controllers.


Good luck,

Stuart

Koen Hendrickx

unread,
Jul 4, 2017, 2:25:47 AM7/4/17
to OpenRemote
Hello,

I studied this example, but for some reason, something keeps on going wrong.

i have the following: (where "temperature" is the value of my http command. 
$evt:Event(source matches "^.*_Temp_Mode-\\d+$", $source : temperature);
String TempStatus = $evt.getValue().toString();


After that, i need to copy it to my KNX value. (command)
Therefor, i tried 
Temperature_KNX = TempStatus

this is not working.
I think the problem is that i have to copy it back from string, but i don't find it how to...
therefor i didn't found an example... 

Another question: how i can see that it is converted correctly?
I think i need to use the command but i don't know where i can read this out... ("tail -f stderrout.log" is not printing anything...)
System.out.println(TempStatus);

Already thanks!



Op dinsdag 6 juni 2017 07:42:30 UTC+2 schreef Stuart Hanlon:

Michal Rutka

unread,
Jul 4, 2017, 3:21:31 AM7/4/17
to OpenRemote
There is a syntax error on the LHS of your rule. You should see in the boot.log file that the rules file is not loaded. The LHS line should read:

$evt:Event(source matches "^.*_Temp_Mode-\\d+$")

I.e. remove $source: temperature and ;

Stuart Hanlon

unread,
Jul 4, 2017, 4:56:07 AM7/4/17
to OpenRemote
Further to Michal's observation, I think you're asking how to inject the value into your KNX.

I do this by using the value within the execute command.

IE.

execute.command( "DMX_Channel-set-by-HEX", hex.toString() );

Where "DMX_Channel....." Is the command I use to set a DMX value using a ${param}.

Then inject the value from the regex search, in this case "hex"


So, if I understand your role syntax correctly, you'd need something like :-

execute.command( "KNX_Temp_Set", TempStatus);


These example rules might be of help :-

https://github.com/openremote/Documentation/wiki/OpenRemote-Rules-examples

Koen Hendrickx

unread,
Aug 9, 2017, 4:05:58 PM8/9/17
to OpenRemote
Hello again,

For some reason, i'm feeling as turning into circles...

I now just try to write a fixed value to my KNX value. (trying from the end to the beginning...)

package org.openremote.controller.protocol;

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

import java.util.*;
import java.util.regex.*;

Rule "Temperature"
Timer (int: 0s 1m) when eval(true) then

String TempStatus = "15.0";
execute.command( "temperature_outside", TempStatus.toString() );

execute.command("Eetplaats aux (OFF)")
end

By executing the last line, i can see if my rule is working.(and it is)
But the value 15.0 is not going into my KNX value...
What am i doing wrong?

Does there exist a manual for this code, exept for the examples? I'm still not completely getting the syntax...

Already thanks!

Op dinsdag 4 juli 2017 10:56:07 UTC+2 schreef Stuart Hanlon:

Michal Rutka

unread,
Aug 10, 2017, 4:21:22 AM8/10/17
to OpenRemote
The rule seems OK. What is the definition of the "temperature_outside" command? Does it uses ${param} for passing a value?
Reply all
Reply to author
Forward
0 new messages