This page last changed on Jan 05, 2015 by nokk3r1.

Hello,

I've been trying to figure out how to easily and correctly adjust my house room temperatures with OR GUI buttons. Why I am doing this, is because in recent controller developer releases the certain DPTs stopped working in range sensors and therefore my sliders doesn't work either. http://www.openremote.org/pages/viewpage.action?pageId=22888961 That will probably be fixed in future. The other reason is that I'd like to adjust temperature with 0,5 degrees increments which is same as my physical room thermostats and that is only possible via rules when using KNX.

So what I have done:

  • I have created three in memory virtual commands: RoomHeatUp ( on ), RoomHeatDown( off ), RoomHeatStatus( status )
  • Created sensor for status command: RoomHeatStatusSensor
  • Created 2 buttons to GUI and linked on and off commands to them
  • Wrote following rule:

rule "RuleRoomHeatUp"
when eval (true)
Event( source == "RoomHeatStatusSensor", value == "on" )
$rh1 : CustomState( source=="RoomKNXSetpointSensor")
then
double Roomheatingtup = Double.parseDouble($rh1.getValue().toString()) + 0.5;
execute.command("WriteRoomKNXSetpoint", Double.toString(Roomheatingup));
end

rule "RuleRoomHeatDown"
when eval (true)
Event( source == "RoomHeatStatusSensor", value == "off" )
$rh2 : CustomState( source=="RoomKNXSetpointSensor")
then
double Roomheatingtdown = Double.parseDouble($rh2.getValue().toString()) - 0.5;
execute.command("WriteRoomKNXSetpoint", Double.toString(Roomheatingdown));
end

When monitoring bus I have made following notes:
When using that rule with 0.5 increments and "temp1d" knx-command it calculates it correctly but when sending new setpoint it is divided by ten. For example when original value is 22.0 and increment it with 0.5, the value of 2.25 is sent.
When using 1.0 increments and normal "temp" knx-command the new values are calculated and sent correctly bus, but sometimes the button press doesn't do anything and sometimes the rule is triggered 2 times. Also the OR updates very slowly the new value to GUI although when rule is triggered twice, the increment is mostly done twice. when using physical room thermostats the setpoint is updated to GUI instantly.

I've been trying to figure out what is wrong for couple days now and I cannot get it to run smoothly. Is there something fundamentally wrong in my setup? Should I make virtual commands for both heat up and heat down? Is there some required corrections to get rule working as intended? Is there easier way to do this? Can I use same $rh1 for both rules as they store same value?

Any help or advice is greatly appreciated..

The fundamental problem is that you are creating continuous loops. When for example you set "RoomHeatStatusSensor" "on" then the temperature will increase with every "RoomKNXSetpointSensor" update.
The correct logic for setting temperature is a part of my IoT challenge design. Look on these rules:

rule "ARC: VACSetPoint.inc"
  timer(int:300ms)
when
  Event(source == "GVACSetPoint", $v: value, eval(_GetTemp(value) <30))
  Event($s:source == "VACSetPoint.inc", value == "ON")
then
  execute.command($s,"OFF");
  execute.command("GVACSetPoint", _ShiftTemp($v.toString(), 0.5));
end

rule "ARC: VACSetPoint.dec"
  timer(int:300ms)
when
  Event(source == "GVACSetPoint", $v: value, eval(_GetTemp(value) >15))
  Event($s:source == "VACSetPoint.dec", value == "ON")
then
  execute.command($s,"OFF");
  execute.command("GVACSetPoint", _ShiftTemp($v.toString(), -0.5));
end

Posted by aktur at Jan 06, 2015 12:37

Thank you very much. I'm still not that good with drools rules.

With KNX, ut is possible to listen when commands are sent to bus and then trigger actions. In that situation same commands can be sent to bus multiple times and you don't have to poll for status. That is what I tried to achieve my rules above.

Is there difference if I use Event or Switch parameter for reading sensor value?

Posted by nokk3r1 at Jan 06, 2015 13:22

Is there difference if I use Event or Switch parameter for reading sensor value?

I don't know. I always use Event() and never had any problems with it. Perhaps someone from the core team can put some light on it?

Posted by aktur at Jan 06, 2015 16:07
Document generated by Confluence on Jun 05, 2016 09:34