Fixed typo in formatsgtring and error if numeric template didn't return a value

This commit is contained in:
thmichel
2025-10-29 14:41:32 +01:00
parent 6a0ec34cdb
commit b0fa10b2c1
2 changed files with 5 additions and 2 deletions

View File

@@ -630,9 +630,12 @@ class HomeAssistantApp extends Application.AppBase {
(item as HomeAssistantToggleMenuItem).updateToggleState(data[i.toString() + "t"]); (item as HomeAssistantToggleMenuItem).updateToggleState(data[i.toString() + "t"]);
} }
if (item instanceof HomeAssistantNumericMenuItem) { if (item instanceof HomeAssistantNumericMenuItem) {
if (data[i.toString() + "n"] != null)
{
(item as HomeAssistantNumericMenuItem).updateNumericState(data[i.toString() + "n"].toString()); (item as HomeAssistantNumericMenuItem).updateNumericState(data[i.toString() + "n"].toString());
} }
} }
}
if (Settings.getMenuCheck() && Settings.getCacheConfig() && !mIsCacheChecked) { if (Settings.getMenuCheck() && Settings.getCacheConfig() && !mIsCacheChecked) {
// We are caching the menu configuration, so let's fetch it and check if its been updated. // We are caching the menu configuration, so let's fetch it and check if its been updated.
var stats = System.getSystemStats(); // stats.* values in bytes var stats = System.getSystemStats(); // stats.* values in bytes

View File

@@ -47,7 +47,7 @@ class HomeAssistantNumericFactory extends WatchUi.PickerFactory {
if (mStep < 0.01) { if (mStep < 0.01) {
mFormatString="%.3f"; mFormatString="%.3f";
} else if (mStep < 0.1) { } else if (mStep < 0.1) {
mFormatString="%2f"; mFormatString="%.2f";
} else if (mStep < 1) { } else if (mStep < 1) {
mFormatString="%.1f"; mFormatString="%.1f";
} else { } else {