mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-10-31 23:48:13 +00:00
Suggested code changes from philipabbey
1. attribute is option, so needs a different template in the API call when absent. 2. Automatically derive the format string from the picker step value for any precision of step. 3. Changed all Lang.String representations of numbers to Lang.Number or Lang.Float. I'm keen to remove the use of strings to hold a numeric value. 4. Tidied up and completed some code comments. 5. Adjusted the JSON schema definition. This is still not finished as the 'picker' object is required for 'numeric' menu items and must not be present for the others. Additional schema changes are required for greater precision. 6. Moved fields over from 'data' to 'picker'.
This commit is contained in:
@@ -630,8 +630,10 @@ class HomeAssistantApp extends Application.AppBase {
|
||||
(item as HomeAssistantToggleMenuItem).updateToggleState(data[i.toString() + "t"]);
|
||||
}
|
||||
if (item instanceof HomeAssistantNumericMenuItem) {
|
||||
// (item as HomeAssistantNumericMenuItem).updateNumericState("22");
|
||||
(item as HomeAssistantNumericMenuItem).updateNumericState(data[i.toString() + "n"].toString());
|
||||
var s = data[i.toString() + "n"];
|
||||
if ((s instanceof Lang.Number) or (s instanceof Lang.Float)) {
|
||||
(item as HomeAssistantNumericMenuItem).setValue(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.getMenuCheck() && Settings.getCacheConfig() && !mIsCacheChecked) {
|
||||
@@ -831,7 +833,7 @@ class HomeAssistantApp extends Application.AppBase {
|
||||
var phoneConnected = System.getDeviceSettings().phoneConnected;
|
||||
var connectionAvailable = System.getDeviceSettings().connectionAvailable;
|
||||
|
||||
// System.println("API URL = " + Settings.getApiUrl());
|
||||
// System.println("HomeAssistantApp fetchApiStatus(): API URL = " + Settings.getApiUrl());
|
||||
if (Settings.getApiUrl().equals("")) {
|
||||
mApiStatus = WatchUi.loadResource($.Rez.Strings.Unconfigured) as Lang.String;
|
||||
WatchUi.requestUpdate();
|
||||
|
||||
Reference in New Issue
Block a user