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

I'm trying to control my heating based on electricity hourly prices. I am in point where OR get prices but I cannot get rules to fire reliably. The current price is updated through rules and that work fine. Also I'm not getting any errors in log and my other rules work just fine. Am I missing something with drools..? My rules are following:

rule "Heating control Cheap"
when
CustomState( source=="CurrentPriceSensor", $w1 : value)
CustomState( source == "cheap8", eval(Float.parseFloat((String)value) >= Float.parseFloat((String)$w1)))
then
execute.command("LammitysScene", 1 );
end

rule "Heating control Expensive"
when
CustomState( source=="CurrentPriceSensor", $w2 : value)
CustomState( source == "cheap8", eval(Float.parseFloat((String)value) < Float.parseFloat((String)$w2)))
then
execute.command("LammitysScene", 2 );
end

Rules seems OK, unless there is a problem in float conversion. Check if there is no regional settings problem, i.e. US use . for decimals while most european use ,

Posted by aktur at Jan 14, 2015 12:09

I have used . as decimal separator as rules use , for separating parameters. Most frustrating part is that rule could work sometimes just fine for couple days straight but after reboot, it won't work anymore even though all other rules work just fine and there is no errors on boot log.

I could not get those rules just right using Event(), and ended up with error message with float and event call incompatibility. Could you or someone help me with that.

Posted by nokk3r1 at Jan 22, 2015 13:18

Most frustrating part is that rule could work sometimes just fine for couple days straight but after reboot, it won't work anymore even though all other rules work just fine and there is no errors on boot log.

There is a bug in rules engine, which requires a hard reboot of the controller after every syncing with the designer. Otherwise rules would not work correctly and fail on random.

Posted by aktur at Jan 22, 2015 20:46

Thank you Michal! That explains a lot. Now my rules are working fine.. Have to remember do hard reboot after syncing.

Posted by nokk3r1 at Jan 23, 2015 05:05
Document generated by Confluence on Jun 05, 2016 09:34