Skip to content

Commit

Permalink
Added Schema for display config and updated config.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgiesche committed Feb 29, 2024
1 parent e68359e commit 7736df8
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 5 deletions.
89 changes: 89 additions & 0 deletions public/config/default-display-config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"patternProperties": {
"^_icon$": {
"type": "string"
},
"^_color$": {
"type": "string"
},
"^_labelTemplates$": {
"type": "array",
"items": {
"type": "string"
}
},
"^_states$": {
"$ref": "#/definitions/nestedObjects"
},
"^[a-zA-Z0-9][a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"icon": {
"type": "string"
},
"color": {
"type": "string"
},
"labelTemplates": {
"type": "array",
"items": {
"type": "string"
}
},
"states": {
"$ref": "#/definitions/nestedObjects"
},
"classes": {
"$ref": "#/definitions/nestedObjects"
}
},
"additionalProperties": false,
"required": [],
"optional": [
"icon",
"color",
"labelTemplates",
"states",
"classes"
]
}
},
"additionalProperties": false,
"definitions": {
"nestedObjects": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"icon": {
"type": "string"
},
"color": {
"type": "string"
},
"labelTemplates": {
"type": "array",
"items": {
"type": "string"
}
},
"states": {
"$ref": "#/definitions/nestedObjects"
}
},
"additionalProperties": false,
"required": [],
"optional": [
"icon",
"color",
"labelTemplates",
"states"
]
}
}
}
}
}
11 changes: 6 additions & 5 deletions public/config/default-display-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

_color: "#a1a1a1"
_labelTemplates:
-
-
-
- ""
- ""
- "{{state}}{{unit_of_measurement}}"
_states:
unavailable:
Expand Down Expand Up @@ -59,11 +58,13 @@ binary_sensor:
plug:
icon: mdi:power-plug-off-outline
states:
on: mdi:power-plug-outline
on:
icon: mdi:power-plug-outline
window:
icon: mdi:window-closed-variant
states:
on: mdi:window-open-variant
on:
icon: mdi:window-open-variant

cover:
icon: mdi:garage
Expand Down

0 comments on commit 7736df8

Please sign in to comment.