diff --git a/resources-icons-18/group_type.svg b/resources-icons-18/group_type.svg index 112af83..6674481 100644 --- a/resources-icons-18/group_type.svg +++ b/resources-icons-18/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-21/group_type.svg b/resources-icons-21/group_type.svg index df98500..008b771 100644 --- a/resources-icons-21/group_type.svg +++ b/resources-icons-21/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-24/group_type.svg b/resources-icons-24/group_type.svg index c00a567..aa4dd3b 100644 --- a/resources-icons-24/group_type.svg +++ b/resources-icons-24/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-26/group_type.svg b/resources-icons-26/group_type.svg index 42cd60b..499cf8a 100644 --- a/resources-icons-26/group_type.svg +++ b/resources-icons-26/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-28/group_type.svg b/resources-icons-28/group_type.svg index 6275c28..b65f16c 100644 --- a/resources-icons-28/group_type.svg +++ b/resources-icons-28/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-30/group_type.svg b/resources-icons-30/group_type.svg index 0011419..7fbe2d8 100644 --- a/resources-icons-30/group_type.svg +++ b/resources-icons-30/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-32/group_type.svg b/resources-icons-32/group_type.svg index ba31d0d..f05d5e8 100644 --- a/resources-icons-32/group_type.svg +++ b/resources-icons-32/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-38/group_type.svg b/resources-icons-38/group_type.svg index 463d1f3..047ca5d 100644 --- a/resources-icons-38/group_type.svg +++ b/resources-icons-38/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-42/group_type.svg b/resources-icons-42/group_type.svg index 2ee5924..466859c 100644 --- a/resources-icons-42/group_type.svg +++ b/resources-icons-42/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-46/group_type.svg b/resources-icons-46/group_type.svg index 6972e86..9ab686b 100644 --- a/resources-icons-46/group_type.svg +++ b/resources-icons-46/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/resources-icons-48/group_type.svg b/resources-icons-48/group_type.svg index 3330af1..6a867e2 100644 --- a/resources-icons-48/group_type.svg +++ b/resources-icons-48/group_type.svg @@ -1 +1,8 @@ - + + + + + + + + diff --git a/resources-icons-53/group_type.svg b/resources-icons-53/group_type.svg index 15f81e0..db5d902 100644 --- a/resources-icons-53/group_type.svg +++ b/resources-icons-53/group_type.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/source/ErrorView.mc b/source/ErrorView.mc index 701f473..63257f9 100644 --- a/source/ErrorView.mc +++ b/source/ErrorView.mc @@ -138,7 +138,7 @@ class ErrorDelegate extends WatchUi.BehaviorDelegate { WatchUi.BehaviorDelegate.initialize(); } - function onBack() { + function onBack() as Lang.Boolean { getApp().getQuitTimer().reset(); ErrorView.unShow(); return true; diff --git a/source/HomeAssistantApp.mc b/source/HomeAssistantApp.mc index 0407678..58c7900 100644 --- a/source/HomeAssistantApp.mc +++ b/source/HomeAssistantApp.mc @@ -352,6 +352,10 @@ class HomeAssistantApp extends Application.AppBase { ); } + function setApiStatus(s as Lang.String) { + mApiStatus = s; + } + (:glance) function getApiStatus() as Lang.String { return mApiStatus; diff --git a/source/HomeAssistantToggleMenuItem.mc b/source/HomeAssistantToggleMenuItem.mc index 31d31f2..ab3a85c 100644 --- a/source/HomeAssistantToggleMenuItem.mc +++ b/source/HomeAssistantToggleMenuItem.mc @@ -32,6 +32,8 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { private var strApiFlood = WatchUi.loadResource($.Rez.Strings.ApiFlood); private var strApiUrlNotFound = WatchUi.loadResource($.Rez.Strings.ApiUrlNotFound); private var strUnhandledHttpErr = WatchUi.loadResource($.Rez.Strings.UnhandledHttpErr); + private var strUnavailable = WatchUi.loadResource($.Rez.Strings.Unavailable); + private var strAvailable = WatchUi.loadResource($.Rez.Strings.Available); private var mApiKey as Lang.String; @@ -74,6 +76,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { // Provide the ability to terminate updating chain of calls for a permanent network error. var keepUpdating = true; + var status = strUnavailable; switch (responseCode) { case Communications.BLE_HOST_TIMEOUT: case Communications.BLE_CONNECTION_UNAVAILABLE: @@ -144,6 +147,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { break; case 200: + status = strAvailable; var state = data.get("state") as Lang.String; if (Globals.scDebug) { System.println((data.get("attributes") as Lang.Dictionary).get("friendly_name") + " State=" + state); @@ -165,6 +169,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { // Now this feels very "closely coupled" to the application, but it is the most reliable method instead of using a timer. getApp().updateNextMenuItem(); } + getApp().setApiStatus(status); } function getState() as Void { @@ -221,6 +226,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { System.println("HomeAssistantToggleMenuItem onReturnSetState() Response Data: " + data); } + var status = strUnavailable; switch (responseCode) { case Communications.BLE_HOST_TIMEOUT: case Communications.BLE_CONNECTION_UNAVAILABLE: @@ -270,6 +276,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { setUiToggle(state); } } + status = strAvailable; break; default: @@ -278,6 +285,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem { } ErrorView.show(strUnhandledHttpErr + responseCode); } + getApp().setApiStatus(status); } function setState(s as Lang.Boolean) as Void { diff --git a/source/RootView.mc b/source/RootView.mc index 102028f..1d412d5 100644 --- a/source/RootView.mc +++ b/source/RootView.mc @@ -95,9 +95,6 @@ class RootView extends ScalableView { :locX => w/2 + scMidSep/2, :locY => pixelsForScreen(70.0) }); - - - } function onUpdate(dc as Graphics.Dc) as Void {