I just noticed while converting my rules from DSL to JSR that the return value from a persistence action is not directy usable for comparison (ie. higher/less than) without converting it to string and then float.
myVal = pe.averageSince(ir.getItem("myItem"), DateTime.now().minusMinutes(10), "jdbc") if (myVal > 50): <- This doesn't work correctly, the comparison is not "numerical" #do something
This however works:
if (float(str(myVal) > 50):
I don’t know if this is as designed or if I’m doing something wrong, could it be worth adding to the Wiki in the persistence action section as a note? Could save some users some time
Edit: “MyItem” is a Number item.