mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2026-07-08 20:03:29 +00:00
Compare commits
12 Commits
dbd2b4a568
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a2ca7c2c | ||
|
|
02a9472ac1 | ||
|
|
e0b5978406 | ||
|
|
c48d74138a | ||
|
|
3404c7f679 | ||
|
|
8c5bdbc1f8 | ||
|
|
a97440b997 | ||
|
|
17690d4349 | ||
|
|
b1fb5d9417 | ||
|
|
2fb59d2a56 | ||
|
|
3e3f60c47c | ||
|
|
7c4a23866c |
@@ -36,7 +36,7 @@
|
||||
| 2.21 | Added 7 new devices (`edge1050`, `enduro3`, `fenix843mm`, `fenix847mm`, `fenix8solar47mm`, `fenix8solar51mm`, `fenixe`) and upgraded the SDK to 7.3.0. Fix for a bug on Edge devices introduced by v2.16 activity reporting improvements. |
|
||||
| 2.22 | <img src="images/pin_view.png" width="200" title="PIN Entry View"/><br/>Major feature release adding an optional PIN to menu items. This significant new feature has been provided by [@moesterheld](https://github.com/moesterheld). Please do not rely on this application for security. Use at your own risk! |
|
||||
| 2.23 | Added "info" menu item for displaying information via a template without a tap or toggle. Essentially like the old 'template' type that was deprecated when all items were amended to display evaluated templates. That action removed the display only items too hastily. Added 5 new devices in the model range Instinct 3 and Instinct E. |
|
||||
| 2.24 | Experiment to prevent new Webhook IDs being created unnecessarily. Reduced the latency for the first menu update. Added 4 new devices: approachs50, descentg2, descentmk1, and gpsmap66. |
|
||||
| 2.24 | Experiment to prevent new Webhook IDs being created unnecessarily. Reduced the latency for the first menu update. Added 4 new devices: `approachs50`, `descentg2`, ~~`descentmk1`~~ (subsequently withdrawn in v3.6), and `gpsmap66`. |
|
||||
| 2.25 | 2 Bug fixes. First time startup issues caused by v2.24 change and a fix for pure numbers in returned templates. |
|
||||
| 2.26 | Retry responsive menu fix failed in v2.24. Cosmetic internal class changes. |
|
||||
| 2.27 | Trivial bug fix for the glance view to prevent the "Unconfigured" result being erroneously displayed because the settings were not yet pulled from persistent storage. |
|
||||
@@ -51,10 +51,12 @@
|
||||
| 3.3 | Providing automatic detection for menu definition updates, but still requires an application restart. |
|
||||
| 3.4 | Fixed a bug where templates failed to display in toggle menu items (at least on some devices). Fixed a bug where a menu item requesting to exit on completion appeared to indicate failure when using Wi-Fi or LTE. The fix uses a delay in exiting the application modelled as sufficient for a Venu 2 device, so this might need tweaking for other devices. Attempt to fixed an "Out of Memory" bug caused by v3.3 by making automatic checking for menu updates both optional and automatically turned off when insufficient memory is available. This last bug is device dependent and may require another attempt. Internationalisation improvements with thanks to [@krzys_h](https://github.com/krzys-h) for a new automated translations script. |
|
||||
| 3.5 | Added support for Edge 550, 850 & MTB, Fenix 8 Pro 47mm, GPSMAP H1, Instinct Crossover AMOLED, Venu 4 41mm & 45mm, & Venu X1 devices which also required an SDK update to 8.3.0. The simulation of the Edge 850 device was off, as it failed to update the display and text was the wrong colour, but the buttons menu items operated HA correctly. The assumption is the simulation model is buggy until someone [reports](https://github.com/house-of-abbey/GarminHomeAssistant/issues) otherwise. |
|
||||
| 3.6 | Added `numeric` menu item type thanks to [@thmichel](https://github.com/thmichel). This allows you to select a numeric value to set for an entity. Confirmations can now display a user supplied message. [Schema update](README.md#old-deprecated-formats) to keep pace with HomeAssistant and correct a previous decision. Schema changes for consistency. |
|
||||
| 3.6 | Added `numeric` menu item type thanks to [@thmichel](https://github.com/thmichel). This allows you to select a numeric value to set for an entity. Confirmations can now display a user supplied message. [Schema update](README.md#old-deprecated-formats) to keep pace with HomeAssistant and correct a previous decision. Schema changes for consistency. `descentmk1` device removed as the simulation does not read the settings and therefore we cannot support the device. |
|
||||
| 3.7 | Bug fix for `numeric` menu items not working over Wi-Fi & LTE. |
|
||||
| 3.8 | Added icon for `numeric` menu items and revised icons in general. |
|
||||
| 3.9 | Small update to warn users with empty menu definitions to read the instructions! |
|
||||
| 3.10 | Bug avoidance for a fatal _"Error: Out Of Memory Error"_ in the glance when caching the menu to [`Storage`](https://developer.garmin.com/connect-iq/api-docs/Toybox/Application/Storage.html). This is now delayed until the main application is opened. Added support for two new devices, D2 Mach 2 and eTrex Touch. |
|
||||
| 3.11 | <img src="images/Venu2_glance_default.png" width="200" title="Default Glance"/><br/>Better handling of menus larger than the Glance view can handle. As a result the Glance can no longer verify the availability of the JSON menu as fetching it might cause an _"Error: Out Of Memory Error"_. Provide two user supplied HTTP Headers. Bug fix for the numeric picker. |
|
||||
| 3.12 | Amended GPS accuracy values used by the background service. |
|
||||
| 3.13 | Added support for new devices: `d2mach2pro`, `fr170`, `fr170m`, `fr70`. |
|
||||
| 3.14 | Numeric items now support `tap_action.data` fields so service call options like `transition` are catered for. See the documentation on [Additional Action Data](https://github.com/house-of-abbey/GarminHomeAssistant/blob/main/examples/Numeric.md#additional-action-data). This features has been provided by [@StumblingGamer](https://github.com/StumblingGamer). Now prevent PIN enabled menu items from being enabled on non-touch screen devices. The PIN must be removed for the menu item to function. Fix for initialising numeric pickers with no user defined template. |
|
||||
@@ -251,11 +251,17 @@
|
||||
"$ref": "#/$defs/content"
|
||||
},
|
||||
"tap_action": {
|
||||
"$ref": "#/$defs/tap_action",
|
||||
"title": "Tap Action",
|
||||
"description": "Numeric tap action definition to include the number picker. 'confirm', 'pin' and 'exit' fields are optional.",
|
||||
"properties": {
|
||||
"action": {
|
||||
"$ref": "#/$defs/action"
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"title": "Additional action data",
|
||||
"description": "Fixed Home Assistant service data. The selected picker value is merged into this object using the picker's data_attribute. Service-specific fields cannot be schema checked here."
|
||||
},
|
||||
"picker": {
|
||||
"type": "object",
|
||||
"title": "Number picker configuration",
|
||||
@@ -289,13 +295,24 @@
|
||||
"max",
|
||||
"step",
|
||||
"data_attribute"
|
||||
]
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"confirm": {
|
||||
"$ref": "#/$defs/confirm"
|
||||
},
|
||||
"pin": {
|
||||
"$ref": "#/$defs/pin"
|
||||
},
|
||||
"exit": {
|
||||
"$ref": "#/$defs/exit"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action",
|
||||
"picker"
|
||||
]
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"enabled": {
|
||||
"$ref": "#/$defs/enabled"
|
||||
@@ -982,7 +999,7 @@
|
||||
"tap_action": {
|
||||
"type": "object",
|
||||
"title": "Tap Action",
|
||||
"description": "'confirm' and 'pin' fields are optional.",
|
||||
"description": "'confirm', 'pin' and 'exit' fields are optional.",
|
||||
"properties": {
|
||||
"confirm": {
|
||||
"$ref": "#/$defs/confirm"
|
||||
|
||||
@@ -25,6 +25,8 @@ Two simple examples using a scene and a cover as `tap` menu items.
|
||||
}
|
||||
```
|
||||
|
||||
## Confirmation
|
||||
|
||||
Any menu item with an action (`tap`, `template`, or `toggle`), may have a confirmation view added. For consistency this is always done via the `tap_action` JSON object, even though for a `toggle` menu item there will only ever be a single field inside. For the `toggle` menu item, the confirmation is presented on both `on` and `off` directions. There is no option for asymmetry, i.e. only in one direction.
|
||||
|
||||
```json
|
||||
@@ -56,6 +58,8 @@ The `confirm` field may contain a string instead of a Boolean in order to provid
|
||||
}
|
||||
```
|
||||
|
||||
## Personal Identification Number (PIN)
|
||||
|
||||
**The authors do not advise the use of this application for security sensitive devices. But we suspect users are taking that risk anyway, hence a PIN confirmation is provided that can be used for additional menu item security.**
|
||||
|
||||
This can be enabled by setting the `pin` field in the `tap_action`. The `pin` field overrides `confirm`. Explicitly setting `confirm` is not necessary.
|
||||
@@ -70,9 +74,14 @@ The 4-digit PIN is set globally for all actions in the app settings in Connect I
|
||||
|
||||
When entering an invalid PIN for the fifth time within 2 minutes, the PIN dialog will be locked for all actions for the next 10 minutes. Entering a valid PIN will always reset the failure counter.
|
||||
|
||||
<img src="../images/pin_view.png" width="200" title="Confirmation View"/>
|
||||
<img src="../images/pin_view.png" width="200" title="PIN View"/>
|
||||
|
||||
Note that for notify events, you _must_ not supply an `entity_id` or the API call will fail. There are other examples too.
|
||||
> [!IMPORTANT]
|
||||
> The PIN entry requires a touch screen enabled device.
|
||||
|
||||
## Additional Data
|
||||
|
||||
Some `action`s require additional `data` to be supplied. The following example shows how we handle this scenario. Note that for notify events, you _must not_ supply an `entity_id` or the API call will fail. There are other examples too.
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -39,6 +39,36 @@ Field | Purpose
|
||||
|
||||
It may well be the case that often `attribute` and `data_attribute` are the same attribute, as with this example.
|
||||
|
||||
## Additional Action Data
|
||||
|
||||
The `tap_action` object may also include a `data` object for fixed service call parameters. When the picker value is selected, the application merges the picker value into this `data` object using `data_attribute`.
|
||||
|
||||
For example, a light brightness picker can request a HomeAssistant transition while still using the picker value for `brightness`.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Lounge Brightness",
|
||||
"content": "{{ ((state_attr('light.lounge','brightness') | int(0) / 255) * 100) | round(0) }}%",
|
||||
"type": "numeric",
|
||||
"entity": "light.lounge",
|
||||
"tap_action": {
|
||||
"action": "light.turn_on",
|
||||
"data": {
|
||||
"transition": 2
|
||||
},
|
||||
"picker": {
|
||||
"step": 5,
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"attribute": "brightness",
|
||||
"data_attribute": "brightness"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The resulting action data sent to HomeAssistant contains both the fixed `transition` value and the selected `brightness` value.
|
||||
|
||||
## Helper
|
||||
|
||||
You might define a "helper" entity as follows in HomeAssistant:
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<iq:product id="d2deltas"/>
|
||||
<iq:product id="d2mach1"/>
|
||||
<iq:product id="d2mach2"/>
|
||||
<iq:product id="d2mach2pro"/>
|
||||
<iq:product id="descentg1"/>
|
||||
<iq:product id="descentg2"/>
|
||||
<iq:product id="descentmk2"/>
|
||||
@@ -101,6 +102,8 @@
|
||||
<iq:product id="fenixe"/>
|
||||
<iq:product id="fr165"/>
|
||||
<iq:product id="fr165m"/>
|
||||
<iq:product id="fr170"/>
|
||||
<iq:product id="fr170m"/>
|
||||
<iq:product id="fr245"/>
|
||||
<iq:product id="fr245m"/>
|
||||
<iq:product id="fr255"/>
|
||||
@@ -114,6 +117,7 @@
|
||||
<iq:product id="fr57047mm"/>
|
||||
<iq:product id="fr645"/>
|
||||
<iq:product id="fr645m"/>
|
||||
<iq:product id="fr70"/>
|
||||
<iq:product id="fr745"/>
|
||||
<iq:product id="fr935"/>
|
||||
<iq:product id="fr945"/>
|
||||
|
||||
@@ -52,12 +52,13 @@ d2deltas.resourcePath = $(d2deltas.resourcePath);resources-launcher-40-40;resour
|
||||
d2mach1.resourcePath = $(d2mach1.resourcePath);resources-launcher-60-60;resources-icons-48
|
||||
# Screen Size 454x454 launcher icon size 65x65
|
||||
d2mach2.resourcePath = $(d2mach2.resourcePath);resources-launcher-65-65;resources-icons-53
|
||||
d2mach2pro.resourcePath = $(d2mach2pro.resourcePath);resources-launcher-65-65;resources-icons-53
|
||||
# Screen Size 176x176 launcher icon size 62x62
|
||||
descentg1.resourcePath = $(descentg1.resourcePath);resources-launcher-62-62;resources-icons-21
|
||||
# Screen Size 390x390 launcher icon size 60x60
|
||||
descentg2.resourcePath = $(descentg2.resourcePath);resources-launcher-60-60;resources-icons-46
|
||||
# Screen Size 240x240 launcher icon size 40x40
|
||||
descentmk1.resourcePath = $(descentmk1.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
# Screen Size 240x240 launcher icon size 40x40 - Does not work in simulation
|
||||
#descentmk1.resourcePath = $(descentmk1.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
# Screen Size 280x280 launcher icon size 40x40
|
||||
descentmk2.resourcePath = $(descentmk2.resourcePath);resources-launcher-40-40;resources-icons-32
|
||||
# Screen Size 240x240 launcher icon size 40x40
|
||||
@@ -150,6 +151,8 @@ fenixe.resourcePath = $(fenixe.resourcePath);resources-launcher-60-60;resources-
|
||||
# Screen Size 390x390 launcher icon size 54x54
|
||||
fr165.resourcePath = $(descentmk2s.resourcePath);resources-launcher-54-54;resources-icons-46
|
||||
fr165m.resourcePath = $(descentmk2s.resourcePath);resources-launcher-54-54;resources-icons-46
|
||||
fr170.resourcePath = $(fr170.resourcePath);resources-launcher-54-54;resources-icons-46
|
||||
fr170m.resourcePath = $(fr170m.resourcePath);resources-launcher-54-54;resources-icons-46
|
||||
# Screen Size 240x240 launcher icon size 40x40
|
||||
fr245.resourcePath = $(fr245.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
fr245m.resourcePath = $(fr245m.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
@@ -171,6 +174,8 @@ fr57047mm.resourcePath = $(fr57047mm.resourcePath);resources-launcher-65-65;reso
|
||||
# Screen Size 240x240 launcher icon size 40x40
|
||||
fr645.resourcePath = $(fr645.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
fr645m.resourcePath = $(fr645m.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
# Screen Size 390x390 launcher icon size 54x54
|
||||
fr70.resourcePath = $(fr70.resourcePath);resources-launcher-54-54;resources-icons-46
|
||||
# Screen Size 240x240 launcher icon size 40x40
|
||||
fr745.resourcePath = $(fr745.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
fr935.resourcePath = $(fr935.resourcePath);resources-launcher-40-40;resources-icons-28
|
||||
|
||||
@@ -163,6 +163,7 @@ class HomeAssistantMenuItemFactory {
|
||||
entity_id as Lang.String?,
|
||||
template as Lang.String?,
|
||||
action as Lang.String?,
|
||||
data as Lang.Dictionary?,
|
||||
picker as Lang.Dictionary,
|
||||
options as {
|
||||
:exit as Lang.Boolean,
|
||||
@@ -171,9 +172,12 @@ class HomeAssistantMenuItemFactory {
|
||||
:icon as WatchUi.Bitmap
|
||||
}
|
||||
) as WatchUi.MenuItem {
|
||||
var data = null;
|
||||
if (entity_id != null) {
|
||||
if (data == null) {
|
||||
data = { "entity_id" => entity_id };
|
||||
} else {
|
||||
data["entity_id"] = entity_id;
|
||||
}
|
||||
}
|
||||
var keys = mMenuItemOptions.keys();
|
||||
for (var i = 0; i < keys.size(); i++) {
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -133,6 +133,8 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
));
|
||||
}
|
||||
} else if (type.equals("numeric") && action != null) {
|
||||
if (System.getDeviceSettings().isTouchScreen) {
|
||||
// Numeric items are only actionable on touch screen devices.
|
||||
if (tap_action != null) {
|
||||
var picker = tap_action.get("picker") as Lang.Dictionary?;
|
||||
if (picker != null) {
|
||||
@@ -141,6 +143,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
entity,
|
||||
content,
|
||||
action,
|
||||
data,
|
||||
picker,
|
||||
{
|
||||
:exit => exit,
|
||||
@@ -150,6 +153,20 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||
"PIN requires Touchscreen",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
data,
|
||||
{
|
||||
:exit => false,
|
||||
:confirm => false,
|
||||
:pin => false
|
||||
}
|
||||
));
|
||||
}
|
||||
} else if (type.equals("info") && content != null) {
|
||||
// Cannot exit from a non-actionable information only menu item.
|
||||
addItem(HomeAssistantMenuItemFactory.create().tap(
|
||||
@@ -192,11 +209,9 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
}
|
||||
fullList.addAll(item.getMenuView().getItemsToUpdate());
|
||||
} else if (item instanceof HomeAssistantNumericMenuItem) {
|
||||
// Numeric items can have an optional template to evaluate
|
||||
var nmi = item as HomeAssistantNumericMenuItem;
|
||||
if (nmi.hasTemplate()) {
|
||||
// Numeric items can have an optional template to evaluate, but they must always be included in order
|
||||
// to initialise the numeric picker's value.
|
||||
fullList.add(item);
|
||||
}
|
||||
} else if (item instanceof HomeAssistantToggleMenuItem) {
|
||||
fullList.add(item);
|
||||
} else if (item instanceof HomeAssistantTapMenuItem) {
|
||||
|
||||
Reference in New Issue
Block a user