HestiaPi / hestia-touch-openhab

OpenHAB2 files for HestiaPi Touch model
GNU General Public License v3.0
60 stars 17 forks source link

Don't use primitives #24

Closed rkoshak closed 4 years ago

rkoshak commented 4 years ago

The use of primitives is known to add a significant amount of time to .rules files loading. In some cases even on an RPi the use of ints, longs or calls to intValue can add minutes when you can get the same functionality using just Number. So only in cases where you absolutely have to use the primitive (e.g. calls to now.plusMinutes) should you force number to be primitives.

There can be ambiguous function call errors when casting to DecimalType instead of Number. So always cast to Number instead.

Signed-off-by: Rich Koshak rlkoshak@gmail.com

gulliverrr commented 4 years ago

The same problem would be in the hvac rules https://github.com/HestiaPi/hestia-touch-openhab/blob/ONE/home/pi/scripts/hvac.rules too. I leave this open till I modify both .rules files.

rkoshak commented 4 years ago

I made the changes to hvac.rules too, I just forgot to add it to the commit. I also realized I introduced a small bug which I fixed in both files. There were two calls to now.plusMinutes that now need to call intValue on the argument.