This page last changed on Dec 19, 2015 by istian.

Hi,

i would like the floor heating to be increased at a certain time in the morning and then be adjusted back to the previous level at the end of this period.

Eg current set value 28, at 7 o'clock I would like the set value to become 32, and stay this way for 1 hour and then adjust back to 28. However the set value of 28 is not permanent therefore I would like the rule to role back to the set value it was before the increase to 32...
Is this possible, if so, how?

You can store the last value in a custom fact. Something like this should work (not tested):


declare LastValue
  @role(event)
  @expires(2h)
  source: string
  value: string
end

rule "Temp boost"
  timer(cron: 0 0 7 * * ?)
when
  Event(source=="set_value", $v: value)
then
  LastValue lv = new LastValue();
  lv.setSource("set_value");
  lv.setValue($v.toString());
  insert(lv);
  execute.command("set_value", 32);
end

rule "Temp back"
  timer(int: 1h)
when
  $lv: LastValue(source=="set_value")
then
  execute.command("set_value", $lv.getValue() );
  retract($lv);
end

Posted by aktur at Dec 21, 2015 12:21
Document generated by Confluence on Jun 05, 2016 09:33