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" "$ref": "#/$defs/content"
}, },
"tap_action": { "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": { "enabled": {
"$ref": "#/$defs/enabled" "$ref": "#/$defs/enabled"
@@ -310,12 +354,16 @@
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "brightness" "properties": {
},
"service": { "service": {
"const": "light.turn_on" "const": "light.turn_on"
}, },
"picker": {
"properties": {
"attribute": {
"const": "brightness"
},
"data_attribute": { "data_attribute": {
"const": "brightness" "const": "brightness"
}, },
@@ -327,6 +375,10 @@
"description": "Lights are not a percentage." "description": "Lights are not a percentage."
} }
} }
}
}
}
}
}, },
"else": { "else": {
"if": { "if": {
@@ -338,12 +390,13 @@
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "value" "properties": {
},
"service": { "service": {
"const": "input_number.set_value" "const": "input_number.set_value"
}, },
"picker": {
"properties": {
"data_attribute": { "data_attribute": {
"const": "value" "const": "value"
} }
@@ -353,6 +406,10 @@
"attribute" "attribute"
] ]
} }
}
}
}
}
}, },
"else": { "else": {
"if": { "if": {
@@ -364,12 +421,13 @@
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "value" "properties": {
},
"service": { "service": {
"const": "number.set_value" "const": "number.set_value"
}, },
"picker": {
"properties": {
"data_attribute": { "data_attribute": {
"const": "value" "const": "value"
} }
@@ -379,6 +437,10 @@
"attribute" "attribute"
] ]
} }
}
}
}
}
}, },
"else": { "else": {
"if": { "if": {
@@ -390,12 +452,16 @@
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "percentage" "properties": {
},
"service": { "service": {
"const": "fan.set_percentage" "const": "fan.set_percentage"
}, },
"picker": {
"properties": {
"attribute": {
"const": "percentage"
},
"data_attribute": { "data_attribute": {
"const": "percentage" "const": "percentage"
}, },
@@ -406,6 +472,10 @@
"const": 100 "const": 100
} }
} }
}
}
}
}
}, },
"else": { "else": {
"if": { "if": {
@@ -417,12 +487,16 @@
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "position" "properties": {
},
"service": { "service": {
"const": "valve.set_valve_position" "const": "valve.set_valve_position"
}, },
"picker": {
"properties": {
"attribute": {
"const": "position"
},
"data_attribute": { "data_attribute": {
"const": "position" "const": "position"
}, },
@@ -433,6 +507,10 @@
"const": 100 "const": 100
} }
} }
}
}
}
}
}, },
"else": { "else": {
"if": { "if": {
@@ -443,40 +521,45 @@
} }
}, },
"then": { "then": {
"allOf": [
{
"properties": {
"tap_action": {
"properties": { "properties": {
"attribute": {
"const": "position"
},
"service": { "service": {
"const": "cover.set_position" "enum": [
}, "cover.set_position",
"data_attribute": { "cover.set_tilt_position"
"const": "position" ]
}, }
"min": { }
"const": 0
},
"max": {
"const": 100
} }
} }
}, },
"else": { {
"if": { "if": {
"properties": { "properties": {
"entity": { "tap_action": {
"pattern": "^cover\\.[^.]+$" "properties": {
"service": {
"const": "cover.set_tilt_position"
}
}
} }
} }
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "tilt_position" "properties": {
},
"service": { "service": {
"const": "cover.set_tilt_position" "const": "cover.set_tilt_position"
}, },
"picker": {
"properties": {
"attribute": {
"const": "tilt_position"
},
"data_attribute": { "data_attribute": {
"const": "tilt_position" "const": "tilt_position"
}, },
@@ -487,6 +570,40 @@
"const": 100 "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": { "else": {
"if": { "if": {
@@ -498,12 +615,16 @@
}, },
"then": { "then": {
"properties": { "properties": {
"attribute": { "tap_action": {
"const": "volume_level" "properties": {
},
"service": { "service": {
"const": "media_player.volume_set" "const": "media_player.volume_set"
}, },
"picker": {
"properties": {
"attribute": {
"const": "volume_level"
},
"data_attribute": { "data_attribute": {
"const": "volume_level" "const": "volume_level"
}, },
@@ -514,6 +635,10 @@
"const": 1 "const": 1
} }
} }
}
}
}
}
}, },
"else": { "else": {
"if": { "if": {
@@ -524,16 +649,28 @@
} }
}, },
"then": { "then": {
"tap_action": {
"properties": {
"properties": {
"service": {
"const": "climate.set_temperature"
},
"picker": {
"properties": { "properties": {
"attribute": { "attribute": {
"const": "temperature" "const": "temperature"
}, },
"service": {
"const": "climate.set_temperature"
},
"data_attribute": { "data_attribute": {
"const": "temperature" "const": "temperature"
} }
},
"not": {
"required": [
"attribute"
]
}
}
}
} }
} }
} }
@@ -580,97 +717,133 @@
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "light.example", "entity": "light.example",
"attribute": "brightness", "tap_action": {
"service": "light.turn_on", "service": "light.turn_on",
"picker": {
"attribute": "brightness",
"data_attribute": "brightness", "data_attribute": "brightness",
"min": 0, "min": 0,
"max": 255, "max": 255,
"step": 1 "step": 1
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "input_number.example", "entity": "input_number.example",
"tap_action": {
"service": "input_number.set_value", "service": "input_number.set_value",
"picker": {
"data_attribute": "value", "data_attribute": "value",
"min": 0, "min": 0,
"max": 100, "max": 100,
"step": 1 "step": 1
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "number.example", "entity": "number.example",
"tap_action": {
"service": "number.set_value", "service": "number.set_value",
"picker": {
"data_attribute": "value", "data_attribute": "value",
"min": 0, "min": 0,
"max": 100, "max": 100,
"step": 1 "step": 1
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "fan.example", "entity": "fan.example",
"attribute": "percentage", "tap_action": {
"service": "fan.set_percentage", "service": "fan.set_percentage",
"picker": {
"attribute": "percentage",
"data_attribute": "percentage", "data_attribute": "percentage",
"min": 0, "min": 0,
"max": 100, "max": 100,
"step": 1, "step": 1,
"display_format": "%.0f%%" "display_format": "%.0f%%"
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "valve.example", "entity": "valve.example",
"attribute": "position", "tap_action": {
"service": "valve.set_valve_position", "service": "valve.set_valve_position",
"data_attribute": "position", "picker": {
"min": 0,
"max": 100,
"step": 1
},
{
"type": "numeric",
"name": "Example",
"entity": "cover.example",
"attribute": "position", "attribute": "position",
"service": "cover.set_position",
"data_attribute": "position", "data_attribute": "position",
"min": 0, "min": 0,
"max": 100, "max": 100,
"step": 1 "step": 1
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "cover.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", "service": "cover.set_tilt_position",
"picker": {
"attribute": "tilt_position",
"data_attribute": "tilt_position", "data_attribute": "tilt_position",
"min": 0, "min": 0,
"max": 100, "max": 100,
"step": 1 "step": 1
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "media_player.example", "entity": "media_player.example",
"attribute": "volume_level", "tap_action": {
"service": "media_player.volume_set", "service": "media_player.volume_set",
"picker": {
"attribute": "volume_level",
"data_attribute": "volume_level", "data_attribute": "volume_level",
"min": 0, "min": 0,
"max": 1, "max": 1,
"step": 0.01 "step": 0.01
}
}
}, },
{ {
"type": "numeric", "type": "numeric",
"name": "Example", "name": "Example",
"entity": "climate.example", "entity": "climate.example",
"attribute": "temperature", "tap_action": {
"service": "climate.set_temperature", "service": "climate.set_temperature",
"picker": {
"attribute": "temperature",
"data_attribute": "temperature" "data_attribute": "temperature"
} }
}
}
], ],
"allOf": [ "allOf": [
{ {
@@ -779,65 +952,15 @@
"tap_action": { "tap_action": {
"type": "object", "type": "object",
"title": "Action", "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": { "properties": {
"picker": {
"$ref": "#/$defs/picker"
},
"confirm": { "confirm": {
"$ref": "#/$defs/confirm" "$ref": "#/$defs/confirm"
}, },
"pin": { "pin": {
"$ref": "#/$defs/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": { "content": {
"title": "Home Assistant Template", "title": "Home Assistant Template",