mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-11-07 18:18:14 +00:00
rename service to action
This commit is contained in:
@@ -97,7 +97,7 @@ class HomeAssistantMenuItemFactory {
|
||||
//! @param label Menu item label.
|
||||
//! @param entity_id Home Assistant Entity ID (optional)
|
||||
//! @param template Template for Home Assistant to render (optional)
|
||||
//! @param service Template for Home Assistant to render (optional)
|
||||
//! @param action Action to run on Home Assistant (optional)
|
||||
//! @param data Sourced from the menu JSON, this is the `data` field from the `tap_action` field.
|
||||
//! @param options Menu item options to be passed on, including both SDK and menu options, e.g. exit, confirm & pin.
|
||||
//
|
||||
@@ -105,7 +105,7 @@ class HomeAssistantMenuItemFactory {
|
||||
label as Lang.String or Lang.Symbol,
|
||||
entity_id as Lang.String?,
|
||||
template as Lang.String?,
|
||||
service as Lang.String?,
|
||||
action as Lang.String?,
|
||||
data as Lang.Dictionary?,
|
||||
options as {
|
||||
:exit as Lang.Boolean,
|
||||
@@ -124,12 +124,12 @@ class HomeAssistantMenuItemFactory {
|
||||
for (var i = 0; i < keys.size(); i++) {
|
||||
options[keys[i]] = mMenuItemOptions.get(keys[i]);
|
||||
}
|
||||
if (service != null) {
|
||||
options[:icon] = mTapTypeIcon;
|
||||
if (action != null) {
|
||||
options.put(:icon, mTapTypeIcon);
|
||||
return new HomeAssistantTapMenuItem(
|
||||
label,
|
||||
template,
|
||||
service,
|
||||
action,
|
||||
data,
|
||||
options,
|
||||
mHomeAssistantService
|
||||
@@ -155,8 +155,8 @@ class HomeAssistantMenuItemFactory {
|
||||
label as Lang.String or Lang.Symbol,
|
||||
entity_id as Lang.String?,
|
||||
template as Lang.String?,
|
||||
service as Lang.String?,
|
||||
picker as Lang.Dictionary,
|
||||
action as Lang.String?,
|
||||
data as Lang.Dictionary?,
|
||||
options as {
|
||||
:exit as Lang.Boolean,
|
||||
:confirm as Lang.Boolean,
|
||||
@@ -176,7 +176,7 @@ class HomeAssistantMenuItemFactory {
|
||||
return new HomeAssistantNumericMenuItem(
|
||||
label,
|
||||
template,
|
||||
service,
|
||||
action,
|
||||
data,
|
||||
picker,
|
||||
options,
|
||||
|
||||
@@ -22,7 +22,7 @@ using Toybox.Graphics;
|
||||
//
|
||||
class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
private var mHomeAssistantService as HomeAssistantService?;
|
||||
private var mService as Lang.String?;
|
||||
private var mAction as Lang.String?;
|
||||
private var mConfirm as Lang.Boolean;
|
||||
private var mExit as Lang.Boolean;
|
||||
private var mPin as Lang.Boolean;
|
||||
@@ -35,11 +35,11 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
//!
|
||||
//! @param label Menu item label.
|
||||
//! @param template Menu item template.
|
||||
//! @param service Menu item service.
|
||||
//! @param data Data to supply to the service call.
|
||||
//! @param exit Should the service call complete and then exit?
|
||||
//! @param confirm Should the service call be confirmed to avoid accidental invocation?
|
||||
//! @param pin Should the service call be protected with a PIN for some low level of security?
|
||||
//! @param action Menu item action.
|
||||
//! @param data Data to supply to the action call.
|
||||
//! @param exit Should the action call complete and then exit?
|
||||
//! @param confirm Should the action call be confirmed to avoid accidental invocation?
|
||||
//! @param pin Should the action call be protected with a PIN for some low level of security?
|
||||
//! @param icon Icon to use for the menu item.
|
||||
//! @param options Menu item options to be passed on, including both SDK and menu options, e.g. exit, confirm & pin.
|
||||
//! @param haService Shared Home Assistant service object that will perform the required call. Only
|
||||
@@ -48,7 +48,7 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
function initialize(
|
||||
label as Lang.String or Lang.Symbol,
|
||||
template as Lang.String,
|
||||
service as Lang.String?,
|
||||
action as Lang.String?,
|
||||
data as Lang.Dictionary?,
|
||||
picker as Lang.Dictionary,
|
||||
options as {
|
||||
@@ -60,7 +60,7 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
}?,
|
||||
haService as HomeAssistantService
|
||||
) {
|
||||
mService = service;
|
||||
mAction = action;
|
||||
mData = data;
|
||||
mPicker = picker;
|
||||
mExit = options[:exit];
|
||||
@@ -93,7 +93,8 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
}
|
||||
}
|
||||
|
||||
function callService() as Void {
|
||||
|
||||
function callAction() as Void {
|
||||
var hasTouchScreen = System.getDeviceSettings().isTouchScreen;
|
||||
if (mPin && hasTouchScreen) {
|
||||
var pin = Settings.getPin();
|
||||
@@ -119,8 +120,8 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
WatchUi.pushView(
|
||||
dialog,
|
||||
new WifiLteExecutionConfirmDelegate({
|
||||
:type => "service",
|
||||
:service => mService,
|
||||
:type => "action",
|
||||
:action => mAction,
|
||||
:data => mData,
|
||||
:exit => mExit,
|
||||
}, dialog),
|
||||
@@ -150,18 +151,18 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
function onConfirm(b as Lang.Boolean) as Void {
|
||||
var dataAttribute = mPicker["data_attribute"];
|
||||
if (dataAttribute == null) {
|
||||
//return without call service if no data attribute is set to avoid crash
|
||||
//return without call action if no data attribute is set to avoid crash
|
||||
WatchUi.popView(WatchUi.SLIDE_RIGHT);
|
||||
return;
|
||||
}
|
||||
var entity_id = mData["entity_id"];
|
||||
if (entity_id == null) {
|
||||
//return without call service if no entity_id is set to avoid crash
|
||||
//return without call action if no entity_id is set to avoid crash
|
||||
WatchUi.popView(WatchUi.SLIDE_RIGHT);
|
||||
return;
|
||||
}
|
||||
mHomeAssistantService.call(
|
||||
mService,
|
||||
mAction,
|
||||
{
|
||||
"entity_id" => entity_id.toString(),
|
||||
dataAttribute.toString() => mValue
|
||||
@@ -213,7 +214,7 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
WatchUi.requestUpdate();
|
||||
}
|
||||
|
||||
//! Set the Picker's value. Needed to set new value via the Service call
|
||||
//! Set the Picker's value. Needed to set new value via the Action call
|
||||
//!
|
||||
//! @param value New value to set.
|
||||
//
|
||||
@@ -223,7 +224,7 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
|
||||
//! Get the Picker's value.
|
||||
//!
|
||||
//! Needed to set new value via the Service call
|
||||
//! Needed to set new value via the Action call
|
||||
//
|
||||
public function getValue() as Lang.Number or Lang.Float {
|
||||
return mValue;
|
||||
|
||||
@@ -61,7 +61,7 @@ class HomeAssistantNumericPicker extends WatchUi.Picker {
|
||||
//
|
||||
public function onConfirm(value as Lang.Number or Lang.Float) as Void {
|
||||
mItem.setValue(value);
|
||||
mItem.callService();
|
||||
mItem.callAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class HomeAssistantService {
|
||||
}
|
||||
}
|
||||
|
||||
//! Callback function after completing the POST request to call a service.
|
||||
//! Callback function after completing the POST request to call an action.
|
||||
//!
|
||||
//! @param responseCode Response code.
|
||||
//! @param data Response data.
|
||||
@@ -87,7 +87,7 @@ class HomeAssistantService {
|
||||
break;
|
||||
|
||||
case 200:
|
||||
// System.println("HomeAssistantService onReturnCall(): Service executed.");
|
||||
// System.println("HomeAssistantService onReturnCall(): Action executed.");
|
||||
getApp().forceStatusUpdates();
|
||||
var d = data as Lang.Array;
|
||||
var toast = WatchUi.loadResource($.Rez.Strings.Executed) as Lang.String;
|
||||
@@ -118,13 +118,13 @@ class HomeAssistantService {
|
||||
}
|
||||
}
|
||||
|
||||
//! Invoke a service call for a menu item.
|
||||
//! Invoke a action call for a menu item.
|
||||
//!
|
||||
//! @param service The Home Assistant service to be run, e.g. from the JSON `service` field.
|
||||
//! @param data Data to be supplied to the service call.
|
||||
//! @param action The Home Assistant action to be run, e.g. from the JSON `action` field.
|
||||
//! @param data Data to be supplied to the action call.
|
||||
//
|
||||
function call(
|
||||
service as Lang.String,
|
||||
action as Lang.String,
|
||||
data as Lang.Dictionary?,
|
||||
exit as Lang.Boolean
|
||||
) as Void {
|
||||
@@ -136,8 +136,8 @@ class HomeAssistantService {
|
||||
WatchUi.pushView(
|
||||
dialog,
|
||||
new WifiLteExecutionConfirmDelegate({
|
||||
:type => "service",
|
||||
:service => service,
|
||||
:type => "action",
|
||||
:action => action,
|
||||
:data => data,
|
||||
:exit => exit,
|
||||
}, dialog),
|
||||
@@ -151,9 +151,9 @@ class HomeAssistantService {
|
||||
ErrorView.show(WatchUi.loadResource($.Rez.Strings.NoInternet) as Lang.String);
|
||||
} else {
|
||||
// Can't use null for substring() parameters due to API version level.
|
||||
var url = Settings.getApiUrl() + "/services/" + service.substring(0, service.find(".")) + "/" + service.substring(service.find(".")+1, service.length());
|
||||
var url = Settings.getApiUrl() + "/services/" + action.substring(0, action.find(".")) + "/" + action.substring(action.find(".")+1, action.length());
|
||||
// System.println("HomeAssistantService call() URL=" + url);
|
||||
// System.println("HomeAssistantService call() service=" + service);
|
||||
// System.println("HomeAssistantService call() action=" + action);
|
||||
|
||||
var entity_id = "";
|
||||
if (data != null) {
|
||||
|
||||
@@ -50,9 +50,9 @@ class HomeAssistantSyncDelegate extends Communications.SyncDelegate {
|
||||
var url;
|
||||
|
||||
switch (type) {
|
||||
case "service":
|
||||
var service = WifiLteExecutionConfirmDelegate.mCommandData[:service];
|
||||
url = Settings.getApiUrl() + "/services/" + service.substring(0, service.find(".")) + "/" + service.substring(service.find(".")+1, service.length());
|
||||
case "action":
|
||||
var action = WifiLteExecutionConfirmDelegate.mCommandData[:action];
|
||||
url = Settings.getApiUrl() + "/services/" + action.substring(0, action.find(".")) + "/" + action.substring(action.find(".")+1, action.length());
|
||||
var entity_id = "";
|
||||
if (data != null) {
|
||||
entity_id = data.get("entity_id");
|
||||
@@ -78,7 +78,7 @@ class HomeAssistantSyncDelegate extends Communications.SyncDelegate {
|
||||
private function performRequest(url as Lang.String, data as Lang.Dictionary?) {
|
||||
Communications.makeWebRequest(
|
||||
url,
|
||||
data, // May include {"entity_id": xxxx} for service calls
|
||||
data, // May include {"entity_id": xxxx} for action calls
|
||||
{
|
||||
:method => Communications.HTTP_REQUEST_METHOD_POST,
|
||||
:headers => Settings.augmentHttpHeaders({
|
||||
|
||||
@@ -17,11 +17,11 @@ using Toybox.Lang;
|
||||
using Toybox.WatchUi;
|
||||
using Toybox.Graphics;
|
||||
|
||||
//! Menu button that triggers a service.
|
||||
//! Menu button that triggers an action.
|
||||
//
|
||||
class HomeAssistantTapMenuItem extends HomeAssistantMenuItem {
|
||||
private var mHomeAssistantService as HomeAssistantService;
|
||||
private var mService as Lang.String?;
|
||||
private var mAction as Lang.String?;
|
||||
private var mConfirm as Lang.Boolean;
|
||||
private var mExit as Lang.Boolean;
|
||||
private var mPin as Lang.Boolean;
|
||||
@@ -31,11 +31,11 @@ class HomeAssistantTapMenuItem extends HomeAssistantMenuItem {
|
||||
//!
|
||||
//! @param label Menu item label.
|
||||
//! @param template Menu item template.
|
||||
//! @param service Menu item service.
|
||||
//! @param data Data to supply to the service call.
|
||||
//! @param exit Should the service call complete and then exit?
|
||||
//! @param confirm Should the service call be confirmed to avoid accidental invocation?
|
||||
//! @param pin Should the service call be protected with a PIN for some low level of security?
|
||||
//! @param action Menu item action.
|
||||
//! @param data Data to supply to the action call.
|
||||
//! @param exit Should the action call complete and then exit?
|
||||
//! @param confirm Should the action call be confirmed to avoid accidental invocation?
|
||||
//! @param pin Should the action call be protected with a PIN for some low level of security?
|
||||
//! @param icon Icon to use for the menu item.
|
||||
//! @param options Menu item options to be passed on, including both SDK and menu options, e.g. exit, confirm & pin.
|
||||
//! @param haService Shared Home Assistant service object that will perform the required call. Only
|
||||
@@ -44,7 +44,7 @@ class HomeAssistantTapMenuItem extends HomeAssistantMenuItem {
|
||||
function initialize(
|
||||
label as Lang.String or Lang.Symbol,
|
||||
template as Lang.String,
|
||||
service as Lang.String?,
|
||||
action as Lang.String?,
|
||||
data as Lang.Dictionary?,
|
||||
options as {
|
||||
:alignment as WatchUi.MenuItem.Alignment,
|
||||
@@ -65,16 +65,16 @@ class HomeAssistantTapMenuItem extends HomeAssistantMenuItem {
|
||||
);
|
||||
|
||||
mHomeAssistantService = haService;
|
||||
mService = service;
|
||||
mAction = action;
|
||||
mData = data;
|
||||
mExit = options[:exit];
|
||||
mConfirm = options[:confirm];
|
||||
mPin = options[:pin];
|
||||
}
|
||||
|
||||
//! Call a Home Assistant service only after checks have been done for confirmation or PIN entry.
|
||||
//! Call a Home Assistant action only after checks have been done for confirmation or PIN entry.
|
||||
//
|
||||
function callService() as Void {
|
||||
function callAction() as Void {
|
||||
var hasTouchScreen = System.getDeviceSettings().isTouchScreen;
|
||||
if (mPin && hasTouchScreen) {
|
||||
var pin = Settings.getPin();
|
||||
@@ -100,10 +100,10 @@ class HomeAssistantTapMenuItem extends HomeAssistantMenuItem {
|
||||
WatchUi.pushView(
|
||||
dialog,
|
||||
new WifiLteExecutionConfirmDelegate({
|
||||
:type => "service",
|
||||
:service => mService,
|
||||
:data => mData,
|
||||
:exit => mExit,
|
||||
:type => "action",
|
||||
:action => mAction,
|
||||
:data => mData,
|
||||
:exit => mExit,
|
||||
}, dialog),
|
||||
WatchUi.SLIDE_LEFT
|
||||
);
|
||||
@@ -129,8 +129,8 @@ class HomeAssistantTapMenuItem extends HomeAssistantMenuItem {
|
||||
//! @param b Ignored. It is included in order to match the expected function prototype of the callback method.
|
||||
//
|
||||
public function onConfirm(b as Lang.Boolean) as Void {
|
||||
if (mService != null) {
|
||||
mHomeAssistantService.call(mService, mData, mExit);
|
||||
if (mAction != null) {
|
||||
mHomeAssistantService.call(mAction, mData, mExit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
//!
|
||||
//! @param label Menu item label.
|
||||
//! @param template Menu item template.
|
||||
//! @param data Data to supply to the service call.
|
||||
//! @param data Data to supply to the action call.
|
||||
//! @param options Menu item options to be passed on, including both SDK and menu options, e.g. exit, confirm & pin.
|
||||
//
|
||||
function initialize(
|
||||
@@ -220,7 +220,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
}
|
||||
}
|
||||
|
||||
//! Handles the response from a Home Assistant service or state call and updates the toggle UI.
|
||||
//! Handles the response from a Home Assistant action or state call and updates the toggle UI.
|
||||
//!
|
||||
//! @param data An array of dictionaries, each representing a Home Assistant entity state.
|
||||
//
|
||||
@@ -293,9 +293,9 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
}
|
||||
}
|
||||
|
||||
//! Call a Home Assistant service only after checks have been done for confirmation or PIN entry.
|
||||
//! Call a Home Assistant action only after checks have been done for confirmation or PIN entry.
|
||||
//
|
||||
function callService(b as Lang.Boolean) as Void {
|
||||
function callAction(b as Lang.Boolean) as Void {
|
||||
var hasTouchScreen = System.getDeviceSettings().isTouchScreen;
|
||||
if (mPin && hasTouchScreen) {
|
||||
// Undo the toggle
|
||||
@@ -349,7 +349,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
setState(b);
|
||||
}
|
||||
|
||||
//! Displays a confirmation dialog before executing a service call via Wi-Fi/LTE.
|
||||
//! Displays a confirmation dialog before executing an action call via Wi-Fi/LTE.
|
||||
//!
|
||||
//! @param s Desired state: `true` to turn on, `false` to turn off.
|
||||
//
|
||||
@@ -377,7 +377,7 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||
//! @param id The entity ID, e.g., `"switch.kitchen"`.
|
||||
//! @param s Desired state: `true` for "turn_on", `false` for "turn_off".
|
||||
//!
|
||||
//! @return Full service URL string.
|
||||
//! @return Full action URL string.
|
||||
//
|
||||
private static function getUrl(id as Lang.String, s as Lang.Boolean) as Lang.String {
|
||||
var url = Settings.getApiUrl() + "/services/";
|
||||
|
||||
@@ -47,7 +47,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
var content = items[i].get("content") as Lang.String?;
|
||||
var entity = items[i].get("entity") as Lang.String?;
|
||||
var tap_action = items[i].get("tap_action") as Lang.Dictionary?;
|
||||
var service = items[i].get("service") as Lang.String?; // Deprecated schema
|
||||
var action = items[i].get("service") as Lang.String?; // Deprecated schema
|
||||
var confirm = false as Lang.Boolean?;
|
||||
var pin = false as Lang.Boolean?;
|
||||
var data = null as Lang.Dictionary?;
|
||||
@@ -60,7 +60,10 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
exit = items[i].get("exit"); // Optional
|
||||
}
|
||||
if (tap_action != null) {
|
||||
service = tap_action.get("service");
|
||||
action = tap_action.get("service"); // Deprecated
|
||||
if (tap_action.get("action") != null) {
|
||||
action = tap_action.get("action"); // Optional
|
||||
}
|
||||
data = tap_action.get("data"); // Optional
|
||||
if (tap_action.get("confirm") != null) {
|
||||
confirm = tap_action.get("confirm"); // Optional
|
||||
@@ -81,12 +84,12 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
:pin => pin
|
||||
}
|
||||
));
|
||||
} else if (type.equals("tap") && service != null) {
|
||||
} else if (type.equals("tap") && action != null) {
|
||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||
name,
|
||||
entity,
|
||||
content,
|
||||
service,
|
||||
action,
|
||||
data,
|
||||
{
|
||||
:exit => exit,
|
||||
@@ -103,7 +106,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
name,
|
||||
entity,
|
||||
content,
|
||||
service,
|
||||
action,
|
||||
data,
|
||||
{
|
||||
:exit => false,
|
||||
@@ -117,7 +120,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
name,
|
||||
entity,
|
||||
content,
|
||||
service,
|
||||
action,
|
||||
data,
|
||||
{
|
||||
:exit => exit,
|
||||
@@ -126,7 +129,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
}
|
||||
));
|
||||
}
|
||||
} else if (type.equals("numeric") && service != null) {
|
||||
} else if (type.equals("numeric") && action != null) {
|
||||
if (tap_action != null) {
|
||||
var picker = tap_action.get("picker") as Lang.Dictionary?;
|
||||
if (picker != null) {
|
||||
@@ -134,7 +137,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
name,
|
||||
entity,
|
||||
content,
|
||||
service,
|
||||
action,
|
||||
picker,
|
||||
{
|
||||
:exit => exit,
|
||||
@@ -150,7 +153,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
name,
|
||||
entity,
|
||||
content,
|
||||
service,
|
||||
action,
|
||||
data,
|
||||
{
|
||||
:exit => false,
|
||||
@@ -267,11 +270,11 @@ class HomeAssistantViewDelegate extends WatchUi.Menu2InputDelegate {
|
||||
if (item instanceof HomeAssistantToggleMenuItem) {
|
||||
var haToggleItem = item as HomeAssistantToggleMenuItem;
|
||||
// System.println(haToggleItem.getLabel() + " " + haToggleItem.getId() + " " + haToggleItem.isEnabled());
|
||||
haToggleItem.callService(haToggleItem.isEnabled());
|
||||
haToggleItem.callAction(haToggleItem.isEnabled());
|
||||
} else if (item instanceof HomeAssistantTapMenuItem) {
|
||||
var haItem = item as HomeAssistantTapMenuItem;
|
||||
// System.println(haItem.getLabel() + " " + haItem.getId());
|
||||
haItem.callService();
|
||||
haItem.callAction();
|
||||
} else if (item instanceof HomeAssistantNumericMenuItem) {
|
||||
var haItem = item as HomeAssistantNumericMenuItem;
|
||||
// System.println(haItem.getLabel() + " " + haItem.getId());
|
||||
|
||||
@@ -25,7 +25,7 @@ using Toybox.Timer;
|
||||
class WifiLteExecutionConfirmDelegate extends WatchUi.ConfirmationDelegate {
|
||||
public static var mCommandData as {
|
||||
:type as Lang.String,
|
||||
:service as Lang.String?,
|
||||
:action as Lang.String?,
|
||||
:data as Lang.Dictionary?,
|
||||
:url as Lang.String?,
|
||||
:id as Lang.Number?,
|
||||
@@ -40,8 +40,8 @@ class WifiLteExecutionConfirmDelegate extends WatchUi.ConfirmationDelegate {
|
||||
//!
|
||||
//! @param options A dictionary describing the command to be executed:<br>
|
||||
//! `{`<br>
|
||||
//!   `:type: as Lang.String,` // The command type, either `"service"` or `"entity"`.<br>
|
||||
//!   `:service: as Lang.String?,` // (For type `"service"`) The Home Assistant service to call (e.g., "light.turn_on").<br>
|
||||
//!   `:type: as Lang.String,` // The command type, either `"action"` or `"entity"`.<br>
|
||||
//!   `:action: as Lang.String?,` // (For type `"action"`) The Home Assistant action to call (e.g., "light.turn_on").<br>
|
||||
//!   `:url: as Lang.Dictionary?,` // (For type `"entity"`) The full Home Assistant entity API URL.<br>
|
||||
//!   `:callback: as Lang.String?,` // (For type `"entity"`) A callback method (Method<data as Dictionary>) to handle the response.<br>
|
||||
//!   `:data: as Lang.Method?,` // (Optional) A dictionary of data to send with the request.<br>
|
||||
@@ -52,7 +52,7 @@ class WifiLteExecutionConfirmDelegate extends WatchUi.ConfirmationDelegate {
|
||||
function initialize(
|
||||
cOptions as {
|
||||
:type as Lang.String,
|
||||
:service as Lang.String?,
|
||||
:action as Lang.String?,
|
||||
:data as Lang.Dictionary?,
|
||||
:url as Lang.String?,
|
||||
:callback as Lang.Method?,
|
||||
@@ -73,7 +73,7 @@ class WifiLteExecutionConfirmDelegate extends WatchUi.ConfirmationDelegate {
|
||||
mConfirmationView = view;
|
||||
mCommandData = {
|
||||
:type => cOptions[:type],
|
||||
:service => cOptions[:service],
|
||||
:action => cOptions[:action],
|
||||
:data => cOptions[:data],
|
||||
:url => cOptions[:url],
|
||||
:callback => cOptions[:callback],
|
||||
|
||||
Reference in New Issue
Block a user