Probiere es bitte mal so:
Code: Alles auswählen
Number:Power AkkuLoad "Akku Leistung" {channel="inChannel"[profile="transform:DSL",toItemScript="|if(Float::parseFloat(input)> 0 ) - Float::parseFloat(input)"],
channel="outChannel"[profile="transform:DSL",toItemScript="|if(Float::parseFloat(input)> 0 )Float::parseFloat(input)"],
unit="W", stateDescription=""[pattern="%.3f kW"]}
Wenn die Einheit mit kommt, wäre dies hier möglich:
Code: Alles auswählen
Number:Power AkkuLoad "Akku Leistung" {channel="inChannel"[profile="transform:DSL",toItemScript="|if(Float::parseFloat(input.substring(0,input.length -2))> 0 ) - Float::parseFloat(input.substring(0,input.length -2))"],
channel="outChannel"[profile="transform:DSL",toItemScript="|if(Float::parseFloat(input.substring(0,input.length -2))> 0 )Float::parseFloat(input.substring(0,input.length -2))"],
unit="W", stateDescription=""[pattern="%.3f kW"]}


Der Ausdruck
Code: Alles auswählen
Float::parseFloat(input.substring(0,input.length -2))