Skip to content

Commit

Permalink
Don't use device locale when formatting state for icons
Browse files Browse the repository at this point in the history
The server expects to be able to parse the passed state as number, which
is not possible in e.g. German locale: in that case, e.g. '20,0 °C'
instead of the expected '20.0 °C' was passed.

Fixes #3472

Signed-off-by: Danny Baumann <[email protected]>
  • Loading branch information
maniac103 committed Sep 12, 2023
1 parent 2dc95ac commit 815a8bc
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal fun String?.toOH2WidgetIconResource(
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()
stateToUse.asNumber?.toString(Locale.US)
}
item.isOfTypeOrGroupType(Item.Type.Color) -> when {
// Color sliders just use the brightness part of the color
Expand Down

0 comments on commit 815a8bc

Please sign in to comment.