Schema fixes and move "exit" into "tap_action"

This commit is contained in:
Joseph Abbey
2025-11-02 13:14:48 +00:00
parent ad83988ade
commit bc5a7d04e4
2 changed files with 61 additions and 35 deletions

View File

@@ -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,21 +926,11 @@
"title": "Home Assistant action name",
"pattern": "^[^.]+\\.[^.]+$"
},
"tap_action": {
"type": "object",
"title": "Action",
"description": "'confirm' and 'pin' fields are optional.",
"properties": {
"confirm": {
"$ref": "#/$defs/confirm"
},
"pin": {
"$ref": "#/$defs/pin"
}
}
},
"tap_action_tap": {
"$ref": "#/$defs/tap_action",
"allOf": [
{
"title": "Tap Action",
"description": "'confirm' and 'pin' fields are optional. 'action' is required.",
"properties": {
"service": {
"$ref": "#/$defs/action",
@@ -949,19 +943,45 @@
"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"
]
}
},
"anyOf": [
{
"required": [
"service"
]
},
{
"required": [
"action"
]
}
]
},
{
"$ref": "#/$defs/tap_action"
}
]
},
"tap_action": {
"type": "object",
"title": "Tap Action",
"description": "'confirm' and 'pin' fields are optional.",
"properties": {
"confirm": {
"$ref": "#/$defs/confirm"
},
"pin": {
"$ref": "#/$defs/pin"
},
"exit": {
"$ref": "#/$defs/exit"
}
}
},
"content": {
@@ -970,7 +990,10 @@
"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."

View File

@@ -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) {