mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-06-15 10:58:40 +00:00
Info only menu item
This commit is contained in:
@ -70,7 +70,7 @@
|
|||||||
"const": "template",
|
"const": "template",
|
||||||
"deprecated": true,
|
"deprecated": true,
|
||||||
"title": "Schema change:",
|
"title": "Schema change:",
|
||||||
"description": "Use 'tap' instead."
|
"description": "Use 'info' or 'tap' instead."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["name", "content", "type"],
|
"required": ["name", "content", "type"],
|
||||||
@ -93,7 +93,7 @@
|
|||||||
"const": "template",
|
"const": "template",
|
||||||
"deprecated": true,
|
"deprecated": true,
|
||||||
"title": "Schema change:",
|
"title": "Schema change:",
|
||||||
"description": "Use 'tap' instead."
|
"description": "Use 'info' or 'tap' instead."
|
||||||
},
|
},
|
||||||
"tap_action": {
|
"tap_action": {
|
||||||
"$ref": "#/$defs/tap_action"
|
"$ref": "#/$defs/tap_action"
|
||||||
@ -104,6 +104,23 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"info": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"$ref": "#/$defs/name"
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"$ref": "#/$defs/content"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"$ref": "#/$defs/type",
|
||||||
|
"const": "info"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name", "content", "type"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
"tap": {
|
"tap": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -169,7 +186,7 @@
|
|||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"title": "Menu item type",
|
"title": "Menu item type",
|
||||||
"description": "One of 'tap', 'toggle' or 'group'."
|
"description": "One of 'info', 'tap', 'toggle' or 'group'."
|
||||||
},
|
},
|
||||||
"items": {
|
"items": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -185,6 +202,9 @@
|
|||||||
{
|
{
|
||||||
"$ref": "#/$defs/tap"
|
"$ref": "#/$defs/tap"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/$defs/info"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"$ref": "#/$defs/group"
|
"$ref": "#/$defs/group"
|
||||||
}
|
}
|
||||||
@ -192,7 +212,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"title": "Your familiar name",
|
"title": "Your familiar name to display in the menu item",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
|
@ -64,7 +64,8 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
if (type != null && name != null) {
|
if (type != null && name != null) {
|
||||||
if (type.equals("toggle") && entity != null) {
|
if (type.equals("toggle") && entity != null) {
|
||||||
addItem(HomeAssistantMenuItemFactory.create().toggle(name, entity, content, confirm, pin));
|
addItem(HomeAssistantMenuItemFactory.create().toggle(name, entity, content, confirm, pin));
|
||||||
} else if ((type.equals("tap") && service != null) || (type.equals("template") && content != null)) {
|
} else if ((type.equals("tap") && service != null) || (type.equals("info") && content != null) || (type.equals("template") && content != null)) {
|
||||||
|
// NB. "template" is deprecated in the schema and remains only for backward compatibility. All menu items can now use templates, so the replacement is "info".
|
||||||
addItem(HomeAssistantMenuItemFactory.create().tap(name, entity, content, service, confirm, pin, data));
|
addItem(HomeAssistantMenuItemFactory.create().tap(name, entity, content, service, confirm, pin, data));
|
||||||
} else if (type.equals("group")) {
|
} else if (type.equals("group")) {
|
||||||
addItem(HomeAssistantMenuItemFactory.create().group(items[i], content));
|
addItem(HomeAssistantMenuItemFactory.create().group(items[i], content));
|
||||||
|
Reference in New Issue
Block a user