mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-10-31 23:48:13 +00:00
Suggested code changes from philipabbey
1. attribute is option, so needs a different template in the API call when absent. 2. Automatically derive the format string from the picker step value for any precision of step. 3. Changed all Lang.String representations of numbers to Lang.Number or Lang.Float. I'm keen to remove the use of strings to hold a numeric value. 4. Tidied up and completed some code comments. 5. Adjusted the JSON schema definition. This is still not finished as the 'picker' object is required for 'numeric' menu items and must not be present for the others. Additional schema changes are required for greater precision. 6. Moved fields over from 'data' to 'picker'.
This commit is contained in:
@@ -283,50 +283,14 @@
|
||||
"exit": {
|
||||
"$ref": "#/$defs/exit"
|
||||
},
|
||||
"min": {
|
||||
"type": "number",
|
||||
"title": "Minimum Value"
|
||||
},
|
||||
"max": {
|
||||
"type": "number",
|
||||
"title": "Maximum Value"
|
||||
},
|
||||
"step": {
|
||||
"type": "number",
|
||||
"title": "Step Size"
|
||||
},
|
||||
"display_format": {
|
||||
"type": "string",
|
||||
"title": "Display Format",
|
||||
"description": "A C-Style format string for displaying the value in the UI. https://developer.garmin.com/connect-iq/api-docs/Toybox/Lang/Number.html#format-instance_function",
|
||||
"default": "%.1f"
|
||||
},
|
||||
"entity": {
|
||||
"$ref": "#/$defs/entity"
|
||||
},
|
||||
"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."
|
||||
},
|
||||
"service": {
|
||||
"$ref": "#/$defs/service"
|
||||
},
|
||||
"data_attribute": {
|
||||
"type": "string",
|
||||
"title": "Attribute on the service data",
|
||||
"description": "Attribute on the service data for the value to set."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"type",
|
||||
"min",
|
||||
"max",
|
||||
"step",
|
||||
"entity",
|
||||
"service",
|
||||
"data_attribute"
|
||||
"entity"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
@@ -816,6 +780,9 @@
|
||||
"title": "Action",
|
||||
"description": "'confirm' field is optional.",
|
||||
"properties": {
|
||||
"picker": {
|
||||
"$ref": "#/$defs/picker"
|
||||
},
|
||||
"confirm": {
|
||||
"$ref": "#/$defs/confirm"
|
||||
},
|
||||
@@ -824,6 +791,41 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"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",
|
||||
"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.",
|
||||
@@ -888,4 +890,4 @@
|
||||
"description": "Choose to exit the application after this item has been selected. Disabled (false) by default. N.B. Only actionable menu items can have this field added."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user