joBr99 / nspanel-lovelace-ui

Custom Firmware for NsPanel with the design of HomeAssistant's lovelace UI in mind, works with Tasmota.
GNU General Public License v3.0
872 stars 188 forks source link

[BUG] HandleScreensaverStatusIcons() :Falsches Abfrage Ergebnis bei IsNAN , wenn Value (String) die Länge 0 hat, #1098

Closed SurfGargano closed 8 months ago

SurfGargano commented 9 months ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.

Wenn in den mrIcons Value der Type String eingetragen ist und das Value die Länge 0 hat, wird fälschlicherweise die Funktion isNAN mit false ausgegeben. Somit geht er in die Routine für Nummer und die Funktion .toFixed schlägt fehl. Da die Abfrage sowieso für String ist, würde ich den String einfach nehmen wie er ist und anzeigen ohne Formatierung.

if (config.mrIcon1ScreensaverEntity.ScreensaverEntityValue != null) { if (isNaN(getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val) == false) { payloadString += (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon1ScreensaverEntity.ScreensaverEntityValueDecimalPlace); payloadString += (config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit; if (Debug) log('Value ist eine Zahl ' + payloadString, 'info') } else { payloadString += getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val if (Debug) log('Value ist keine Zahl ' + payloadString, 'info') } }

Dasgleiche gilt für mr2Icon auch.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [ ] Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:

Log output here:



### TO REPRODUCE
_Steps to reproduce the behavior:_

Entfernen der Funktion für Number Formatierung

### EXPECTED BEHAVIOUR
_A clear and concise description of what you expected to happen._

### SCREENSHOTS
_If applicable, add screenshots/pictures to help explain your problem._

### ADDITIONAL CONTEXT
_Add any other context about the problem here._
_Please note here in case you are using ioBroker_

### PANEL / FIRMWARE VERION
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
IObroker v4.3.3.24 
Armilar commented 8 months ago

v.4.3.3.38 (in Kürze)