mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-05-01 05:02:34 +00:00
Largely cosmetic
Removed debug that escaped. Belt & braces field to prevent the update chain being started twice.
This commit is contained in:
@ -39,6 +39,7 @@ class HomeAssistantApp extends Application.AppBase {
|
||||
private var mIsGlance as Lang.Boolean = false;
|
||||
private var mIsApp as Lang.Boolean = false; // Or Widget
|
||||
private var mIsInitUpdateCompl as Lang.Boolean = false;
|
||||
private var mUpdating as Lang.Boolean = false; // Don't start a second chain of updates
|
||||
|
||||
function initialize() {
|
||||
AppBase.initialize();
|
||||
@ -262,11 +263,12 @@ class HomeAssistantApp extends Application.AppBase {
|
||||
}
|
||||
|
||||
function startUpdates() {
|
||||
if (mHaMenu != null) {
|
||||
if (mHaMenu != null and !mUpdating) {
|
||||
mItemsToUpdate = mHaMenu.getItemsToUpdate();
|
||||
// Start the continuous update process that continues for as long as the application is running.
|
||||
// The chain of functions from 'updateNextMenuItem()' calls 'updateNextMenuItem()' on completion.
|
||||
if (mItemsToUpdate.size() > 0) {
|
||||
mUpdating = true;
|
||||
updateNextMenuItemInternal();
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class HomeAssistantTemplateMenuItem extends WatchUi.IconMenuItem {
|
||||
} else if(label instanceof Lang.String) {
|
||||
setSubLabel(label);
|
||||
} else if(label instanceof Lang.Dictionary) {
|
||||
System.println("HomeAssistantTemplateMenuItem onReturnGetState() label = " + label);
|
||||
// System.println("HomeAssistantTemplateMenuItem onReturnGetState() label = " + label);
|
||||
if (label.get("error") != null) {
|
||||
setSubLabel($.Rez.Strings.TemplateError);
|
||||
} else {
|
||||
@ -165,8 +165,6 @@ class HomeAssistantTemplateMenuItem extends WatchUi.IconMenuItem {
|
||||
// System.println("HomeAssistantTemplateMenuItem getState(): No Internet connection, skipping API call.");
|
||||
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoInternet) as Lang.String + ".");
|
||||
getApp().setApiStatus(WatchUi.loadResource($.Rez.Strings.Unavailable) as Lang.String);
|
||||
} else if (Settings.getWebhookId().equals("")) {
|
||||
getApp().updateNextMenuItem();
|
||||
} else {
|
||||
// https://developers.home-assistant.io/docs/api/native-app-integration/sending-data/#render-templates
|
||||
var url = Settings.getApiUrl() + "/webhook/" + Settings.getWebhookId();
|
||||
|
Reference in New Issue
Block a user