Additional changes for the previous merge.

This commit is contained in:
Philip Abbey
2023-11-11 07:49:15 +00:00
parent 80e56e5969
commit b7ed8607fb
3 changed files with 8 additions and 6 deletions

View File

@ -63,6 +63,7 @@
<iq:product id="edgeexplore2"/>
<!-- Screen Size 280x280 launcher icon size 40x40 -->
<iq:product id="enduro"/>
<!-- Screen Size 416x416 launcher icon size 60x60 -->
<iq:product id="epix2"/>
<!-- Screen Size 390x390 launcher icon size 60x60 -->
<iq:product id="epix2pro42mm"/>

View File

@ -23,8 +23,8 @@ using Toybox.Lang;
class Globals {
// Enable printing of messages to the debug console (don't make this a Property
// as the messages can't be read from a watch!)
static const debug = true;
static const updateInterval = 5; // seconds
static const debug = false;
static const updateInterval = 10; // seconds
static const alertTimeout = 2000; // ms
static const tapTimeout = 1000; // ms
}

View File

@ -93,6 +93,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
var options = {
:method => Communications.HTTP_REQUEST_METHOD_POST,
:headers => {
"Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON,
"Authorization" => "Bearer " + api_key
},
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
@ -114,10 +115,10 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
method(:onReturnExecScript)
);
} else {
var url = Properties.getValue("api_url") + "/services/" + mService.substring(0, mService.find(".")) + "/" + mService.substring(mService.find(".")+1, null);
var url = (Properties.getValue("api_url") as Lang.String) + "/services/" + mService.substring(0, mService.find(".")) + "/" + mService.substring(mService.find(".")+1, null);
if (Globals.debug) {
System.println("URL=" + url);
System.println("mIdentifier=" + mIdentifier);
System.println("HomeAssistantMenuItem execScript() URL=" + url);
System.println("HomeAssistantMenuItem execScript() mIdentifier=" + mIdentifier);
}
Communications.makeWebRequest(
url,
@ -125,7 +126,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
"entity_id" => id
},
options,
method(:onReturnSetState)
method(:onReturnExecScript)
);
}
} else {