Using openhabin hasslefree 2.5 M2.
I thought I could handle this as a piece of cake… But ofcouse not.
I have this item, (power state from a solar panel):
Number inverter1ActivePower "Active Power [%.3f kW]" <solarpanel> {channel="modbus:data:inverter1:Active_Power:Active_Power:number"}
When sun is shining, this item have a positive value and return the power from the solar panel. But when the sun goes down the inverter change to standby mode, and the value recived change into a static value like this:
2019-09-16 22:03:56.591 [vent.ItemStateChangedEvent] - inverter1ActivePower changed from NULL to -2147483648
Note its a static value… It´s actually a return code from the inverter, meaning there is no power generating from the solar panels…
Well, I thought, no worry, I´ll just create a rule to “transform” this -2147483648 into 0 (zero), and then I´ll be able to persist this item… However, I cant seem to transform this value and postUpdate the new value to the item…
This is the rule I´ve tried (among other combination).
rule "If Active power < 0 set to 0"
when
Item inverter1ActivePower changed
then
if (inverter1ActivePower < 0) {
inverter1ActivePower.postUpdate (0)
}
end
But I get this in return:
2019-09-16 22:03:57.186 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Active power < 0 set to 0': Unknown variable or command '<'; line 5, column 11, length 24
Any hint how to get this static value into a static 0 (zero).