mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2026-06-26 22:13:29 +00:00
Preserve tap action data for numeric picker actions
Pass tap_action.data into numeric menu items and merge it with the selected picker value before calling the Home Assistant service.
This commit is contained in:
@@ -155,7 +155,10 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
//
|
||||
function onConfirm(b as Lang.Boolean) as Void {
|
||||
var dataAttribute = mPicker["data_attribute"] as Lang.String?;
|
||||
var entity_id = mData["entity_id"] as Lang.String?;
|
||||
var entity_id = null as Lang.String?;
|
||||
if (mData != null) {
|
||||
entity_id = mData["entity_id"] as Lang.String?;
|
||||
}
|
||||
|
||||
WatchUi.popView(WatchUi.SLIDE_RIGHT);
|
||||
WatchUi.requestUpdate();
|
||||
@@ -164,12 +167,18 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
||||
return;
|
||||
}
|
||||
if (mAction != null) {
|
||||
var data = {} as Lang.Dictionary;
|
||||
if (mData != null) {
|
||||
var keys = mData.keys();
|
||||
for (var i = 0; i < keys.size(); i++) {
|
||||
data[keys[i]] = mData[keys[i]];
|
||||
}
|
||||
}
|
||||
data["entity_id"] = entity_id.toString();
|
||||
data[dataAttribute.toString()] = mValue;
|
||||
mHomeAssistantService.call(
|
||||
mAction,
|
||||
{
|
||||
"entity_id" => entity_id.toString(),
|
||||
dataAttribute.toString() => mValue
|
||||
},
|
||||
data,
|
||||
mExit
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user