mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-11-07 18:18:14 +00:00
Schema fixes and move "exit" into "tap_action"
This commit is contained in:
@@ -47,7 +47,8 @@
|
||||
"$ref": "#/$defs/enabled"
|
||||
},
|
||||
"exit": {
|
||||
"$ref": "#/$defs/exit"
|
||||
"$ref": "#/$defs/exit",
|
||||
"deprecated": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -58,6 +59,7 @@
|
||||
"additionalProperties": false
|
||||
},
|
||||
"template": {
|
||||
"deprecated": true,
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
@@ -118,7 +120,8 @@
|
||||
"$ref": "#/$defs/enabled"
|
||||
},
|
||||
"exit": {
|
||||
"$ref": "#/$defs/exit"
|
||||
"$ref": "#/$defs/exit",
|
||||
"deprecated": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -184,7 +187,8 @@
|
||||
"$ref": "#/$defs/enabled"
|
||||
},
|
||||
"exit": {
|
||||
"$ref": "#/$defs/exit"
|
||||
"$ref": "#/$defs/exit",
|
||||
"deprecated": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -922,9 +926,51 @@
|
||||
"title": "Home Assistant action name",
|
||||
"pattern": "^[^.]+\\.[^.]+$"
|
||||
},
|
||||
"tap_action_tap": {
|
||||
"allOf": [
|
||||
{
|
||||
"title": "Tap Action",
|
||||
"description": "'confirm' and 'pin' fields are optional. 'action' is required.",
|
||||
"properties": {
|
||||
"service": {
|
||||
"$ref": "#/$defs/action",
|
||||
"deprecated": true
|
||||
},
|
||||
"action": {
|
||||
"$ref": "#/$defs/action"
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"title": "Your actions's parameters",
|
||||
"description": "The object containing the parameters and their values to be passed to the entity. No schema checking can be done here, you are on your own! On application crash, remove the parameters."
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"required": [
|
||||
"action"
|
||||
],
|
||||
"not": {
|
||||
"required": [
|
||||
"service"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"service"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/tap_action"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tap_action": {
|
||||
"type": "object",
|
||||
"title": "Action",
|
||||
"title": "Tap Action",
|
||||
"description": "'confirm' and 'pin' fields are optional.",
|
||||
"properties": {
|
||||
"confirm": {
|
||||
@@ -932,45 +978,22 @@
|
||||
},
|
||||
"pin": {
|
||||
"$ref": "#/$defs/pin"
|
||||
},
|
||||
"exit": {
|
||||
"$ref": "#/$defs/exit"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tap_action_tap": {
|
||||
"$ref": "#/$defs/tap_action",
|
||||
"properties": {
|
||||
"service": {
|
||||
"$ref": "#/$defs/action",
|
||||
"deprecated": true
|
||||
},
|
||||
"action": {
|
||||
"$ref": "#/$defs/action"
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"title": "Your actions's parameters",
|
||||
"description": "The object containing the parameters and their values to be passed to the entity. No schema checking can be done here, you are on your own! On application crash, remove the parameters."
|
||||
},
|
||||
"anyOf": [
|
||||
{
|
||||
"required": [
|
||||
"service"
|
||||
]
|
||||
},
|
||||
{
|
||||
"required": [
|
||||
"action"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"title": "Home Assistant Template",
|
||||
"description": "Jinja2 template defining the text to display. Must be included in an 'info'. Optional in a 'toggle', 'tap' and 'group'. Special characters may not render in the glance context.",
|
||||
"type": "string"
|
||||
},
|
||||
"confirm": {
|
||||
"type": ["boolean", "string"],
|
||||
"type": [
|
||||
"boolean",
|
||||
"string"
|
||||
],
|
||||
"default": false,
|
||||
"title": "Confirmation",
|
||||
"description": "Optional confirmation of the action before execution as a precaution. Use a Boolean for the default message. Specify a string to display a specific confirmation message."
|
||||
|
||||
@@ -57,7 +57,7 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
enabled = items[i].get("enabled"); // Optional
|
||||
}
|
||||
if (items[i].get("exit") != null) {
|
||||
exit = items[i].get("exit"); // Optional
|
||||
exit = items[i].get("exit"); // Deprecated
|
||||
}
|
||||
if (tap_action != null) {
|
||||
action = tap_action.get("service"); // Deprecated
|
||||
@@ -71,6 +71,9 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
||||
if (tap_action.get("pin") != null) {
|
||||
pin = tap_action.get("pin"); // Optional
|
||||
}
|
||||
if (tap_action.get("exit") != null) {
|
||||
exit = tap_action.get("exit"); // Optional
|
||||
}
|
||||
}
|
||||
if (type != null && name != null && enabled) {
|
||||
if (type.equals("toggle") && entity != null) {
|
||||
|
||||
Reference in New Issue
Block a user