Json schema update (#310)

This commit is contained in:
Philip Abbey
2025-11-01 19:05:11 +00:00
committed by GitHub

View File

@@ -275,7 +275,51 @@
"$ref": "#/$defs/content"
},
"tap_action": {
"$ref": "#/$defs/tap_action"
"$ref": "#/$defs/tap_action",
"properties": {
"service": {
"$ref": "#/$defs/service"
},
"picker": {
"type": "object",
"title": "Number picker configuration",
"description": "'attribute' field is optional.",
"properties": {
"min": {
"type": "number",
"title": "Minimum Value"
},
"max": {
"type": "number",
"title": "Maximum Value"
},
"step": {
"type": "number",
"title": "Step Size"
},
"attribute": {
"type": "string",
"title": "Attribute on the entity",
"description": "Attribute on the entity with the current numeric value. To use the state of the entity, do not specify."
},
"data_attribute": {
"type": "string",
"title": "Attribute on the service data",
"description": "Attribute on the service data for the value to set."
}
},
"required": [
"min",
"max",
"step",
"data_attribute"
]
}
},
"required": [
"service",
"picker"
]
},
"enabled": {
"$ref": "#/$defs/enabled"
@@ -310,12 +354,16 @@
},
"then": {
"properties": {
"attribute": {
"const": "brightness"
},
"tap_action": {
"properties": {
"service": {
"const": "light.turn_on"
},
"picker": {
"properties": {
"attribute": {
"const": "brightness"
},
"data_attribute": {
"const": "brightness"
},
@@ -327,6 +375,10 @@
"description": "Lights are not a percentage."
}
}
}
}
}
}
},
"else": {
"if": {
@@ -338,12 +390,13 @@
},
"then": {
"properties": {
"attribute": {
"const": "value"
},
"tap_action": {
"properties": {
"service": {
"const": "input_number.set_value"
},
"picker": {
"properties": {
"data_attribute": {
"const": "value"
}
@@ -353,6 +406,10 @@
"attribute"
]
}
}
}
}
}
},
"else": {
"if": {
@@ -364,12 +421,13 @@
},
"then": {
"properties": {
"attribute": {
"const": "value"
},
"tap_action": {
"properties": {
"service": {
"const": "number.set_value"
},
"picker": {
"properties": {
"data_attribute": {
"const": "value"
}
@@ -379,6 +437,10 @@
"attribute"
]
}
}
}
}
}
},
"else": {
"if": {
@@ -390,12 +452,16 @@
},
"then": {
"properties": {
"attribute": {
"const": "percentage"
},
"tap_action": {
"properties": {
"service": {
"const": "fan.set_percentage"
},
"picker": {
"properties": {
"attribute": {
"const": "percentage"
},
"data_attribute": {
"const": "percentage"
},
@@ -406,6 +472,10 @@
"const": 100
}
}
}
}
}
}
},
"else": {
"if": {
@@ -417,12 +487,16 @@
},
"then": {
"properties": {
"attribute": {
"const": "position"
},
"tap_action": {
"properties": {
"service": {
"const": "valve.set_valve_position"
},
"picker": {
"properties": {
"attribute": {
"const": "position"
},
"data_attribute": {
"const": "position"
},
@@ -433,6 +507,10 @@
"const": 100
}
}
}
}
}
}
},
"else": {
"if": {
@@ -443,40 +521,45 @@
}
},
"then": {
"allOf": [
{
"properties": {
"tap_action": {
"properties": {
"attribute": {
"const": "position"
},
"service": {
"const": "cover.set_position"
},
"data_attribute": {
"const": "position"
},
"min": {
"const": 0
},
"max": {
"const": 100
"enum": [
"cover.set_position",
"cover.set_tilt_position"
]
}
}
}
}
},
"else": {
{
"if": {
"properties": {
"entity": {
"pattern": "^cover\\.[^.]+$"
"tap_action": {
"properties": {
"service": {
"const": "cover.set_tilt_position"
}
}
}
}
},
"then": {
"properties": {
"attribute": {
"const": "tilt_position"
},
"tap_action": {
"properties": {
"service": {
"const": "cover.set_tilt_position"
},
"picker": {
"properties": {
"attribute": {
"const": "tilt_position"
},
"data_attribute": {
"const": "tilt_position"
},
@@ -487,6 +570,40 @@
"const": 100
}
}
}
}
}
}
},
"else": {
"properties": {
"tap_action": {
"properties": {
"service": {
"const": "cover.set_position"
},
"picker": {
"properties": {
"attribute": {
"const": "position"
},
"data_attribute": {
"const": "position"
},
"min": {
"const": 0
},
"max": {
"const": 100
}
}
}
}
}
}
}
}
]
},
"else": {
"if": {
@@ -498,12 +615,16 @@
},
"then": {
"properties": {
"attribute": {
"const": "volume_level"
},
"tap_action": {
"properties": {
"service": {
"const": "media_player.volume_set"
},
"picker": {
"properties": {
"attribute": {
"const": "volume_level"
},
"data_attribute": {
"const": "volume_level"
},
@@ -514,6 +635,10 @@
"const": 1
}
}
}
}
}
}
},
"else": {
"if": {
@@ -524,16 +649,28 @@
}
},
"then": {
"tap_action": {
"properties": {
"properties": {
"service": {
"const": "climate.set_temperature"
},
"picker": {
"properties": {
"attribute": {
"const": "temperature"
},
"service": {
"const": "climate.set_temperature"
},
"data_attribute": {
"const": "temperature"
}
},
"not": {
"required": [
"attribute"
]
}
}
}
}
}
}
@@ -580,97 +717,133 @@
"type": "numeric",
"name": "Example",
"entity": "light.example",
"attribute": "brightness",
"tap_action": {
"service": "light.turn_on",
"picker": {
"attribute": "brightness",
"data_attribute": "brightness",
"min": 0,
"max": 255,
"step": 1
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "input_number.example",
"tap_action": {
"service": "input_number.set_value",
"picker": {
"data_attribute": "value",
"min": 0,
"max": 100,
"step": 1
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "number.example",
"tap_action": {
"service": "number.set_value",
"picker": {
"data_attribute": "value",
"min": 0,
"max": 100,
"step": 1
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "fan.example",
"attribute": "percentage",
"tap_action": {
"service": "fan.set_percentage",
"picker": {
"attribute": "percentage",
"data_attribute": "percentage",
"min": 0,
"max": 100,
"step": 1,
"display_format": "%.0f%%"
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "valve.example",
"attribute": "position",
"tap_action": {
"service": "valve.set_valve_position",
"data_attribute": "position",
"min": 0,
"max": 100,
"step": 1
},
{
"type": "numeric",
"name": "Example",
"entity": "cover.example",
"picker": {
"attribute": "position",
"service": "cover.set_position",
"data_attribute": "position",
"min": 0,
"max": 100,
"step": 1
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "cover.example",
"attribute": "tilt_position",
"tap_action": {
"service": "cover.set_position",
"picker": {
"attribute": "position",
"data_attribute": "position",
"min": 0,
"max": 100,
"step": 1
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "cover.example",
"tap_action": {
"service": "cover.set_tilt_position",
"picker": {
"attribute": "tilt_position",
"data_attribute": "tilt_position",
"min": 0,
"max": 100,
"step": 1
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "media_player.example",
"attribute": "volume_level",
"tap_action": {
"service": "media_player.volume_set",
"picker": {
"attribute": "volume_level",
"data_attribute": "volume_level",
"min": 0,
"max": 1,
"step": 0.01
}
}
},
{
"type": "numeric",
"name": "Example",
"entity": "climate.example",
"attribute": "temperature",
"tap_action": {
"service": "climate.set_temperature",
"picker": {
"attribute": "temperature",
"data_attribute": "temperature"
}
}
}
],
"allOf": [
{
@@ -779,65 +952,15 @@
"tap_action": {
"type": "object",
"title": "Action",
"description": "'picker' field is required for 'numeric' menu type. 'confirm' and 'pin' fields are optional.",
"description": "'confirm' and 'pin' fields are optional.",
"properties": {
"picker": {
"$ref": "#/$defs/picker"
},
"confirm": {
"$ref": "#/$defs/confirm"
},
"pin": {
"$ref": "#/$defs/pin"
}
},
"if": {
"properties": {
"type": {
"const": "numeric"
}
}
},
"then": {
"required": [
"picker"
]
}
},
"picker": {
"type": "object",
"title": "Number picker configuration",
"description": "'attribute' field is optional.",
"properties": {
"min": {
"type": "number",
"title": "Minimum Value"
},
"max": {
"type": "number",
"title": "Maximum Value"
},
"step": {
"type": "number",
"title": "Step Size"
},
"attribute": {
"type": "string",
"title": "Attribute on the entity",
"description": "Attribute on the entity with the current numeric value. To use the state of the entity, do not specify."
},
"data_attribute": {
"type": "string",
"title": "Attribute on the service data",
"description": "Attribute on the service data for the value to set."
}
},
"required": [
"min",
"max",
"step",
"data_attribute"
]
},
"content": {
"title": "Home Assistant Template",