mirror of
				https://github.com/house-of-abbey/GarminHomeAssistant.git
				synced 2025-11-04 00:48:14 +00:00 
			
		
		
		
	Added alerts on error
And removed (and changed) API key... doh!
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,4 @@
 | 
				
			|||||||
bin/
 | 
					bin/
 | 
				
			||||||
export/
 | 
					export/
 | 
				
			||||||
**/Thumbs.db
 | 
					**/Thumbs.db
 | 
				
			||||||
 | 
					settings.txt
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,14 +13,14 @@
 | 
				
			|||||||
-->
 | 
					-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<properties>
 | 
					<properties>
 | 
				
			||||||
  <property id="api_key"    type="string">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI1OTEzODI3NzhiNDI0MzU5OGVmYzY4ZmM2YzZiZTU3ZCIsImlhdCI6MTY5ODU3MDg0MywiZXhwIjoyMDEzOTMwODQzfQ.vskr0ERbnEXjB51vVHwlXosy3JK3v1znHzv8Hiej8zA</property>
 | 
					  <property id="api_key"    type="string"></property>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!--
 | 
					  <!--
 | 
				
			||||||
    Internal URL "https://homeassistant.local/api"
 | 
					    Internal URL "https://homeassistant.local/api"
 | 
				
			||||||
    External URL "https://<dynamic DNS>/api"
 | 
					    External URL "https://<dynamic DNS>/api"
 | 
				
			||||||
  -->
 | 
					  -->
 | 
				
			||||||
  <property id="api_url"    type="string">https://home.abbey1.org.uk/api</property>
 | 
					  <property id="api_url"    type="string"></property>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- Best be a public URL in order to work away from your home LAN and have a trusted HTTPS certificate -->
 | 
					  <!-- Best be a public URL in order to work away from your home LAN and have a trusted HTTPS certificate -->
 | 
				
			||||||
  <property id="config_url" type="string">https://home.abbey1.org.uk/local/garmin/philip.json</property>
 | 
					  <property id="config_url" type="string"></property>
 | 
				
			||||||
</properties>
 | 
					</properties>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ class HomeAssistantApp extends Application.AppBase {
 | 
				
			|||||||
            new Alert({
 | 
					            new Alert({
 | 
				
			||||||
                :timeout => Globals.alertTimeout,
 | 
					                :timeout => Globals.alertTimeout,
 | 
				
			||||||
                :font    => Graphics.FONT_SYSTEM_MEDIUM,
 | 
					                :font    => Graphics.FONT_SYSTEM_MEDIUM,
 | 
				
			||||||
                :text    => "Error " + responseCode,
 | 
					                :text    => "onReturnFetchMenuConfig Error " + responseCode,
 | 
				
			||||||
                :fgcolor => Graphics.COLOR_RED,
 | 
					                :fgcolor => Graphics.COLOR_RED,
 | 
				
			||||||
                :bgcolor => Graphics.COLOR_BLACK
 | 
					                :bgcolor => Graphics.COLOR_BLACK
 | 
				
			||||||
            }).pushView(WatchUi.SLIDE_IMMEDIATE);
 | 
					            }).pushView(WatchUi.SLIDE_IMMEDIATE);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,6 +86,13 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
 | 
				
			|||||||
            if (Globals.debug) {
 | 
					            if (Globals.debug) {
 | 
				
			||||||
                System.println("HomeAssistantMenuItem Note - executeScript(): No Internet connection, skipping API call.");
 | 
					                System.println("HomeAssistantMenuItem Note - executeScript(): No Internet connection, skipping API call.");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            new Alert({
 | 
				
			||||||
 | 
					                :timeout => Globals.alertTimeout,
 | 
				
			||||||
 | 
					                :font    => Graphics.FONT_SYSTEM_MEDIUM,
 | 
				
			||||||
 | 
					                :text    => "No Internet connection",
 | 
				
			||||||
 | 
					                :fgcolor => Graphics.COLOR_RED,
 | 
				
			||||||
 | 
					                :bgcolor => Graphics.COLOR_BLACK
 | 
				
			||||||
 | 
					            }).pushView(WatchUi.SLIDE_IMMEDIATE);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,6 +97,13 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
 | 
				
			|||||||
            if (Globals.debug) {
 | 
					            if (Globals.debug) {
 | 
				
			||||||
                System.println("HomeAssistantToggleMenuItem Note - getState(): No Internet connection, skipping API call.");
 | 
					                System.println("HomeAssistantToggleMenuItem Note - getState(): No Internet connection, skipping API call.");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            new Alert({
 | 
				
			||||||
 | 
					                :timeout => Globals.alertTimeout,
 | 
				
			||||||
 | 
					                :font    => Graphics.FONT_SYSTEM_MEDIUM,
 | 
				
			||||||
 | 
					                :text    => "No Internet connection",
 | 
				
			||||||
 | 
					                :fgcolor => Graphics.COLOR_RED,
 | 
				
			||||||
 | 
					                :bgcolor => Graphics.COLOR_BLACK
 | 
				
			||||||
 | 
					            }).pushView(WatchUi.SLIDE_IMMEDIATE);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -154,6 +161,13 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
 | 
				
			|||||||
            if (Globals.debug) {
 | 
					            if (Globals.debug) {
 | 
				
			||||||
                System.println("HomeAssistantToggleMenuItem Note - setState(): No Internet connection, skipping API call.");
 | 
					                System.println("HomeAssistantToggleMenuItem Note - setState(): No Internet connection, skipping API call.");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            new Alert({
 | 
				
			||||||
 | 
					                :timeout => Globals.alertTimeout,
 | 
				
			||||||
 | 
					                :font    => Graphics.FONT_SYSTEM_MEDIUM,
 | 
				
			||||||
 | 
					                :text    => "No Internet connection",
 | 
				
			||||||
 | 
					                :fgcolor => Graphics.COLOR_RED,
 | 
				
			||||||
 | 
					                :bgcolor => Graphics.COLOR_BLACK
 | 
				
			||||||
 | 
					            }).pushView(WatchUi.SLIDE_IMMEDIATE);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user