Skip to content

Commit 94fc434

Browse files
authored
Merge pull request #444 from mathoudebine/fix/442-custom-stats-do-not-update-visuals-if-string-or-numeric-value-is-falsy-but-not-none
2 parents 58b9a49 + 7de2f26 commit 94fc434

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/stats.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,22 +512,22 @@ def stats():
512512
logger.error("Custom sensor class " + str(custom_stat) + " not found in sensors_custom.py")
513513
return
514514

515-
if not string_value:
515+
if string_value is None:
516516
string_value = str(numeric_value)
517517

518518
# Display text
519519
theme_data = config.THEME_DATA['STATS']['CUSTOM'][custom_stat].get("TEXT", None)
520-
if theme_data and string_value:
520+
if theme_data and string_value is not None:
521521
display_themed_value(theme_data=theme_data, value=string_value)
522522

523523
# Display graph from numeric value
524524
theme_data = config.THEME_DATA['STATS']['CUSTOM'][custom_stat].get("GRAPH", None)
525-
if theme_data and numeric_value:
525+
if theme_data and numeric_value is not None:
526526
display_themed_progress_bar(theme_data=theme_data, value=numeric_value)
527527

528528
# Display radial from numeric and text value
529529
theme_data = config.THEME_DATA['STATS']['CUSTOM'][custom_stat].get("RADIAL", None)
530-
if theme_data and numeric_value and string_value:
530+
if theme_data and numeric_value is not None and string_value is not None:
531531
display_themed_radial_bar(
532532
theme_data=theme_data,
533533
value=numeric_value,

0 commit comments

Comments
 (0)