You can’t. Dynamic numeric icons only support values 0 to 100 and the “everything else” default option.
Bit more detail
Potentially, you could copy your negative number to a positive “shadow” Item, and use sitemap visibility= feature to switch display lines between “real” and “shadow” Item - with a different set of icons - switching based on negative or positive value of “real” Item https://www.openhab.org/docs/configuration/sitemaps.html#visibility
It should be solved, tested only then case… tomorrow morning will confirm.
file.items
Number Grid_Power "Grid Power [%.2f W]" <energygrid> { channel="fronius:powerinverter:mybridge:myinverter:powerflowchannelpgrid" }
Number Load_Power "Load Power [%.2f W]" { channel="fronius:powerinverter:mybridge:myinverter:powerflowchannelpload" }
Number Battery_Power "Battery Power [%.2f W]" <battery> { channel="fronius:powerinverter:mybridge:myinverter:powerflowchannelpakku" }
Number Gpower_Out "Grid Power Out [%.2f W]" <energygridout> { channel="" }
Number Gpower_In "Grid Power In [%.2f W]" <energygridin> { channel="" }
file.rules
rule "Grid Power icon"
when
Item Grid_Power received update
then
val strGP = Grid_Power.state as DecimalType
val float gpFloat = strGP.floatValue
//logInfo("grid power rules", "gpFloat : " + gpFloat + " W")
if ( gpFloat > 0 ) {
Gpower_Out.sendCommand(0)
Gpower_In.sendCommand(Grid_Power.state)
}
else{
Gpower_In.sendCommand(0)
Gpower_Out.sendCommand(Grid_Power.state)
}
end
file.sitemaps
Frame label="FTV" {
Text item=Day_Energy
Text item=AC_Powery
Text item=FAC icon="freq"
Text item=IAC icon="currentac"
Text item=IDC icon="currentdc"
Text item=UAC icon="voltac"
Text item=UDC icon="voltdc"
//Text item=Grid_Power
Text item=Gpower_Out visibility=[Gpower_In==0]
Text item=Gpower_In visibility=[Gpower_Out==0]
Text item=Load_Power
Text item=Battery_Power
Text item=Year_Energy
Text item=Total_Energy
}