Move temperature from weather service to knx

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.

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).

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.

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

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!

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

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!


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 ;

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

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!

The rule seems OK. What is the definition of the "temperature_outside" command? Does it uses ${param} for passing a value?