detect increase or decrease

Hello,

I’m trying to detect is temperature is increasing or decreasing.
Now I’m storing the value in a variable container and checking with an schedule with the new value.

Is there a way of doing this directly with PLEG?

It would be nice to check only when the value changed and not having to use external storage.

Here’s what I have so far:

Device properties:
lastFloorTemp VariableContainer Variable4 20.3 2014-06-16 11:51:34.334 2014-06-16 11:47:41.575
tempTrend VariableContainer Variable2 TEMPUP 2014-06-16 11:27:55.376 2014-06-16 11:12:26.680
T_Salon Temp Salon - S4 CurrentTemperature 25.4 2014-06-16 11:41:02.548 2014-06-16 11:36:01.586
T_Suelo Temp Suelo - S3 CurrentTemperature 20.3 2014-06-16 11:51:34.199 2014-06-16 11:27:55.205

Conditions:
updateFloorTemp No T_Suelo != lastFloorTemp false 2014-06-16 11:51:34.222 2014-06-16 11:51:34.350
increasingTemp No updateFloorTemp AND (T_Suelo > lastFloorTemp) false 2014-06-16 11:51:34.228 2014-06-16 11:51:34.353
decreasingTemp No updateFloorTemp AND (T_Suelo < lastFloorTemp) false 2014-06-16 10:03:21.218 2014-06-16 11:00:41.206
newTemp No increasingTemp ? (summerMinFloor - histeresis):(summerMinFloor + histeresis) 20.2 2014-06-16 11:51:34.359 2014-06-16 11:51:34.238
temp No cooling ? summerTemp : winterTemp 25 2014-06-14 14:12:54.715 2014-06-14 14:12:51.489
isActive No (T_Salon >= temp) AND (T_Suelo > newTemp ) true 2014-06-16 11:51:34.206 2014-06-16 08:50:15.159

Actions:
updateFloorTemp VariableContainer SetVariable4 newVariable4={(T_Suelo)}

any way to simplify it?