From 7de2f26d187bbc0948a18628997d1f91e913f18b Mon Sep 17 00:00:00 2001 From: Matthieu Houdebine Date: Wed, 10 Jan 2024 14:14:33 +0100 Subject: [PATCH] Fix: Custom stats not displayed if numeric value is zero --- library/stats.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/stats.py b/library/stats.py index b0bb70ee..9dfe0a20 100644 --- a/library/stats.py +++ b/library/stats.py @@ -512,22 +512,22 @@ def stats(): logger.error("Custom sensor class " + str(custom_stat) + " not found in sensors_custom.py") return - if not string_value: + if string_value is None: string_value = str(numeric_value) # Display text theme_data = config.THEME_DATA['STATS']['CUSTOM'][custom_stat].get("TEXT", None) - if theme_data and string_value: + if theme_data and string_value is not None: display_themed_value(theme_data=theme_data, value=string_value) # Display graph from numeric value theme_data = config.THEME_DATA['STATS']['CUSTOM'][custom_stat].get("GRAPH", None) - if theme_data and numeric_value: + if theme_data and numeric_value is not None: display_themed_progress_bar(theme_data=theme_data, value=numeric_value) # Display radial from numeric and text value theme_data = config.THEME_DATA['STATS']['CUSTOM'][custom_stat].get("RADIAL", None) - if theme_data and numeric_value and string_value: + if theme_data and numeric_value is not None and string_value is not None: display_themed_radial_bar( theme_data=theme_data, value=numeric_value,