From 84026b732df312b969f1eefc6c78f751f753152b Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Thu, 31 Aug 2023 09:20:54 +0200 Subject: [PATCH] Send NULL state as 'null' when requesting icons BasicUI set a predecent for doing so, and users are relying on that behavior. Fixes #3461 Signed-off-by: Danny Baumann --- .../src/main/java/org/openhab/habdroid/model/IconResource.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/org/openhab/habdroid/model/IconResource.kt b/mobile/src/main/java/org/openhab/habdroid/model/IconResource.kt index 0e5939a0d6..68b7622fbf 100644 --- a/mobile/src/main/java/org/openhab/habdroid/model/IconResource.kt +++ b/mobile/src/main/java/org/openhab/habdroid/model/IconResource.kt @@ -137,7 +137,9 @@ internal fun String?.toOH2WidgetIconResource( val stateToUse = state ?: item?.state val iconState = when { - stateToUse == null || !useState || item == null -> null + !useState || item == null -> null + // For NULL states, we send 'null' as state when fetching the icon (BasicUI set a predecent for doing so) + stateToUse == null -> "null" // Number items need to use state formatted as per their state description item.isOfTypeOrGroupType(Item.Type.Number) || item.isOfTypeOrGroupType(Item.Type.NumberWithDimension)-> { stateToUse.asNumber.toString()