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"/> <iq:product id="edgeexplore2"/>
<!-- Screen Size 280x280 launcher icon size 40x40 --> <!-- Screen Size 280x280 launcher icon size 40x40 -->
<iq:product id="enduro"/> <iq:product id="enduro"/>
<!-- Screen Size 416x416 launcher icon size 60x60 -->
<iq:product id="epix2"/> <iq:product id="epix2"/>
<!-- Screen Size 390x390 launcher icon size 60x60 --> <!-- Screen Size 390x390 launcher icon size 60x60 -->
<iq:product id="epix2pro42mm"/> <iq:product id="epix2pro42mm"/>

View File

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

View File

@ -93,6 +93,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
var options = { var options = {
:method => Communications.HTTP_REQUEST_METHOD_POST, :method => Communications.HTTP_REQUEST_METHOD_POST,
:headers => { :headers => {
"Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON,
"Authorization" => "Bearer " + api_key "Authorization" => "Bearer " + api_key
}, },
:responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
@ -114,10 +115,10 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
method(:onReturnExecScript) method(:onReturnExecScript)
); );
} else { } 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) { if (Globals.debug) {
System.println("URL=" + url); System.println("HomeAssistantMenuItem execScript() URL=" + url);
System.println("mIdentifier=" + mIdentifier); System.println("HomeAssistantMenuItem execScript() mIdentifier=" + mIdentifier);
} }
Communications.makeWebRequest( Communications.makeWebRequest(
url, url,
@ -125,7 +126,7 @@ class HomeAssistantMenuItem extends WatchUi.MenuItem {
"entity_id" => id "entity_id" => id
}, },
options, options,
method(:onReturnSetState) method(:onReturnExecScript)
); );
} }
} else { } else {