Negative Werte in readingsGroup vermeiden

Begonnen von Gisbert, 26 Februar 2026, 11:27:54

Vorheriges Thema - Nächstes Thema

Gisbert

Hallo,

ich hab folgende readingsGroup definiert, um Energiewerte in einer Tabelle zu veranschaulichen. Gelegentlich kommt es vor, dass die zugrunde liegenden Device nicht einen Wert von "0.000" sondern von "-0.000" - also einen negativen Nullwert - liefern.

Wie kann ich es in der Darstellung verhindern,dass "-0.0" angezeigt wird?

defmod Heat_pumps readingsGroup <Device>,<day>,<day<br/>last>,<month>,<month<br/>last>,<year> NAME=myHeishaelectricity|myHeishaheat|myDaikinPerferaCalculator|myVaillantaroSTORCalculator|myFujitsuCalculator:?alias,.*EnergyDay:r1,.*EnergyDayLast:r1,.*EnergyMonth:r0,.*EnergyMonthLast:r0,.*EnergyYear:r0
attr Heat_pumps alias <span style='color:#696969'><b>Heat pumps [kWh]</b><span/>
attr Heat_pumps cellStyle {"c:1" => 'style="font-weight:bold;;color:#2E5E87;;"'}
attr Heat_pumps nameStyle style="font-weight:bold;;color:#2E5E87"
attr Heat_pumps nonames 1
attr Heat_pumps sortDevices 1
attr Heat_pumps valueStyle {if ($READING =~ "EnergyDay" and $READING !~ "EnergyDayLast" \
and (($DEVICE =~"myHeisha" and ReadingsNum('HeishaMon_main','Heatpump_State','') == 1) \
or ($DEVICE eq "myDaikinPerferaCalculator" and ReadingsVal('DaikinCloud_DaikinAP09627','onOffMode','') eq "on") \
or ($DEVICE eq "myVaillantaroSTORCalculator" and ReadingsNum('VaillantaroSTOR','Power_W','') > 50) \
or ($DEVICE eq "myFujitsuCalculator" and ReadingsNum('Fujitsu','Power_W','') > 30))) \
{'style="color:magenta;;font-weight:bold;;"'}}

Alle meinen bisherigen Versuche waren im besten Fall wirkungslos oder haben die Darstellung der Tabelle zerstört.

Viele Grüße Gisbert
Proxmox | UniFi | Homematic, VCCU, HMUART | ESP8266 | ATtiny85 | Wasser-, Stromzähler | tuya local | Wlan-Kamera | SIGNALduino, Rauchmelder FA21/22RF | RHASSPY | DEYE | JK-BMS | ESPHome | Panasonic Heishamon