diff --git a/source/HomeAssistantMenuItem.mc b/source/HomeAssistantMenuItem.mc index d72ada3..0212227 100644 --- a/source/HomeAssistantMenuItem.mc +++ b/source/HomeAssistantMenuItem.mc @@ -89,15 +89,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem { } if (WatchUi has :showToast) { WatchUi.showToast(toast, null); - } - if (Attention has :vibrate) { - Attention.vibrate([ - new Attention.VibeProfile(50, 100), // On for 100ms - new Attention.VibeProfile( 0, 100), // Off for 100ms - new Attention.VibeProfile(50, 100) // On for 100ms - ]); - } - if (!(WatchUi has :showToast) && !(Attention has :vibrate)) { + } else { new Alert({ :timeout => Globals.scAlertTimeout, :font => Graphics.FONT_MEDIUM, @@ -128,7 +120,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem { // ERROR: venu: Cannot find symbol ':substring' on type 'PolyType'. var id = mIdentifier as Lang.String; if (mService == null) { - var url = (Properties.getValue("api_url") as Lang.String) + "/services/" + id.substring(0, id.find(".")) + "/" + id.substring(id.find(".")+1, id.length()); + var url = (Properties.getValue("api_url") as Lang.String) + "/services/" + id.substring(0, id.find(".")) + "/" + id.substring(id.find(".")+1, null); if (Globals.scDebug) { System.println("HomeAssistantMenuItem execScript() URL=" + url); System.println("HomeAssistantMenuItem execScript() mIdentifier=" + mIdentifier); @@ -154,6 +146,13 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem { method(:onReturnExecScript) ); } + if (Attention has :vibrate) { + Attention.vibrate([ + new Attention.VibeProfile(50, 100), // On for 100ms + new Attention.VibeProfile( 0, 100), // Off for 100ms + new Attention.VibeProfile(50, 100) // On for 100ms + ]); + } } else { if (Globals.scDebug) { System.println("HomeAssistantMenuItem execScript(): No Internet connection, skipping API call.");