Hello,
i want to split the decimal after one comma instead rounding values.
i use follow rule script:
//watt = 1567
val watt = (triggeringItem.state as Number)/1000
//watt = 1.567000000
val String MajorWatt = watt.toString().split(".").get(0)
val String MinorWatt = watt.toString().split(".").get(1)
// val CompleteWatt = MajorWatt + “.” + MinorWatt.substring(0,1)
// watt should be 1.5
but i get follow error message:
==> /var/log/openhab2/openhab.log <==
2018-03-15 19:04:23.172 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'PowerStripWatt': 0
anybody can help me to solve this?
i dont want to round the second number. it should only cut to the first number after comma (or dot here)