mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-11-13 04:28:14 +00:00
Fix for numeric menu items over Wi-Fi/LTE (#318)
Turns out the sync service will not run unless the picker has not only been popped but the display also updated. v3.7 needs a swift turnaround as its a bug reported by a user.
This commit is contained in:
@@ -52,3 +52,4 @@
|
|||||||
| 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.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.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. |
|
||||||
|
| 3.7 | Bug fix for `numeric` menu items not working over Wi-Fi & LTE. |
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
|||||||
function initialize(
|
function initialize(
|
||||||
label as Lang.String or Lang.Symbol,
|
label as Lang.String or Lang.Symbol,
|
||||||
template as Lang.String,
|
template as Lang.String,
|
||||||
action as Lang.String?,
|
action as Lang.String?,
|
||||||
data as Lang.Dictionary?,
|
data as Lang.Dictionary?,
|
||||||
picker as Lang.Dictionary,
|
picker as Lang.Dictionary,
|
||||||
options as {
|
options as {
|
||||||
@@ -154,27 +154,25 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
|||||||
//! @param b Ignored. It is included in order to match the expected function prototype of the callback method.
|
//! @param b Ignored. It is included in order to match the expected function prototype of the callback method.
|
||||||
//
|
//
|
||||||
function onConfirm(b as Lang.Boolean) as Void {
|
function onConfirm(b as Lang.Boolean) as Void {
|
||||||
var dataAttribute = mPicker["data_attribute"];
|
var dataAttribute = mPicker["data_attribute"] as Lang.String?;
|
||||||
if (dataAttribute == null) {
|
var entity_id = mData["entity_id"] as Lang.String?;
|
||||||
//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 action if no entity_id is set to avoid crash
|
|
||||||
WatchUi.popView(WatchUi.SLIDE_RIGHT);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mHomeAssistantService.call(
|
|
||||||
mAction,
|
|
||||||
{
|
|
||||||
"entity_id" => entity_id.toString(),
|
|
||||||
dataAttribute.toString() => mValue
|
|
||||||
},
|
|
||||||
mExit
|
|
||||||
);
|
|
||||||
WatchUi.popView(WatchUi.SLIDE_RIGHT);
|
WatchUi.popView(WatchUi.SLIDE_RIGHT);
|
||||||
|
WatchUi.requestUpdate();
|
||||||
|
if (dataAttribute == null or entity_id == null) {
|
||||||
|
// Return without service call if no data attribute or entity ID is set to avoid crash.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mAction != null) {
|
||||||
|
mHomeAssistantService.call(
|
||||||
|
mAction,
|
||||||
|
{
|
||||||
|
"entity_id" => entity_id.toString(),
|
||||||
|
dataAttribute.toString() => mValue
|
||||||
|
},
|
||||||
|
mExit
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Return a numeric menu item's fetch state template.
|
//! Return a numeric menu item's fetch state template.
|
||||||
@@ -182,8 +180,9 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
|||||||
//! @return A string with the menu item's template definition (or null).
|
//! @return A string with the menu item's template definition (or null).
|
||||||
//
|
//
|
||||||
function getNumericTemplate() as Lang.String? {
|
function getNumericTemplate() as Lang.String? {
|
||||||
var entity_id = mData["entity_id"];
|
var entity_id = mData["entity_id"] as Lang.String?;
|
||||||
var attribute = mPicker["attribute"] as Lang.String?;
|
var attribute = mPicker["attribute"] as Lang.String?;
|
||||||
|
|
||||||
if (entity_id == null) {
|
if (entity_id == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user