Proposing changes to documentation and JSON Schema

Added proposed documentation section explaining Numeric data object and also updated JSON schema to match changes.

I tested the numeric example with tap_action.data in the documented web editor. The current schema did not appear to reject the field,
likely because numeric tap_action does not currently forbid additional properties at that nested level. I still added data explicitly
to the numeric schema so it is documented, discoverable, and type-checked as an object.
This commit is contained in:
StumblingGamer
2026-06-23 11:12:00 -04:00
parent b1fb5d9417
commit 17690d4349
2 changed files with 35 additions and 0 deletions

View File

@@ -256,6 +256,11 @@
"action": { "action": {
"$ref": "#/$defs/action" "$ref": "#/$defs/action"
}, },
"data": {
"type": "object",
"title": "Additional action data",
"description": "Fixed Home Assistant service data. The selected picker value is merged into this object using the picker's data_attribute. Service-specific fields cannot be schema checked here."
},
"picker": { "picker": {
"type": "object", "type": "object",
"title": "Number picker configuration", "title": "Number picker configuration",

View File

@@ -39,6 +39,36 @@ Field | Purpose
It may well be the case that often `attribute` and `data_attribute` are the same attribute, as with this example. It may well be the case that often `attribute` and `data_attribute` are the same attribute, as with this example.
## Additional Action Data
The `tap_action` object may also include a `data` object for fixed service call parameters. When the picker value is selected, the application merges the picker value into this `data` object using `data_attribute`.
For example, a light brightness picker can request a HomeAssistant transition while still using the picker value for `brightness`.
```json
{
"name": "Lounge Brightness",
"content": "{{ ((state_attr('light.lounge','brightness') | int(0) / 255) * 100) | round(0) }}%",
"type": "numeric",
"entity": "light.lounge",
"tap_action": {
"action": "light.turn_on",
"data": {
"transition": 2
},
"picker": {
"step": 5,
"min": 0,
"max": 255,
"attribute": "brightness",
"data_attribute": "brightness"
}
}
}
```
The resulting action data sent to HomeAssistant contains both the fixed `transition` value and the selected `brightness` value.
## Helper ## Helper
You might define a "helper" entity as follows in HomeAssistant: You might define a "helper" entity as follows in HomeAssistant: