FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: jostmario am 02 Oktober 2022, 19:04:32

Titel: Nachkommastellen im Stateformat
Beitrag von: jostmario am 02 Oktober 2022, 19:04:32
Hallo,

kann mir jemand helfen wie ich hier sprintf bei den Readings L1Watt L2Watt L3 Watt einbauen kann das er mir nur 2 nachkommmastellen anzeigt.

so hab ich es im def vom Stateformat stehen:


<p style='font-family: Arial; font-size: 50px; color: blue;'>  watt Watt  </p>  <p style='font-family: Arial; font-size: 50px; color: yellow;'>    kwhToday kwh </p>

</div> <div style='color:red; text-align:center; font-size: 40px; '>L1-->  L1Watt  </div>

<div style='color:yellow; text-align:center;font-size: 40px; '> L2 -->  L2Watt Watt  </div>

<div style='color:green; text-align:center;font-size: 40px;'> L3 --> L3Watt Watt</div> 





Titel: Antw:Nachkommastellen im Stateformat
Beitrag von: Nighthawk am 02 Oktober 2022, 20:07:22
Bei meinem Stromzähler wir das so bewerkstelliigt:

{sprintf("
<TABLE>

<TR>
  <TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">
    Verbrauch Heute: %0.2f kWh<br>
    <br>
    Zaehlerstand: %0.2f kWh<br>
  </TD>

  <TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">
    Gesamt: %0.1f Watt<br>
    L1:     %0.1f Watt<br>
    L2:     %0.1f Watt<br>
    L3:     %0.1f Watt
  </TD>
</TR>

</TABLE>
" , ReadingsVal($name,"statTotal_consumptionDay",0) ,
ReadingsVal($name,"total_consumption",0),
ReadingsVal($name,"power",0) ,
ReadingsVal($name,"power_L1",0) ,
ReadingsVal($name,"power_L2",0) ,
ReadingsVal($name,"power_L3",0)  )}