diff --git a/.vscode/settings.json b/.vscode/settings.json index 308f0c11d3..30bf8c2d3f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,16 +7,5 @@ "out": true // set this to false to include "out" folder in search results }, // Turn off tsc task auto detection since we have the necessary tasks as npm scripts - "typescript.tsc.autoDetect": "off", - "workbench.colorCustomizations": { - "activityBar.background": "#1f6fd0", - "activityBar.foreground": "#e7e7e7", - "activityBar.inactiveForeground": "#e7e7e799", - "activityBarBadge.background": "#ee90bb", - "activityBarBadge.foreground": "#15202b", - "titleBar.activeBackground": "#1857a4", - "titleBar.inactiveBackground": "#1857a499", - "titleBar.activeForeground": "#e7e7e7", - "titleBar.inactiveForeground": "#e7e7e799" - } + "typescript.tsc.autoDetect": "off" } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b4c9672977..d26e430a5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,33 +32,12 @@ "regenerator-runtime": "^0.13.2" } }, - "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "@types/node": { "version": "12.7.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz", "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==", "dev": true }, - "@types/ws": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.2.tgz", - "integrity": "sha512-22XiR1ox9LftTaAtn/c5JCninwc7moaqbkJfaDUb7PkaUitcf5vbTZHdq9dxSMviCm9C3W85rzB8e6yNR70apQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/yaml": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/yaml/-/yaml-1.0.2.tgz", - "integrity": "sha512-rS1VJFjyGKNHk8H97COnPIK+oeLnc0J9G0ES63o/Ky+WlJCeaFGiGCTGhV/GEVKua7ZWIV1JIDopYUwrfvTo7A==", - "dev": true - }, "agent-base": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", @@ -79,12 +58,6 @@ "uri-js": "^4.2.2" } }, - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -217,12 +190,6 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -240,17 +207,6 @@ "supports-color": "^5.3.0" } }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, "cls-hooked": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/cls-hooked/-/cls-hooked-4.2.2.tgz", @@ -329,12 +285,6 @@ "ms": "2.0.0" } }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -378,12 +328,6 @@ "shimmer": "^1.2.0" } }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, "es6-promise": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", @@ -438,15 +382,6 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -470,12 +405,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -538,6 +467,19 @@ "resolved": "https://registry.npmjs.org/home-assistant-js-websocket/-/home-assistant-js-websocket-4.3.1.tgz", "integrity": "sha512-eVIRdisSmcIzYKNSgB3gqUCrZpQkSUKlluYTsM0NqpUc4W0hHmF2vd8bShl3URWJXPOI5XPdeHuAPPqc0gUj+Q==" }, + "home-assistant-language-service": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/home-assistant-language-service/-/home-assistant-language-service-1.0.6.tgz", + "integrity": "sha512-WbsJtz8ojMSwMdcTxYPek/u8iAZ9CfMuf/rljkblcCVK06n1Q2mj3bFXcYbbGtsPgzQ93z466hoJh1GR5KaJ/w==", + "requires": { + "home-assistant-js-websocket": "4.3.1", + "vscode-json-languageservice": "3.3.1", + "vscode-languageserver-protocol": "3.14.1", + "ws": "7.1.2", + "yaml": "1.6.0", + "yaml-language-server": "0.5.3" + } + }, "http-proxy-agent": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", @@ -583,12 +525,6 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -634,15 +570,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "~0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -654,12 +581,6 @@ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.1.0.tgz", "integrity": "sha512-n9GrT8rrr2fhvBbANa1g+xFmgGK5X91KFeDwlKQ3+SJfmH5+tKv/M/kahx/TXOMflfWHKGKqKyfHQaLKTNzJ6w==" }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -672,16 +593,6 @@ "verror": "1.10.0" } }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, "make-error": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", @@ -797,36 +708,6 @@ "wrappy": "1" } }, - "p-limit": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", - "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -918,18 +799,6 @@ "vscode-nls": "^4.0.0" } }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -962,12 +831,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", "integrity": "sha1-fnQlb7qknHWqfHogXMInmcrIAAQ=" }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, "shimmer": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/shimmer/-/shimmer-1.2.1.tgz", @@ -1016,26 +879,6 @@ "resolved": "https://registry.npmjs.org/stack-chain/-/stack-chain-1.3.7.tgz", "integrity": "sha1-0ZLJ/06moiyUxN1FkXHj8AzqEoU=" }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -1141,40 +984,6 @@ "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", "dev": true }, - "typescript-json-schema": { - "version": "0.39.0", - "resolved": "https://registry.npmjs.org/typescript-json-schema/-/typescript-json-schema-0.39.0.tgz", - "integrity": "sha512-ax2UxMMdEhWIwvTjxwJxLmbGIATkY4vxPHeS9wItTb1RfhiUU927YqVixopxURQejbW+ki2awg+eSwRnA5ZUgA==", - "dev": true, - "requires": { - "glob": "~7.1.4", - "json-stable-stringify": "^1.0.1", - "typescript": "^3.5.1", - "yargs": "^13.2.4" - }, - "dependencies": { - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "typescript": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", - "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", - "dev": true - } - } - }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -1250,11 +1059,6 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.0-next.2.tgz", "integrity": "sha512-2JkrMWWUi2rlVLSo9OFR2PIGUzdiowEM8NgNYiwLKnXTjpwpjjIrJbNNxDik7Rv4oo9KtikcFQZKXbrKilL/MQ==" }, - "vscode-nls": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.1.1.tgz", - "integrity": "sha512-4R+2UoUUU/LdnMnFjePxfLqNhBS8lrAFyX7pjb2ud/lqDkrUavFUTcG7wR0HBZFakae0Q6KLBFjMS6W93F403A==" - }, "vscode-uri": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.0.3.tgz", @@ -1274,17 +1078,6 @@ "requires": { "semver": "^5.5.0", "vscode-languageserver-protocol": "3.14.1" - }, - "dependencies": { - "vscode-languageserver-protocol": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", - "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", - "requires": { - "vscode-jsonrpc": "^4.0.0", - "vscode-languageserver-types": "3.14.0" - } - } } }, "vscode-languageserver": { @@ -1330,23 +1123,6 @@ "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.8.tgz", "integrity": "sha512-obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ==" }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1361,12 +1137,6 @@ "async-limiter": "^1.0.0" } }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, "yaml": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.6.0.tgz", @@ -1413,31 +1183,6 @@ } } }, - "vscode-languageserver": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-5.2.1.tgz", - "integrity": "sha512-GuayqdKZqAwwaCUjDvMTAVRPJOp/SLON3mJ07eGsx/Iq9HjRymhKWztX41rISqDKhHVVyFM+IywICyZDla6U3A==", - "requires": { - "vscode-languageserver-protocol": "3.14.1", - "vscode-uri": "^1.0.6" - }, - "dependencies": { - "vscode-uri": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.8.tgz", - "integrity": "sha512-obtSWTlbJ+a+TFRYGaUumtVwb+InIUVI0Lu0VBUAPmj2cU5JutEXg3xUE0c2J5Tcy7h2DEKVJBFi+Y9ZSFzzPQ==" - } - } - }, - "vscode-languageserver-protocol": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", - "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", - "requires": { - "vscode-jsonrpc": "^4.0.0", - "vscode-languageserver-types": "3.14.0" - } - }, "vscode-uri": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.0.3.tgz", @@ -1445,34 +1190,6 @@ } } }, - "yargs": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", - "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" - } - }, - "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, "yn": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.0.tgz", diff --git a/package.json b/package.json index c7ecce6619..3b486879cd 100644 --- a/package.json +++ b/package.json @@ -136,24 +136,16 @@ "vscode:prepublish": "tsc -p ./" }, "devDependencies": { - "@types/mocha": "5.2.7", "@types/node": "12.7.2", - "@types/ws": "6.0.2", - "@types/yaml": "1.0.2", "ts-node": "8.3.0", "tslint": "^5.18.0", "typescript": "3.5.3", - "typescript-json-schema": "0.39.0", "vscode": "^1.1.36" }, "dependencies": { - "home-assistant-js-websocket": "4.3.1", - "ws": "7.1.2", - "vscode-json-languageservice": "3.3.1", - "vscode-languageclient": "5.2.1", + "home-assistant-language-service": "1.0.6", "vscode-languageserver": "5.2.1", - "yaml-language-server": "0.5.3", - "yaml": "1.6.0", + "vscode-languageclient": "5.2.1", "vscode-extension-telemetry": "0.1.2" } } diff --git a/src/server/completionHelpers/entityIds.ts b/src/server/completionHelpers/entityIds.ts deleted file mode 100644 index 69ee2752be..0000000000 --- a/src/server/completionHelpers/entityIds.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { MarkedString, CompletionItem, CompletionItemKind } from 'vscode-languageserver'; -import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice'; -import { IHaConnection } from '../home-assistant/haConnection'; - -export class EntityIdCompletionContribution implements JSONWorkerContribution { - - public static propertyMatches: string[] = [ - "entity_id", - "entity", - "entities", - "include_entities", - "exclude_entities", - "badges" - ]; - - constructor(private haConnection: IHaConnection) { - } - - public collectDefaultCompletions(resource: string, result: CompletionsCollector): Thenable { - return null; - } - - public collectPropertyCompletions = async (resource: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Promise => { - if (location.length < 2) { - return; - } - var currentNode = location[location.length - 1]; - var parentNode = location[location.length - 2]; // in case or arrays, currentNode is the indexer for the array position - if (!EntityIdCompletionContribution.propertyMatches.some(x => x === currentNode || (!isNaN(+currentNode) && x === parentNode))) { - return null; - } - var entityIdCompletions = await this.haConnection.getEntityCompletions(); - entityIdCompletions.forEach(c => result.add(c)); - - return null; - } - - public collectValueCompletions = async (resource: string, location: JSONPath, currentKey: string, result: CompletionsCollector): Promise => { - if (!EntityIdCompletionContribution.propertyMatches.some(x => x === currentKey)) { - return null; - } - var entityIdCompletions = await this.haConnection.getEntityCompletions(); - entityIdCompletions.forEach(c => result.add(c)); - - return null; - } - - public getInfoContribution(resource: string, location: JSONPath): Thenable { - return null; - } -} \ No newline at end of file diff --git a/src/server/completionHelpers/services.ts b/src/server/completionHelpers/services.ts deleted file mode 100644 index 5780ec2b15..0000000000 --- a/src/server/completionHelpers/services.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { MarkedString } from 'vscode-languageserver'; -import { JSONWorkerContribution, JSONPath, CompletionsCollector } from 'vscode-json-languageservice'; -import { IHaConnection } from '../home-assistant/haConnection'; - -export class ServicesCompletionContribution implements JSONWorkerContribution { - - public static propertyMatches: string[] = [ - "service" - ]; - - constructor(private haConnection: IHaConnection) { - } - - public collectDefaultCompletions(resource: string, result: CompletionsCollector): Thenable { - return null; - } - - public collectPropertyCompletions = async (resource: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Promise => { - if (location.length < 2) { - return; - } - var currentNode = location[location.length - 1]; - var parentNode = location[location.length - 2]; // in case or arrays, currentNode is the indexer for the array position - if (!ServicesCompletionContribution.propertyMatches.some(x => x === currentNode || x === parentNode)) { - return null; - } - var servicesCompletions = await this.haConnection.getServiceCompletions(); - servicesCompletions.forEach(c => result.add(c)); - - return null; - } - - public collectValueCompletions = async (resource: string, location: JSONPath, currentKey: string, result: CompletionsCollector): Promise => { - if (!ServicesCompletionContribution.propertyMatches.some(x => x === currentKey)) { - return null; - } - var servicesCompletions = await this.haConnection.getServiceCompletions(); - servicesCompletions.forEach(c => result.add(c)); - - return null; - } - - public getInfoContribution(resource: string, location: JSONPath): Thenable { - return null; - } -} \ No newline at end of file diff --git a/src/server/configuration.ts b/src/server/configuration.ts deleted file mode 100644 index 09df4b5642..0000000000 --- a/src/server/configuration.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { DidChangeConfigurationParams } from "vscode-languageserver"; -import Uri from 'vscode-uri'; - -export interface IConfigurationService { - isConfigured: boolean; - token?: string; - url?: string; - ignoreCertificates: boolean; - updateConfiguration(config: DidChangeConfigurationParams): void; -} - -export interface HomeAssistantConfiguration { - longLivedAccessToken?: string; - hostUrl?: string; - ignoreCertificates: boolean; -} - -export class ConfigurationService implements IConfigurationService { - public isConfigured: boolean = false; - public token?: string; - public url?: string; - public ignoreCertificates: boolean = false; - - constructor() { - this.setConfigViaEnvironmentVariables(); - - this.isConfigured = `${this.url}` !== ""; - } - - public updateConfiguration = (config: DidChangeConfigurationParams): void => { - var incoming = config.settings["vscode-home-assistant"]; - - this.token = incoming.longLivedAccessToken; - this.url = this.getUri(incoming.hostUrl); - this.ignoreCertificates = !!incoming.ignoreCertificates; - - this.setConfigViaEnvironmentVariables(); - - this.isConfigured = `${this.url}` !== ""; - } - - private setConfigViaEnvironmentVariables() { - if (!this.url && process.env.HASS_SERVER) { - this.url = this.getUri(process.env.HASS_SERVER); - } - if (!this.token && process.env.HASS_TOKEN) { - this.token = process.env.HASS_TOKEN; - } - } - - private getUri =(value: string) : string =>{ - if (!value) { - return ""; - } - var uri = Uri.parse(value); - return `${uri.scheme}://${uri.authority}${uri.path.replace(/\/$/, "")}`; - } -} diff --git a/src/server/definition/definition.ts b/src/server/definition/definition.ts deleted file mode 100644 index 779948197b..0000000000 --- a/src/server/definition/definition.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Definition, DefinitionLink } from "vscode-languageserver"; - -export interface DefinitionProvider { - onDefinition(line: string, uri: string): Promise; -} \ No newline at end of file diff --git a/src/server/definition/includes.ts b/src/server/definition/includes.ts deleted file mode 100644 index 029f50aa67..0000000000 --- a/src/server/definition/includes.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { FileAccessor } from "../fileAccessor"; -import { Definition, DefinitionLink, Location } from "vscode-languageserver"; -import { DefinitionProvider } from "./definition"; -import * as path from 'path'; - -export class IncludeDefinitionProvider implements DefinitionProvider { - - constructor(private fileAccessor: FileAccessor) { - } - - public onDefinition = async (line: string, uri: string): Promise => { - let matches = /(.*)(!include([\S]*))([\s]*)*(.*)/.exec(line); - if (!matches || matches.length !== 6) { - return []; - } - let includeType = matches[2]; - let whatToInclude = `${matches[5]}`.trim(); - switch (includeType) { - case "!include": - let destination = this.fileAccessor.getRelativePathAsFileUri(uri, whatToInclude); - return [Location.create(destination, { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 } - })]; - case "!include_dir_list": - case "!include_dir_named": - case "!include_dir_merge_list": - case "!include_dir_merge_named": - var files = this.fileAccessor.getFilesInFolderRelativeFromAsFileUri(whatToInclude, uri); - files = files.filter(f => path.extname(f) === ".yaml"); - if (files.length === 0){ - console.warn(`There were no files found in folder '${whatToInclude}' referenced with '${includeType}' from '${uri}'`); - } - return files.map(f => Location.create(f, { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 } - })); - default: - return []; - } - }; -} diff --git a/src/server/definition/scripts.ts b/src/server/definition/scripts.ts deleted file mode 100644 index c52f4cd664..0000000000 --- a/src/server/definition/scripts.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { FileAccessor } from "../fileAccessor"; -import { Definition, DefinitionLink, Location } from "vscode-languageserver"; -import { HomeAssistantConfiguration } from "../haConfig/haConfig"; -import { DefinitionProvider } from "./definition"; - -export class ScriptDefinitionProvider implements DefinitionProvider { - - constructor(private haConfig: HomeAssistantConfiguration) { - } - - public onDefinition = async (line: string, uri: string): Promise => { - let matches = /(.*)(script\.([\S]*))([\s]*)*(.*)/.exec(line); - if (!matches || matches.length !== 6) { - return []; - } - let scripts = await this.haConfig.getScripts(); - var scriptName = matches[3].replace(":", ""); // might be possible in regex!? - let ourScript = scripts[scriptName]; - if (!ourScript) { - return []; - } - return [Location.create(ourScript.fileUri, { - start: { line: ourScript.start[0], character: ourScript.start[1] }, - end: { line: ourScript.end[0], character: ourScript.end[1] } - })]; - } -} diff --git a/src/server/haConfig/dto.ts b/src/server/haConfig/dto.ts deleted file mode 100644 index 9ae2ace024..0000000000 --- a/src/server/haConfig/dto.ts +++ /dev/null @@ -1,36 +0,0 @@ -export interface HaFileInfo { - filename: string; - path: string; -} - -export interface IncludeReferences { - [filename: string]: { - path: string; - includeType: Includetype; - start: number; - end: number; - }; -}export interface ScriptReferences { - [scriptFilename: string]: { - fileUri: string; - start: [number, number]; - end: [number, number]; - }; -} - -export enum Includetype { - include, - include_dir_list, - include_dir_named, - include_dir_merge_list, - include_dir_merge_named -} - -export interface YamlIncludePlaceholder { - isInclude: boolean; - fromFile: string; - includeType: Includetype; - toFileOrFolder: string; - start: number; - end: number; -} \ No newline at end of file diff --git a/src/server/haConfig/haConfig.ts b/src/server/haConfig/haConfig.ts deleted file mode 100644 index 765f7c0ac7..0000000000 --- a/src/server/haConfig/haConfig.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { FileAccessor } from "../fileAccessor"; -import { HomeAssistantYamlFile } from "./haYamlFile"; -import { IncludeReferences, ScriptReferences, HaFileInfo } from "./dto"; - -export class HomeAssistantConfiguration { - - private files: FilesCollection; - - public constructor(private fileAccessor: FileAccessor) { - this.files = {}; - } - - public getAllFiles = async (): Promise => { - let allFiles: HaFileInfo[] = []; - - for (var filename in this.files) { - - allFiles.push({ - filename: filename, - path: this.files[filename].path - }); - } - return allFiles; - } - - public updateFile = async (uri: string): Promise => { - let filename = this.fileAccessor.fromUriToLocalPath(uri); - - let ourFile = this.files[filename]; - if (!ourFile) { - return { - isValidYaml: true, - newFilesFound: true - }; - } - var homeAssistantYamlFile = new HomeAssistantYamlFile(this.fileAccessor, filename, ourFile.path); - this.files[filename] = homeAssistantYamlFile; - - var validationResult = await homeAssistantYamlFile.isValid(); - if (!validationResult.isValid) { - return { - isValidYaml: false, - newFilesFound: false - }; - } - - let files = await this.discoverCore(filename, ourFile.path, {}); - ourFile = files[filename]; - this.files[filename] = ourFile; - - for (let filename in files) { - if (!this.files[filename]) { - return { - isValidYaml: true, - newFilesFound: true - }; - } - } - return { - isValidYaml: true, - newFilesFound: false - }; - } - - public getIncludes = async (): Promise => { - var allIncludes = {}; - for (var filename in this.files) { - var includes = await this.files[filename].getIncludes(); - allIncludes = { ...allIncludes, ...includes }; - } - return allIncludes; - } - - public getScripts = async (): Promise => { - var allScripts = {}; - for (var filename in this.files) { - var scripts = await this.files[filename].getScripts(); - allScripts = { ...allScripts, ...scripts }; - } - return allScripts; - } - - private getRootFiles = (): string[] => { - var filesInRoot = this.fileAccessor.getFilesInFolder(""); - let files = ["configuration.yaml", "ui-lovelace.yaml"].filter(f => filesInRoot.some(y => y === f)); - return files; - } - - public discoverFiles = async (): Promise => { - let rootFiles = this.getRootFiles(); - this.files = {}; - for (var index in rootFiles) { - this.files = await this.discoverCore(rootFiles[index], rootFiles[index], this.files); - } - } - - private discoverCore = async (filename: string, path: string, files: FilesCollection): Promise => { - - var homeAssistantYamlFile = new HomeAssistantYamlFile(this.fileAccessor, filename, path); - files[filename] = homeAssistantYamlFile; - - let error = false; - var errorMessage = `File '${filename}' could not be parsed, it was referenced from path '${path}'. This file will be ignored.`; - try { - var includes = await homeAssistantYamlFile.getIncludes(); - } - catch (err) { - error = true; - errorMessage += ` Error message: ${err}`; - } - - var validationResult = await homeAssistantYamlFile.isValid(); - if (!validationResult.isValid) { - error = true; - if (validationResult.errors && validationResult.errors.length > 0) { - errorMessage += " Error(s): "; - validationResult.errors.forEach(e => errorMessage += `\r\n - ${e}`); - } - } - if (error) { - if (filename === path) { - // root file has more impact - console.warn(errorMessage); - } - else { - console.log(errorMessage); - } - return files; - } - - for (var filenameKey in includes) { - if (Object.keys(files).some(x => x === filenameKey)) { - /// we already know this file - continue; - } - var currentPath = `${includes[filenameKey].path}`; - - files = await this.discoverCore(filenameKey, currentPath, files); - } - return files; - } -} - -export interface FilesCollection { - [filename: string]: HomeAssistantYamlFile; -} -export interface FileUpdateResult { - isValidYaml: boolean; - newFilesFound: boolean; -} \ No newline at end of file diff --git a/src/server/haConfig/haYamlFile.ts b/src/server/haConfig/haYamlFile.ts deleted file mode 100644 index 719d65969e..0000000000 --- a/src/server/haConfig/haYamlFile.ts +++ /dev/null @@ -1,253 +0,0 @@ -import * as path from "path"; -import * as YAML from "yaml"; -import getLinePos from "yaml/dist/cst/getLinePos"; -import { FileAccessor } from "../fileAccessor"; -import { IncludeReferences, Includetype, ScriptReferences } from "./dto"; -import Uri from 'vscode-uri'; - -export class HomeAssistantYamlFile { - - private cst: YAML.ParsedCST | undefined; - private yaml: YAML.ast.Document | undefined; - private includes: IncludeReferences = {}; - private scripts: ScriptReferences = {}; - - constructor(private fileAccessor: FileAccessor, private filename: string, public path: string) { } - - private async parse(): Promise { - - var fileContents = await this.fileAccessor.getFileContents(this.filename); - if (!fileContents) { - return; - } - - this.cst = YAML.parseCST(fileContents); - this.yaml = new YAML.Document({ - // @ts-ignore the typings of this library are not up to date - customTags: this.getCustomTags() - }).parse(this.cst[0]); - - await this.parseAstRecursive(this.yaml.contents, this.path); - } - - public isValid = async (): Promise => { - try { - await this.parse(); - } - catch (e) { - return { - isValid: false, - errors: [e] - }; - } - if (!this.yaml) { - return { - isValid: false, - errors: ["Empty yaml"] - }; - } - if (this.yaml.errors && this.yaml.errors.length > 0) { - var errors = this.yaml.errors.slice(0, 3).map(x => { - //@ts-ignore - let line = (x.source && x.source.rangeAsLinePos && x.source.rangeAsLinePos.start) ? ` (Line: ${x.source.rangeAsLinePos.start.line})` : ""; - return `${x.name}: ${x.message}${line}`; - }); - if (this.yaml.errors.length > 3) { - errors.push(` - And ${this.yaml.errors.length - 3} more errors...`) - } - return { - isValid: false, - errors: errors - }; - } - return { - isValid: true - }; - } - - public getIncludes = async (): Promise => { - if (!this.yaml) { - await this.parse(); - } - if (!this.yaml) { - return; - } - return this.includes; - } - - public getScripts = async (): Promise => { - if (!this.yaml) { - await this.parse(); - } - if (!this.yaml) { - return; - } - return this.scripts; - } - - private getCustomTags(): YAML.Tag[] { - - return [ - `secret`, - `${Includetype[Includetype.include]}`, - `${Includetype[Includetype.include_dir_list]}`, - `${Includetype[Includetype.include_dir_merge_list]}`, - `${Includetype[Includetype.include_dir_merge_named]}`, - `${Includetype[Includetype.include_dir_named]}` - //@ts-ignore - ].map(x => - { - tag: `!${x}`, - resolve: (doc, cst) => Symbol.for(cst.strValue) - }); - } - - private parseAstRecursive = async (node: YAML.ast.AstNode | null, currentPath: string): Promise => { - if (!node) { - // null object like 'frontend:' - return; - } - switch (node.type) { - case "MAP": - case "FLOW_SEQ": - case "SEQ": - if (node.type !== "FLOW_SEQ" && (currentPath === "configuration.yaml/script" || currentPath === "configuration.yaml/homeassistant/packages/script")) { - this.collectScripts(node); - } - for (let i in node.items) { - var item = node.items[i]; - switch (item.type) { - case "PAIR": - await this.parseAstRecursive(item.value, `${currentPath}/${this.getKeyName(item.key)}`); - break; - case "SEQ": - case "MAP": - case "BLOCK_FOLDED": - case "BLOCK_LITERAL": - case "PLAIN": - case "QUOTE_DOUBLE": - case "QUOTE_SINGLE": - case "FLOW_SEQ": - await this.parseAstRecursive(item, currentPath); - break; - default: - console.log(`huh ${currentPath}`); - break; - } - } - break; - case "BLOCK_FOLDED": - case "BLOCK_LITERAL": - case "PLAIN": - case "QUOTE_DOUBLE": - case "QUOTE_SINGLE": - if (node.tag) { - await this.collectInclude(node, currentPath); - } - break; - } - } - - private getKeyName = (node: YAML.ast.AstNode): string => { - if (node.tag && node.type === "PLAIN") { - return node.value.toString().slice(7, -1); - } - else { - return node.toJSON(); - } - } - - private getIncludeType = (str: string): Includetype | null => { - - var includeType: Includetype; - switch (str) { - case `${Includetype[Includetype.include]}`: - includeType = Includetype.include; - break; - case `${Includetype[Includetype.include_dir_list]}`: - includeType = Includetype.include_dir_list; - break; - case `${Includetype[Includetype.include_dir_merge_list]}`: - includeType = Includetype.include_dir_merge_list; - break; - case `${Includetype[Includetype.include_dir_merge_named]}`: - includeType = Includetype.include_dir_merge_named; - break; - case `${Includetype[Includetype.include_dir_named]}`: - includeType = Includetype.include_dir_named; - break; - default: - return null; - } - return includeType; - } - - private async collectInclude(x: YAML.ast.ScalarNode, currentPath: string) { - var value: null | boolean | number | string = ""; - var includeType = this.getIncludeType(`${x.tag}`.slice(1).toLowerCase()); - if (includeType === null) { - // secrets and other tags - return; - } - - value = x.value.toString().slice(7, -1).replace(/\\/g, "/"); // \ to / on windows - - let files: string[] = []; - - if (includeType === Includetype.include) { - var relativeFilePath = this.fileAccessor.getRelativePath(this.filename, value); - // single file include - files.push(relativeFilePath); - } - else { - // multiple file include - var filesInThisFolder = await this.fileAccessor.getFilesInFolderRelativeFrom(value, this.filename); - files = filesInThisFolder.filter(f => path.extname(f) === ".yaml"); - } - - if (files.length === 0) { - console.log(`The include could not be resolved because no file(s) found in '${value}' included with '${Includetype[includeType]}' from '${this.filename}'`); - } - - for (var i in files) { - var key = files[i].replace(/\\/g, "/"); - this.includes[key] = { - path: currentPath, - includeType: includeType, - start: x.range[0], - end: x.range[1] - }; - } - } - - private collectScripts(node: YAML.ast.Map | YAML.ast.Seq) { - for (var i in node.items) { - var item = node.items[i]; - //@ts-ignore - let isNamed = item.value && item.value.type === "MAP"; - - let filepath = Uri.file(path.resolve(this.filename)).fsPath; - let filename = path.parse(filepath).base.replace(".yaml", ""); - - //@ts-ignore - var key = isNamed ? item.key.toJSON() : filename; - - if (item.type === "PAIR") { - //@ts-ignore - var lp = getLinePos(item.key.range[0], this.cst); - var lp2 = getLinePos(item.value.range[1], this.cst); - - this.scripts[key] = { - fileUri: Uri.file(filepath).toString(), - start: [lp.line - 1, lp.col - 1], - end: [lp2.line - 1, lp2.col - 1] - }; - } - } - } -} - -export interface ValidationResults { - isValid: boolean; - errors?: string[]; -} \ No newline at end of file diff --git a/src/server/haLanguageService.ts b/src/server/haLanguageService.ts deleted file mode 100644 index 5bd092d458..0000000000 --- a/src/server/haLanguageService.ts +++ /dev/null @@ -1,242 +0,0 @@ -import { TextDocuments, CompletionList, TextDocumentChangeEvent, DidChangeWatchedFilesParams, DidOpenTextDocumentParams, TextDocument, Position, CompletionItem, TextEdit, Definition, DefinitionLink, TextDocumentPositionParams, Location, IConnection, Diagnostic, Hover } from "vscode-languageserver"; -import { YamlLanguageService } from "./yamlLanguageService"; -import { SchemaServiceForIncludes } from "./schemas/schemaService"; -import { EntityIdCompletionContribution } from "./completionHelpers/entityIds"; -import { getLineOffsets } from "yaml-language-server/out/server/src/languageservice/utils/arrUtils"; -import { HaConnection } from "./home-assistant/haConnection"; -import { ServicesCompletionContribution } from "./completionHelpers/services"; -import { DefinitionProvider } from "./definition/definition"; -import { HomeAssistantConfiguration } from "./haConfig/haConfig"; - -export class HomeAssistantLanguageService { - - constructor( - private documents: TextDocuments, - private yamlLanguageService: YamlLanguageService, - private haConfig: HomeAssistantConfiguration, - private haConnection: HaConnection, - private definitionProviders: DefinitionProvider[], - private schemaServiceForIncludes: SchemaServiceForIncludes - ) { } - - public findAndApplySchemas = async (connection: IConnection) => { - - try { - var haFiles = await this.haConfig.getAllFiles(); - if (haFiles && haFiles.length > 0) { - console.log(`Applying schema's to ${haFiles.length} of your configuration files...`); - } - this.schemaServiceForIncludes.onUpdate(haFiles); - this.documents.all().forEach(async d => { - var diagnostics = await this.getDiagnostics(d); - this.sendDiagnostics(d.uri, diagnostics, connection); - }); - } - catch (err) { - console.error(`Unexpected error updating the schema's, message: ${err}`, err); - } - console.log(`Schema's updated!`); - } - - private onDocumentChangeDebounce: NodeJS.Timer; - - public onDocumentChange = async (textDocumentChangeEvent: TextDocumentChangeEvent, connection: IConnection): Promise => { - - clearTimeout(this.onDocumentChangeDebounce); - - this.onDocumentChangeDebounce = setTimeout(async () => { - var singleFileUpdate = await this.haConfig.updateFile(textDocumentChangeEvent.document.uri); - if (singleFileUpdate.isValidYaml && singleFileUpdate.newFilesFound) { - console.log(`Discover all configuration files because ${textDocumentChangeEvent.document.uri} got updated and new files were found...`); - await this.haConfig.discoverFiles(); - await this.findAndApplySchemas(connection); - } - - var diagnostics = await this.getDiagnostics(textDocumentChangeEvent.document); - - this.sendDiagnostics(textDocumentChangeEvent.document.uri, diagnostics, connection); - }, 600); - - } - - private onDidSaveDebounce: NodeJS.Timer; - - public onDidSave = async (e: TextDocumentChangeEvent, connection: IConnection): Promise => { - clearTimeout(this.onDidSaveDebounce); - - this.onDidSaveDebounce = setTimeout(async () => { - await this.haConfig.discoverFiles(); - await this.findAndApplySchemas(connection); - }, 100); - } - - public onDocumentOpen = async (textDocumentChangeEvent: TextDocumentChangeEvent, connection: IConnection): Promise => { - var diagnostics = await this.getDiagnostics(textDocumentChangeEvent.document); - - this.sendDiagnostics(textDocumentChangeEvent.document.uri, diagnostics, connection); - } - - private sendDiagnostics(uri: string, diagnostics: Diagnostic[], connection: IConnection) { - connection.sendDiagnostics({ - uri: uri, - diagnostics: diagnostics - }); - } - - public getDiagnostics = async (document: TextDocument): Promise => { - - if (!document || document.getText().length === 0) { - return; - } - - var diagnosticResults = await this.yamlLanguageService.doValidation(document); - - if (!diagnosticResults) { - return; - } - let diagnostics = []; - - for (let diagnosticItem in diagnosticResults) { - diagnosticResults[diagnosticItem].severity = 1; //Convert all warnings to errors - diagnostics.push(diagnosticResults[diagnosticItem]); - } - - return diagnostics; - } - - public onDocumentSymbol = (documentSymbolParams) => { - let document = this.documents.get(documentSymbolParams.textDocument.uri); - - if (!document) { - return; - } - - return this.yamlLanguageService.findDocumentSymbols(document); - } - - public onDocumentFormatting = (formatParams): TextEdit[] => { - let document = this.documents.get(formatParams.textDocument.uri); - - if (!document) { - return; - } - - return this.yamlLanguageService.format(document, formatParams.options); - } - - public onCompletion = async (textDocumentPosition): Promise => { - let textDocument = this.documents.get( - textDocumentPosition.textDocument.uri - ); - - let result: CompletionList = { - items: [], - isIncomplete: false - }; - - if (!textDocument) { - return Promise.resolve(result); - } - - var completions: CompletionList = await this.yamlLanguageService.doComplete(textDocument, textDocumentPosition.position); - - var additionalCompletions = await this.getServiceAndEntityCompletions(textDocument, textDocumentPosition.position, completions); - if (additionalCompletions.length > 0) { - completions.items.push(...additionalCompletions); - } - return completions; - } - - public onCompletionResolve = async (completionItem): Promise => { - return await this.yamlLanguageService.doResolve(completionItem); - } - - public onHover = async (textDocumentPositionParams): Promise => { - let document = this.documents.get(textDocumentPositionParams.textDocument.uri); - - if (!document) { - return; - } - - return await this.yamlLanguageService.doHover(document, textDocumentPositionParams.position); - } - - public onDefinition = async (textDocumentPositionParams: TextDocumentPositionParams): Promise => { - let textDocument = this.documents.get(textDocumentPositionParams.textDocument.uri); - - if (!textDocument) { - return; - } - const lineOffsets: number[] = getLineOffsets(textDocument.getText()); - const start: number = lineOffsets[textDocumentPositionParams.position.line]; - const end: number = lineOffsets[textDocumentPositionParams.position.line + 1]; - let thisLine = textDocument.getText().substring(start, end); - - var definitions = []; - for (var p in this.definitionProviders) { - let provider = this.definitionProviders[p]; - var providerResults = await provider.onDefinition(thisLine, textDocument.uri); - if (providerResults) { - definitions = definitions.concat(providerResults); - } - } - return definitions; - } - - private getServiceAndEntityCompletions = async (document: TextDocument, textDocumentPosition: Position, currentCompletions: CompletionList): Promise => { - // sadly this is needed here. - // the normal completion engine cannot provide completions for type `string | string[]` - // updating the type to only one of the 2 types will break the yaml-validation. - // so we tap in here, iterate over the lines of the text file to see if this if - // we need to add entity_id's to the completion list - - var properties: { [provider: string]: string[] } = {}; - properties["entities"] = EntityIdCompletionContribution.propertyMatches; - properties["services"] = ServicesCompletionContribution.propertyMatches; - - var additionalCompletionProvider = this.findAutoCompletionProperty(document, textDocumentPosition, properties); - let additionalCompletion: CompletionItem[] = []; - switch (additionalCompletionProvider) { - case "entities": - // sometimes the entities are already added, do not add them twice - if (!currentCompletions.items.some(x => x.data && x.data.isEntity)) { - additionalCompletion = await this.haConnection.getEntityCompletions(); - } - break; - case "services": - if (!currentCompletions.items.some(x => x.data && x.data.isService)) { - additionalCompletion = await this.haConnection.getServiceCompletions(); - } - break; - } - return additionalCompletion; - } - - private findAutoCompletionProperty = (document: TextDocument, textDocumentPosition: Position, properties: { [provider: string]: string[] }): string => { - let currentLine = textDocumentPosition.line; - while (currentLine >= 0) { - const lineOffsets: number[] = getLineOffsets(document.getText()); - const start: number = lineOffsets[currentLine]; - var end = 0; - if (lineOffsets[currentLine + 1] !== undefined) { - end = lineOffsets[currentLine + 1]; - } else { - end = document.getText().length; - } - let thisLine = document.getText().substring(start, end); - - let isOtherItemInList = thisLine.match(/-\s*([-\w]+)?(\.)?([-\w]+?)?\s*$/); - if (isOtherItemInList) { - currentLine--; - continue; - } - for (var key in properties) { - if (properties[key].some(propertyName => new RegExp(`(.*)${propertyName}(:)([\s]*)([\w]*)(\s*)`).test(thisLine))) { - return key; - } - } - return undefined; - } - return undefined; - } -} diff --git a/src/server/home-assistant/haConnection.ts b/src/server/home-assistant/haConnection.ts deleted file mode 100644 index 41305ca5b8..0000000000 --- a/src/server/home-assistant/haConnection.ts +++ /dev/null @@ -1,222 +0,0 @@ -import * as ha from "home-assistant-js-websocket"; -import { CompletionItem, CompletionItemKind, MarkupContent } from 'vscode-languageserver'; -import { IConfigurationService } from "../configuration"; -import { createSocket } from "./socket"; - -export interface IHaConnection { - tryConnect(): Promise; - notifyConfigUpdate(conf: any); - getEntityCompletions(): Promise; - getServiceCompletions(): Promise; -} - -export class HaConnection implements IHaConnection { - - private connection: ha.Connection | undefined; - private hassEntities!: Promise; - private hassServices!: Promise; - - constructor(private configurationService: IConfigurationService) { } - - public tryConnect = async () => { - await this.createConnection(); - } - - private async createConnection(): Promise { - - if (!this.configurationService.isConfigured) { - return; - } - - if (this.connection !== undefined) { - return; - } - - let auth = new ha.Auth({ - access_token: `${this.configurationService.token}`, - expires: +new Date(new Date().getTime() + 1e11), - hassUrl: `${this.configurationService.url}`, - clientId: "", - expires_in: +new Date(new Date().getTime() + 1e11), - refresh_token: "" - }); - - try { - console.log("Connecting to Home Assistant..."); - this.connection = await ha.createConnection({ - auth: auth, - createSocket: async () => createSocket(auth, this.configurationService.ignoreCertificates) - }); - console.log("Connected to Home Assistant"); - } - catch (error) { - this.handleConnectionError(error); - throw error; - } - - this.connection.addEventListener("ready", () => { - console.log("(re-)connected to Home Assistant"); - }); - - this.connection.addEventListener("disconnected", () => { - console.warn("Lost connection with Home Assistant"); - }); - - this.connection.addEventListener("reconnect-error", (data) => { - console.error("Reconnect error with Home Assistant", data); - }); - } - - private handleConnectionError = (error: any) => { - this.connection = undefined; - var tokenIndication = `${this.configurationService.token}`.substring(0, 5); - var errorText = error; - switch (error) { - case 1: - errorText = "ERR_CANNOT_CONNECT"; - break; - case 2: - errorText = "ERR_INVALID_AUTH"; - break; - case 3: - errorText = "ERR_CONNECTION_LOST"; - break; - case 4: - errorText = "ERR_HASS_HOST_REQUIRED"; - break; - } - let message = `Error connecting to your Home Assistant Server at ${this.configurationService.url} and token '${tokenIndication}...', check your network or update your VS Code Settings, make sure to (also) check your workspace settings! Error: ${errorText}`; - console.error(message); - } - - public notifyConfigUpdate = async (): Promise => { - this.disconnect(); - try { - await this.tryConnect(); - } - catch (err) { - // so be it, error is now displayed in logs - } - } - - private getHassEntities = async (): Promise => { - await this.createConnection(); - - if (!this.hassEntities) { - this.hassEntities = new Promise(async (resolve, reject) => { - if (!this.connection) { - return reject(); - } - ha.subscribeEntities(this.connection, entities => { - console.log(`Got ${Object.keys(entities).length} entities from Home Assistant`); - return resolve(entities); - }); - }); - } - return await this.hassEntities; - } - - public async getEntityCompletions(): Promise { - - let entities = await this.getHassEntities(); - - if (!entities) { - return []; - } - - let completions: CompletionItem[] = []; - - for (const [, value] of Object.entries(entities)) { - let completionItem = CompletionItem.create(`${value.entity_id}`); - completionItem.kind = CompletionItemKind.EnumMember; - completionItem.filterText = `${value.entity_id}`; - completionItem.insertText = completionItem.filterText; - completionItem.data = {}; - completionItem.data.isEntity = true; - - completionItem.documentation = { - kind: "markdown", - value: `**${value.entity_id}** \r\n \r\n` - }; - - if (value.state) { - completionItem.documentation.value += `State: ${value.state} \r\n \r\n`; - } - completionItem.documentation.value += `| Attribute | Value | \r\n`; - completionItem.documentation.value += `| :---- | :---- | \r\n`; - - for (const [attrKey, attrValue] of Object.entries(value.attributes)) { - completionItem.documentation.value += `| ${attrKey} | ${attrValue} | \r\n`; - } - completions.push(completionItem); - } - return completions; - } - - private getHassServices = async (): Promise => { - await this.createConnection(); - - if (!this.hassServices) { - this.hassServices = new Promise(async (resolve, reject) => { - if (!this.connection) { - return reject(); - } - ha.subscribeServices(this.connection, services => { - console.log(`Got ${Object.keys(services).length} services from Home Assistant`); - return resolve(services); - }); - }); - } - return await this.hassServices; - } - - public async getServiceCompletions(): Promise { - - let services = await this.getHassServices(); - - if (!services) { - return []; - } - - let completions: CompletionItem[] = []; - - for (const [domainKey, domainValue] of Object.entries(services)) { - for (const [serviceKey, serviceValue] of Object.entries(domainValue)) { - let completionItem = CompletionItem.create(`${domainKey}.${serviceKey}`); - completionItem.kind = CompletionItemKind.EnumMember; - completionItem.filterText = `${domainKey}.${serviceKey}`; - completionItem.insertText = completionItem.filterText; - completionItem.data = {}; - completionItem.data.isService = true; - - var fields = Object.entries(serviceValue.fields); - - if (fields.length > 0) { - completionItem.documentation = { - kind: "markdown", - value: `**${domainKey}.${serviceKey}:** \r\n \r\n` - }; - - completionItem.documentation.value += `| Field | Description | Example | \r\n`; - completionItem.documentation.value += `| :---- | :---- | :---- | \r\n`; - - for (const [fieldKey, fieldValue] of fields) { - completionItem.documentation.value += `| ${fieldKey} | ${fieldValue.description} | ${fieldValue.example} | \r\n`; - } - } - completions.push(completionItem); - } - } - - return completions; - } - - public disconnect() { - if (!this.connection) { - return; - } - console.log(`Disconnecting from Home Assistant`); - this.connection.close(); - this.connection = undefined; - } -} \ No newline at end of file diff --git a/src/server/home-assistant/socket.ts b/src/server/home-assistant/socket.ts deleted file mode 100644 index 6bc2da2d02..0000000000 --- a/src/server/home-assistant/socket.ts +++ /dev/null @@ -1,143 +0,0 @@ -/* - -This is slightly modified version of -https://github.com/home-assistant/home-assistant-js-websocket/blob/master/lib/socket.ts - -*/ - -import * as ha from "home-assistant-js-websocket"; -import * as WebSocket from "ws"; - -const MSG_TYPE_AUTH_REQUIRED = "auth_required"; -const MSG_TYPE_AUTH_INVALID = "auth_invalid"; -const MSG_TYPE_AUTH_OK = "auth_ok"; -const ERR_INVALID_AUTH = 2; - -export function createSocket(auth: ha.Auth, ignoreCertificates: boolean): Promise { - - // Convert from http:// -> ws://, https:// -> wss:// - const url = auth.wsUrl; - - console.log("[Auth phase] Initializing WebSocket connection to Home Assistant", url); - - function connect( - triesLeft: number, - promResolve: (socket: any) => void, - promReject: (err: number) => void - ) { - console.log("[Auth Phase] Connecting to Home Assistant...", url); - - const socket = new WebSocket(url, { - rejectUnauthorized: !ignoreCertificates - }); - - // If invalid auth, we will not try to reconnect. - let invalidAuth = false; - - const closeMessage = (ev: { wasClean: boolean; code: number; reason: string; target: WebSocket }) => { - let errorMessage; - if (ev && ev.code && ev.code !== 1000) { - errorMessage = `WebSocket connection to Home Assistant closed with code ${ev.code} and reason ${ev.reason}`; - } - closeOrError(errorMessage); - }; - - const errorMessage = (ev: { error: any, message: any, type: string, target: WebSocket }) => { - // If we are in error handler make sure close handler doesn't also fire. - socket.removeEventListener("close", closeMessage); - let errorMessage = "Disconnected from Home Assistant with a WebSocket error"; - if (ev.message) { - errorMessage += ` with message: ${ev.message}`; - - } - closeOrError(errorMessage); - }; - - const closeOrError = (errorText?: string) => { - - if (errorText) { - console.log(`WebSocket Connection to Home Assistant closed with an error: ${errorText}`); - } - if (invalidAuth) { - promReject(ha.ERR_INVALID_AUTH); - return; - } - - // Reject if we no longer have to retry - if (triesLeft === 0) { - // We never were connected and will not retry - promReject(ha.ERR_CANNOT_CONNECT); - return; - } - - const newTries = triesLeft === -1 ? -1 : triesLeft - 1; - // Try again in a second - setTimeout( - () => - connect( - newTries, - promResolve, - promReject - ), - 1000 - ); - }; - - // Auth is mandatory, so we can send the auth message right away. - const handleOpen = async () => { - try { - if (auth.expired) { - await auth.refreshAccessToken(); - } - socket.send(JSON.stringify({ - type: "auth", - access_token: auth.accessToken - })); - } catch (err) { - // Refresh token failed - invalidAuth = err === ERR_INVALID_AUTH; - socket.close(); - } - }; - - const handleMessage = async (event: { data: any; type: string; target: WebSocket }) => { - const message = JSON.parse(event.data); - - console.log(`[Auth phase] Received a message of type ${message.type}`, message); - - switch (message.type) { - case MSG_TYPE_AUTH_INVALID: - invalidAuth = true; - socket.close(); - break; - - case MSG_TYPE_AUTH_OK: - socket.removeEventListener("open", handleOpen); - socket.removeEventListener("message", handleMessage); - socket.removeEventListener("close", closeMessage); - socket.removeEventListener("error", errorMessage); - promResolve(socket); - break; - - default: - // We already send this message when socket opens - if (message.type !== MSG_TYPE_AUTH_REQUIRED) { - console.log("[Auth phase] Unhandled message", message); - } - } - }; - - socket.addEventListener("open", handleOpen); - socket.addEventListener("message", handleMessage); - socket.addEventListener("close", closeMessage); - socket.addEventListener("error", errorMessage); - } - - return new Promise((resolve, reject) => - connect( - 3, - resolve, - reject - ) - ); -} diff --git a/src/server/jsonLanguageService.ts b/src/server/jsonLanguageService.ts deleted file mode 100644 index 5586e47319..0000000000 --- a/src/server/jsonLanguageService.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { JSONSchemaService } from "yaml-language-server/out/server/src/languageservice/services/jsonSchemaService"; -import { TextDocument, TextEdit, Diagnostic, ColorInformation, ColorPresentation, DocumentSymbol } from "vscode-languageserver-types"; -import { JSONValidation } from "vscode-json-languageservice/lib/umd/services/jsonValidation"; -import { JSONHover } from "vscode-json-languageservice/lib/umd/services/jsonHover"; -import { JSONDocumentSymbols } from "vscode-json-languageservice/lib/umd/services/jsonDocumentSymbols"; -import { JSONWorkerContribution, SymbolInformation, Hover, CompletionItem, CompletionList, LanguageService, JSONDocument, Color, Position, Range, FormattingOptions, FoldingRange, SelectionRange, ASTNode, DocumentLanguageSettings, JSONSchema } from "vscode-json-languageservice"; -import { LanguageSettings } from "yaml-language-server/out/server/src/languageservice/yamlLanguageService"; - -export class JsonLanguageService implements LanguageService { - - jsonValidation: JSONValidation; - jsonHover: JSONHover; - jsonDocumentSymbols: JSONDocumentSymbols; - - constructor(jsonSchemaService: JSONSchemaService, jsonWorkerContributions: JSONWorkerContribution[]) { - this.jsonValidation = new JSONValidation(jsonSchemaService, Promise); - this.jsonHover = new JSONHover(jsonSchemaService, jsonWorkerContributions, Promise); - this.jsonDocumentSymbols = new JSONDocumentSymbols(jsonSchemaService); - } - - public async doValidation(document: TextDocument, jsonDocument: JSONDocument, documentSettings?: DocumentLanguageSettings, schema?: JSONSchema): Promise { - return await this.jsonValidation.doValidation(document, jsonDocument, documentSettings, schema); - } - - public findDocumentSymbols(document: TextDocument, doc: JSONDocument): SymbolInformation[] { - return this.jsonDocumentSymbols.findDocumentSymbols(document, doc); - } - - public findDocumentSymbols2(document: TextDocument, doc: JSONDocument): DocumentSymbol[] { - return this.jsonDocumentSymbols.findDocumentSymbols2(document, doc); - } - - public async findColorSymbols(document: TextDocument, doc: JSONDocument): Promise { - return await this.jsonDocumentSymbols.findColorSymbols(document, doc); - } - - public async findDocumentColors(document: TextDocument, doc: JSONDocument): Promise { - return await this.jsonDocumentSymbols.findDocumentColors(document, doc); - } - - public getColorPresentations(document: TextDocument, doc: JSONDocument, color: Color, range: Range): ColorPresentation[] { - return this.jsonDocumentSymbols.getColorPresentations(document, doc, color, range); - } - - public async doHover(document: TextDocument, position: Position, doc: JSONDocument): Promise { - return await this.jsonHover.doHover(document, position, doc); - } - - // Methods below are not implemented since the YAML Language Service does not use them - - configure(settings: LanguageSettings): void { - throw new Error("Method not implemented."); - } - parseJSONDocument(document: TextDocument): JSONDocument { - throw new Error("Method not implemented."); - } - newJSONDocument(rootNode: ASTNode, syntaxDiagnostics?: Diagnostic[]): JSONDocument { - throw new Error("Method not implemented."); - } - resetSchema(uri: string): boolean { - throw new Error("Method not implemented."); - } - doResolve(item: CompletionItem): Thenable { - throw new Error("Method not implemented."); - } - doComplete(document: TextDocument, position: Position, doc: JSONDocument): Thenable { - throw new Error("Method not implemented."); - } - format(document: TextDocument, range: Range, options: FormattingOptions): TextEdit[] { - throw new Error("Method not implemented."); - } - getFoldingRanges(document: TextDocument, context?: { rangeLimit?: number; }): FoldingRange[] { - throw new Error("Method not implemented."); - } - getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[] { - throw new Error("Method not implemented."); - } -} diff --git a/src/server/schemas/automation.ts b/src/server/schemas/automation.ts deleted file mode 100644 index 2c104e76bb..0000000000 --- a/src/server/schemas/automation.ts +++ /dev/null @@ -1,209 +0,0 @@ -export type Automations = Array; -export type AutomationsFile = Automation | Array; - -export interface Automation { - id?: string; - alias?: string; - initial_state?: string | boolean; - hide_entity?: boolean; - trigger: Triggers | Array; - condition?: null | ConditionsConfig; - action: Actions | Array; -} -export type Actions = EventActionSchema | ServiceActionSchema | DelayActionSchema | ServiceActionTemplateSchema | WaitTemplateSchema; - -export interface HaTrigger { - platform: "homeassistant"; - event: "start" | "shutdown"; -} -export interface SunTrigger { - platform: "sun"; - event: "sunset" | "sunrise"; - offset?: string; -} -export interface TimeTrigger { - platform: "time"; - at: string; -} -export interface TemplateTrigger { - platform: "template"; - value_template: string; - for?: string | TimePeriod; -} -export interface WebhookTrigger { - platform: "webhook"; - webhook_id: string; -} -export interface EventTrigger { - platform: "event"; - event_type: string; - event_data?: any; -} -export interface TimePatternTrigger { - platform: "time_pattern"; - hours?: string; - minutes?: string | number; - seconds?: string | number; -} -export interface MqttTrigger { - platform: "mqtt"; - topic: string; - payload?: string; - encoding?: string; -} -export interface GeoLocationTrigger { - platform: "geo_location"; - source: string; - zone: string; - event: "enter" | "leave"; -} -export interface StateTrigger { - platform: "state"; - entity_id: string | string[]; - from?: string | boolean; - to?: string | boolean; - for?: string | TimePeriod; -} -export interface TimePeriod { - days?: string | number; - hours?: string | number; - minutes?: string | number; - seconds?: string | number; - milliseconds?: string | number; -} -export interface ZoneTrigger { - platform: "zone"; - entity_id: string | string[]; - zone: string; - event: "enter" | "leave"; -} - -export interface NumericStateTrigger { - platform: "numeric_state"; - entity_id: string | string[]; - below?: string | number; - above?: string | number; - value_template?: string; - for?: string | TimePeriod; -} - -export type Triggers = - HaTrigger - | SunTrigger - | TimeTrigger - | TemplateTrigger - | WebhookTrigger - | EventTrigger - | TimePatternTrigger - | MqttTrigger - | GeoLocationTrigger - | StateTrigger - | ZoneTrigger - | NumericStateTrigger; - -export interface Action { -} - -export interface EventActionSchema extends Action { - alias?: string; - event: string; - event_data?: any; - event_data_template?: any; -} -export interface DelayActionSchema extends Action { - delay: number | string | TimePeriod; -} - -export interface ServiceActionSchema extends Action { - service: string; - service_template?: string; - entity_id?: string | string[]; - data?: any; - data_template?: any; -} - -export interface ServiceActionTemplateSchema extends Action { - service_template: string; - entity_id?: string | string[]; - data?: any; - data_template?: any; -} - -export interface WaitTemplateSchema extends Action{ - wait_template: string; - timeout?: string | TimePeriod; - continue_on_timeout?: boolean | string; -} - -export interface NumericStateConditionSchema { - condition: "numeric_state"; - entity_id: string | string[]; - below?: string | number; - above?: string | number; - value_template?: string; -} - -export interface StateConditionSchema { - condition: "state"; - entity_id: string | string[]; - state: string | boolean; - for?: string | TimePeriod; - from?: string; -} - -export interface SunConditionSchema { - condition: "sun"; - before?: string; - before_offset?: string; - after?: string; - after_offset?: string; -} - -export interface TemplateConditionSchema { - condition: "template"; - value_template?: string; -} - -export interface TimeConditionSchema { - condition: "time"; - before?: string; - after?: string; - weekday?: Weekday | Array; -} - -export type Weekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun'; - -export interface ZoneConditionSchema { - condition: "zone"; - entity_id: string | string[]; - zone?: string; -} -export interface AndConditionSchema { - condition: "and"; - conditions: ConditionsConfig; -} - -export interface OrConditionSchema { - condition: "or"; - conditions: ConditionsConfig; -} - -export type ConditionsConfig = - NumericStateConditionSchema - | StateConditionSchema - | SunConditionSchema - | TemplateConditionSchema - | TimeConditionSchema - | ZoneConditionSchema - | AndConditionSchema - | OrConditionSchema - | Array< - NumericStateConditionSchema - | StateConditionSchema - | SunConditionSchema - | TemplateConditionSchema - | TimeConditionSchema - | ZoneConditionSchema - | AndConditionSchema - | OrConditionSchema - >; \ No newline at end of file diff --git a/src/server/schemas/generateSchemas.ts b/src/server/schemas/generateSchemas.ts deleted file mode 100644 index 60484846ce..0000000000 --- a/src/server/schemas/generateSchemas.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { resolve } from "path"; -import * as TJS from "typescript-json-schema"; -import * as fs from "fs"; -import { PathToSchemaMapping } from "./schemaService"; -import * as path from "path"; - -const settings: TJS.PartialArgs = { - required: true, - noExtraProps: true -}; - -const compilerOptions: TJS.CompilerOptions = { - strictNullChecks: true -} - -var jsonPath = path.join(__dirname, "mappings.json"); -var filecontents = fs.readFileSync(jsonPath, "utf-8"); - -var pathToSchemaMappings: PathToSchemaMapping[] = JSON.parse(filecontents); -pathToSchemaMappings.forEach(mapping => { - let program = TJS.getProgramFromFiles([resolve(path.join("src/server/schemas/", mapping.tsFile))], compilerOptions); - let schema = TJS.generateSchema(program, mapping.fromType, settings); - fs.writeFileSync(path.join("src/server/schemas/json/", mapping.file), JSON.stringify(schema)); -}); \ No newline at end of file diff --git a/src/server/schemas/homeassistant.ts b/src/server/schemas/homeassistant.ts deleted file mode 100644 index b620967ad0..0000000000 --- a/src/server/schemas/homeassistant.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { Automations, ConditionsConfig, TimePeriod } from "./automation"; -import { Sensors } from "./sensors"; - -/** - * @TJS-additionalProperties true - */ -export interface HomeAssistantRoot { - homeassistant?: HomeAssistantComponent | IncludeTags; - automation?: Automations | IncludeTags; - group?: GroupComponent | IncludeTags; - panel_iframe?: PanelIframeComponent | IncludeTags; - sensor?: null | Array | IncludeTags; - scene?: SceneComponentEntry[] | IncludeTags; - input_boolean?: InputBooleanEntry | IncludeTags; - script?: Script | IncludeTags; - http?: any; - default_config?: any; - person?: any; - system_health?: any; - panel_custom?: any; - updater?: any; - discovery?: any; - conversation?: any; - history?: any; - config?: any; - logbook?: any; - sun?: any; - tts?: any; - recorder?: any; - ifttt?: any; - ios?: any; - mqtt?: any; - remote?: any; -} - -export interface HomeAssistantComponent { - name?: string; - latitude?: string | number; - longitude?: string | number; - elevation?: string | number; - unit_system?: "metric" | "imperial"; - time_zone?: string; - whitelist_external_dirs?: string[]; - customize?: CustomizeComponent | IncludeTags; - customize_domain?: any; - customize_glob?: any; - packages?: Array | IncludeTags; - auth_providers?: AuthProviders[]; - auth_mfa_modules?: Array | IncludeTags; -} - - -/** - * @TJS-type string - * @TJS-pattern [.]yaml|[.]yml$ - */ -export interface IncludeTag { } - -/** - * @TJS-type string - */ -export interface IncludeFolderTag { } - -export type IncludeTags = IncludeTag | IncludeFolderTag; - -/** - * @TJS-type string - * @TJS-pattern [.]yaml|[.]yml$ - */ -export interface SecretTag { } - - -export interface PanelIframeComponent { - [key: string]: PanelIframeComponentEntry; -} -export interface PanelIframeComponentEntry { - title: string; - url: string; - icon?: string; - require_admin?: boolean; -} - -export type CustomizeFile = CustomizeComponent | CustomizeComponent[]; - -export interface CustomizeComponent { - [key: string]: CustomizeComponentEntry; -} -/** - * @TJS-additionalProperties true - */ -export interface CustomizeComponentEntry { - friendly_name?: string; - homebridge_name?: string; - hidden?: boolean; - homebridge_hidden?: boolean; - emulated_hue_hidden?: boolean; - entity_picture?: string; - icon?: string; - assumed_state?: boolean; - device_class?: string; - unit_of_measurement?: string; - initial_state?: boolean; -} -export interface GroupComponent { - [key: string]: GroupComponentEntry | string[]; -} -export interface GroupComponentEntry { - name?: string; - view?: boolean; - icon?: string; - control?: string; - entities: string | string[]; - all?: boolean; -} - -export type AuthProviders = - HomeAssistantAuthProvider | - TrustedNetworksAuthProvider | - CommandLineAuthProvider | - LegacyApiPasswordAuthProvider; - -export interface HomeAssistantAuthProvider { - type: "homeassistant"; -} -export interface TrustedNetworksAuthProvider { - type: "trusted_networks"; - trusted_networks: string | string[] | any[]; - trusted_users?: { - [key: string]: string | Array - }; - allow_bypass_login?: boolean; -} -export interface CommandLineAuthProvider { - type: "command_line"; - command: string; - args?: any; - meta?: boolean; -} -export interface LegacyApiPasswordAuthProvider { - type: "legacy_api_password"; - api_password: string | SecretTag; -} - -export type SceneComponentEntries = SceneComponentEntry | Array; - -export interface SceneComponentEntry { - name: string; - entities: { [name: string]: string | boolean | EntitySceneConfig }; -} - -/** - * @TJS-additionalProperties true - */ -export interface EntitySceneConfig { - state?: boolean; - brightness?: number | string; - source?: string; - color_temp?: number | string; - xy_color?: any; -} - -export interface InputBooleanEntry { - [name: string]: { - name?: string; - initial?: boolean; - icon?: string - } | null; -} - -export type ScriptFile = SequencedAction | ScriptAction | Script | Script[]; - -export interface Script { - [name: string]: SequencedAction | ScriptAction; -} - -export interface SequencedAction { - alias?: string; - sequence: ScriptAction | Array; -} - -export type ScriptAction = ServiceAction | DelayAction | WaitAction | EventAction; - -export interface ServiceAction { - service?: string; - service_template?: string; - data?: any; - data_template?: any; - entity_id?: string | string[]; -} -export interface DelayAction { - delay: string | number | TimePeriod; -} -export interface WaitAction { - wait_template: string; - timeout?: string; - continue_on_timeout?: boolean | string; -} -export interface EventAction { - event: string; - event_data: EventActionData; - event_data_template?: any; -} - -/** - * @TJS-additionalProperties true - */ -export interface EventActionData { - name?: string; - message?: string; - entity_id?: string; - domain?: string; -} \ No newline at end of file diff --git a/src/server/schemas/json/automations.json b/src/server/schemas/json/automations.json deleted file mode 100644 index 5fb8532c56..0000000000 --- a/src/server/schemas/json/automations.json +++ /dev/null @@ -1 +0,0 @@ -{"anyOf":[{"$ref":"#/definitions/Automation"},{"type":"array","items":{"$ref":"#/definitions/Automation"}}],"definitions":{"Automation":{"type":"object","properties":{"id":{"type":"string"},"alias":{"type":"string"},"initial_state":{"type":["string","boolean"]},"hide_entity":{"type":"boolean"},"trigger":{"anyOf":[{"$ref":"#/definitions/HaTrigger"},{"$ref":"#/definitions/SunTrigger"},{"$ref":"#/definitions/TimeTrigger"},{"$ref":"#/definitions/TemplateTrigger"},{"$ref":"#/definitions/WebhookTrigger"},{"$ref":"#/definitions/EventTrigger"},{"$ref":"#/definitions/TimePatternTrigger"},{"$ref":"#/definitions/MqttTrigger"},{"$ref":"#/definitions/GeoLocationTrigger"},{"$ref":"#/definitions/StateTrigger"},{"$ref":"#/definitions/ZoneTrigger"},{"$ref":"#/definitions/NumericStateTrigger"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/HaTrigger"},{"$ref":"#/definitions/SunTrigger"},{"$ref":"#/definitions/TimeTrigger"},{"$ref":"#/definitions/TemplateTrigger"},{"$ref":"#/definitions/WebhookTrigger"},{"$ref":"#/definitions/EventTrigger"},{"$ref":"#/definitions/TimePatternTrigger"},{"$ref":"#/definitions/MqttTrigger"},{"$ref":"#/definitions/GeoLocationTrigger"},{"$ref":"#/definitions/StateTrigger"},{"$ref":"#/definitions/ZoneTrigger"},{"$ref":"#/definitions/NumericStateTrigger"}]}}]},"condition":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}},{"type":"null"}]},"action":{"anyOf":[{"$ref":"#/definitions/EventActionSchema"},{"$ref":"#/definitions/ServiceActionSchema"},{"$ref":"#/definitions/DelayActionSchema"},{"$ref":"#/definitions/ServiceActionTemplateSchema"},{"$ref":"#/definitions/WaitTemplateSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EventActionSchema"},{"$ref":"#/definitions/ServiceActionSchema"},{"$ref":"#/definitions/DelayActionSchema"},{"$ref":"#/definitions/ServiceActionTemplateSchema"},{"$ref":"#/definitions/WaitTemplateSchema"},{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}}]}},"additionalProperties":false,"required":["action","trigger"]},"HaTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["homeassistant"]},"event":{"enum":["shutdown","start"],"type":"string"}},"additionalProperties":false,"required":["event","platform"]},"SunTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["sun"]},"event":{"enum":["sunrise","sunset"],"type":"string"},"offset":{"type":"string"}},"additionalProperties":false,"required":["event","platform"]},"TimeTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["time"]},"at":{"type":"string"}},"additionalProperties":false,"required":["at","platform"]},"TemplateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["template"]},"value_template":{"type":"string"},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["platform","value_template"]},"TimePeriod":{"type":"object","properties":{"days":{"type":["string","number"]},"hours":{"type":["string","number"]},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]},"milliseconds":{"type":["string","number"]}},"additionalProperties":false},"WebhookTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["webhook"]},"webhook_id":{"type":"string"}},"additionalProperties":false,"required":["platform","webhook_id"]},"EventTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["event"]},"event_type":{"type":"string"},"event_data":{}},"additionalProperties":false,"required":["event_type","platform"]},"TimePatternTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["time_pattern"]},"hours":{"type":"string"},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]}},"additionalProperties":false,"required":["platform"]},"MqttTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["mqtt"]},"topic":{"type":"string"},"payload":{"type":"string"},"encoding":{"type":"string"}},"additionalProperties":false,"required":["platform","topic"]},"GeoLocationTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["geo_location"]},"source":{"type":"string"},"zone":{"type":"string"},"event":{"enum":["enter","leave"],"type":"string"}},"additionalProperties":false,"required":["event","platform","source","zone"]},"StateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"from":{"type":["string","boolean"]},"to":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["entity_id","platform"]},"ZoneTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"},"event":{"enum":["enter","leave"],"type":"string"}},"additionalProperties":false,"required":["entity_id","event","platform","zone"]},"NumericStateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["entity_id","platform"]},"NumericStateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"StateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"state":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"from":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id","state"]},"SunConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["sun"]},"before":{"type":"string"},"before_offset":{"type":"string"},"after":{"type":"string"},"after_offset":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TemplateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["template"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TimeConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["time"]},"before":{"type":"string"},"after":{"type":"string"},"weekday":{"anyOf":[{"type":"array","items":{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}},{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}]}},"additionalProperties":false,"required":["condition"]},"ZoneConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"AndConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["and"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"OrConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["or"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"EventActionSchema":{"type":"object","properties":{"alias":{"type":"string"},"event":{"type":"string"},"event_data":{},"event_data_template":{}},"additionalProperties":false,"required":["event"]},"ServiceActionSchema":{"type":"object","properties":{"service":{"type":"string"},"service_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"data":{},"data_template":{}},"additionalProperties":false,"required":["service"]},"DelayActionSchema":{"type":"object","properties":{"delay":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":["string","number"]}]}},"additionalProperties":false,"required":["delay"]},"ServiceActionTemplateSchema":{"type":"object","properties":{"service_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"data":{},"data_template":{}},"additionalProperties":false,"required":["service_template"]},"WaitTemplateSchema":{"type":"object","properties":{"wait_template":{"type":"string"},"timeout":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"continue_on_timeout":{"type":["string","boolean"]}},"additionalProperties":false,"required":["wait_template"]}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/homeassistant-customize.json b/src/server/schemas/json/homeassistant-customize.json deleted file mode 100644 index 90b80e8c70..0000000000 --- a/src/server/schemas/json/homeassistant-customize.json +++ /dev/null @@ -1 +0,0 @@ -{"anyOf":[{"$ref":"#/definitions/CustomizeComponent"},{"type":"array","items":{"$ref":"#/definitions/CustomizeComponent"}}],"definitions":{"CustomizeComponent":{"type":"object","additionalProperties":{"$ref":"#/definitions/CustomizeComponentEntry"}},"CustomizeComponentEntry":{"additionalProperties":true,"type":"object","properties":{"friendly_name":{"type":"string"},"homebridge_name":{"type":"string"},"hidden":{"type":"boolean"},"homebridge_hidden":{"type":"boolean"},"emulated_hue_hidden":{"type":"boolean"},"entity_picture":{"type":"string"},"icon":{"type":"string"},"assumed_state":{"type":"boolean"},"device_class":{"type":"string"},"unit_of_measurement":{"type":"string"},"initial_state":{"type":"boolean"}}}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/homeassistant-input-boolean.json b/src/server/schemas/json/homeassistant-input-boolean.json deleted file mode 100644 index 9f33dc11b4..0000000000 --- a/src/server/schemas/json/homeassistant-input-boolean.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"object","additionalProperties":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"initial":{"type":"boolean"},"icon":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/homeassistant-packages.json b/src/server/schemas/json/homeassistant-packages.json deleted file mode 100644 index fc5f282162..0000000000 --- a/src/server/schemas/json/homeassistant-packages.json +++ /dev/null @@ -1 +0,0 @@ -{"additionalProperties":true,"type":"object","properties":{"homeassistant":{"anyOf":[{"$ref":"#/definitions/HomeAssistantComponent"},{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"}]},"automation":{"anyOf":[{"type":"array","items":{"$ref":"#/definitions/Automation"}},{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"}]},"group":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/GroupComponent"}]},"panel_iframe":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/PanelIframeComponent"}]},"sensor":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/MqttSensor"},{"$ref":"#/definitions/TemplateSensor"},{"$ref":"#/definitions/OtherSensor"}]}},{"type":"null"}]},"scene":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"$ref":"#/definitions/SceneComponentEntry"}}]},"input_boolean":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/InputBooleanEntry"}]},"script":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/Script"}]},"http":{},"default_config":{},"person":{},"system_health":{},"panel_custom":{},"updater":{},"discovery":{},"conversation":{},"history":{},"config":{},"logbook":{},"sun":{},"tts":{},"recorder":{},"ifttt":{},"ios":{},"mqtt":{},"remote":{}},"definitions":{"HomeAssistantComponent":{"type":"object","properties":{"name":{"type":"string"},"latitude":{"type":["string","number"]},"longitude":{"type":["string","number"]},"elevation":{"type":["string","number"]},"unit_system":{"enum":["imperial","metric"],"type":"string"},"time_zone":{"type":"string"},"whitelist_external_dirs":{"type":"array","items":{"type":"string"}},"customize":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/CustomizeComponent"}]},"customize_domain":{},"customize_glob":{},"packages":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"$ref":"#/definitions/HomeAssistantComponent"}}]},"auth_providers":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/HomeAssistantAuthProvider"},{"$ref":"#/definitions/TrustedNetworksAuthProvider"},{"$ref":"#/definitions/CommandLineAuthProvider"},{"$ref":"#/definitions/LegacyApiPasswordAuthProvider"}]}},"auth_mfa_modules":{"anyOf":[{"type":"array","items":{}},{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"}]}},"additionalProperties":false},"IncludeTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"IncludeFolderTag":{"type":"string"},"CustomizeComponent":{"type":"object","additionalProperties":{"$ref":"#/definitions/CustomizeComponentEntry"}},"CustomizeComponentEntry":{"additionalProperties":true,"type":"object","properties":{"friendly_name":{"type":"string"},"homebridge_name":{"type":"string"},"hidden":{"type":"boolean"},"homebridge_hidden":{"type":"boolean"},"emulated_hue_hidden":{"type":"boolean"},"entity_picture":{"type":"string"},"icon":{"type":"string"},"assumed_state":{"type":"boolean"},"device_class":{"type":"string"},"unit_of_measurement":{"type":"string"},"initial_state":{"type":"boolean"}}},"HomeAssistantAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["homeassistant"]}},"additionalProperties":false,"required":["type"]},"TrustedNetworksAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["trusted_networks"]},"trusted_networks":{"anyOf":[{"type":"array","items":{}},{"type":"array","items":{"type":"string"}},{"type":"string"}]},"trusted_users":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]}},{"type":"string"}]}},"allow_bypass_login":{"type":"boolean"}},"additionalProperties":false,"required":["trusted_networks","type"]},"CommandLineAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["command_line"]},"command":{"type":"string"},"args":{},"meta":{"type":"boolean"}},"additionalProperties":false,"required":["command","type"]},"LegacyApiPasswordAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["legacy_api_password"]},"api_password":{"anyOf":[{"$ref":"#/definitions/SecretTag"},{"type":"string"}]}},"additionalProperties":false,"required":["api_password","type"]},"SecretTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"Automation":{"type":"object","properties":{"id":{"type":"string"},"alias":{"type":"string"},"initial_state":{"type":["string","boolean"]},"hide_entity":{"type":"boolean"},"trigger":{"anyOf":[{"$ref":"#/definitions/HaTrigger"},{"$ref":"#/definitions/SunTrigger"},{"$ref":"#/definitions/TimeTrigger"},{"$ref":"#/definitions/TemplateTrigger"},{"$ref":"#/definitions/WebhookTrigger"},{"$ref":"#/definitions/EventTrigger"},{"$ref":"#/definitions/TimePatternTrigger"},{"$ref":"#/definitions/MqttTrigger"},{"$ref":"#/definitions/GeoLocationTrigger"},{"$ref":"#/definitions/StateTrigger"},{"$ref":"#/definitions/ZoneTrigger"},{"$ref":"#/definitions/NumericStateTrigger"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/HaTrigger"},{"$ref":"#/definitions/SunTrigger"},{"$ref":"#/definitions/TimeTrigger"},{"$ref":"#/definitions/TemplateTrigger"},{"$ref":"#/definitions/WebhookTrigger"},{"$ref":"#/definitions/EventTrigger"},{"$ref":"#/definitions/TimePatternTrigger"},{"$ref":"#/definitions/MqttTrigger"},{"$ref":"#/definitions/GeoLocationTrigger"},{"$ref":"#/definitions/StateTrigger"},{"$ref":"#/definitions/ZoneTrigger"},{"$ref":"#/definitions/NumericStateTrigger"}]}}]},"condition":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}},{"type":"null"}]},"action":{"anyOf":[{"$ref":"#/definitions/EventActionSchema"},{"$ref":"#/definitions/ServiceActionSchema"},{"$ref":"#/definitions/DelayActionSchema"},{"$ref":"#/definitions/ServiceActionTemplateSchema"},{"$ref":"#/definitions/WaitTemplateSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EventActionSchema"},{"$ref":"#/definitions/ServiceActionSchema"},{"$ref":"#/definitions/DelayActionSchema"},{"$ref":"#/definitions/ServiceActionTemplateSchema"},{"$ref":"#/definitions/WaitTemplateSchema"},{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}}]}},"additionalProperties":false,"required":["action","trigger"]},"HaTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["homeassistant"]},"event":{"enum":["shutdown","start"],"type":"string"}},"additionalProperties":false,"required":["event","platform"]},"SunTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["sun"]},"event":{"enum":["sunrise","sunset"],"type":"string"},"offset":{"type":"string"}},"additionalProperties":false,"required":["event","platform"]},"TimeTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["time"]},"at":{"type":"string"}},"additionalProperties":false,"required":["at","platform"]},"TemplateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["template"]},"value_template":{"type":"string"},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["platform","value_template"]},"TimePeriod":{"type":"object","properties":{"days":{"type":["string","number"]},"hours":{"type":["string","number"]},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]},"milliseconds":{"type":["string","number"]}},"additionalProperties":false},"WebhookTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["webhook"]},"webhook_id":{"type":"string"}},"additionalProperties":false,"required":["platform","webhook_id"]},"EventTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["event"]},"event_type":{"type":"string"},"event_data":{}},"additionalProperties":false,"required":["event_type","platform"]},"TimePatternTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["time_pattern"]},"hours":{"type":"string"},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]}},"additionalProperties":false,"required":["platform"]},"MqttTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["mqtt"]},"topic":{"type":"string"},"payload":{"type":"string"},"encoding":{"type":"string"}},"additionalProperties":false,"required":["platform","topic"]},"GeoLocationTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["geo_location"]},"source":{"type":"string"},"zone":{"type":"string"},"event":{"enum":["enter","leave"],"type":"string"}},"additionalProperties":false,"required":["event","platform","source","zone"]},"StateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"from":{"type":["string","boolean"]},"to":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["entity_id","platform"]},"ZoneTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"},"event":{"enum":["enter","leave"],"type":"string"}},"additionalProperties":false,"required":["entity_id","event","platform","zone"]},"NumericStateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["entity_id","platform"]},"NumericStateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"StateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"state":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"from":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id","state"]},"SunConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["sun"]},"before":{"type":"string"},"before_offset":{"type":"string"},"after":{"type":"string"},"after_offset":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TemplateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["template"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TimeConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["time"]},"before":{"type":"string"},"after":{"type":"string"},"weekday":{"anyOf":[{"type":"array","items":{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}},{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}]}},"additionalProperties":false,"required":["condition"]},"ZoneConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"AndConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["and"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"OrConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["or"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"EventActionSchema":{"type":"object","properties":{"alias":{"type":"string"},"event":{"type":"string"},"event_data":{},"event_data_template":{}},"additionalProperties":false,"required":["event"]},"ServiceActionSchema":{"type":"object","properties":{"service":{"type":"string"},"service_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"data":{},"data_template":{}},"additionalProperties":false,"required":["service"]},"DelayActionSchema":{"type":"object","properties":{"delay":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":["string","number"]}]}},"additionalProperties":false,"required":["delay"]},"ServiceActionTemplateSchema":{"type":"object","properties":{"service_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"data":{},"data_template":{}},"additionalProperties":false,"required":["service_template"]},"WaitTemplateSchema":{"type":"object","properties":{"wait_template":{"type":"string"},"timeout":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"continue_on_timeout":{"type":["string","boolean"]}},"additionalProperties":false,"required":["wait_template"]},"GroupComponent":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"type":"string"}},{"$ref":"#/definitions/GroupComponentEntry"}]}},"GroupComponentEntry":{"type":"object","properties":{"name":{"type":"string"},"view":{"type":"boolean"},"icon":{"type":"string"},"control":{"type":"string"},"entities":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"all":{"type":"boolean"}},"additionalProperties":false,"required":["entities"]},"PanelIframeComponent":{"type":"object","additionalProperties":{"$ref":"#/definitions/PanelIframeComponentEntry"}},"PanelIframeComponentEntry":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"},"icon":{"type":"string"},"require_admin":{"type":"boolean"}},"additionalProperties":false,"required":["title","url"]},"MqttSensor":{"type":"object","properties":{"platform":{"type":"string","enum":["mqtt"]},"state_topic":{"type":"string"},"name":{"type":"string"},"qos":{"type":"number"},"unit_of_measurement":{"type":"string"},"icon":{"type":"string"},"expire_after":{"type":"number"},"value_template":{"type":"string"},"force_update":{"type":"boolean"},"availability_topic":{"type":"string"},"payload_available":{"type":"string"},"payload_not_available":{"type":"string"},"json_attributes_topic":{"type":"string"},"json_attributes":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"unique_id":{"type":"string"},"device_class":{"type":"string"},"device":{}},"additionalProperties":false,"required":["platform","state_topic"]},"TemplateSensor":{"type":"object","properties":{"platform":{"type":"string","enum":["template"]},"sensors":{"type":"object","additionalProperties":{"$ref":"#/definitions/TemplateSensorEntry"}}},"additionalProperties":false,"required":["platform","sensors"]},"TemplateSensorEntry":{"type":"object","properties":{"friendly_name":{"type":"string"},"friendly_name_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"unit_of_measurement":{"type":"string"},"value_template":{"type":"string"},"icon_template":{"type":"string"},"entity_picture_template":{"type":"string"},"device_class":{"type":"string"}},"additionalProperties":false},"OtherSensor":{"additionalProperties":true,"type":"object","properties":{"platform":{"pattern":"(^(?!.*(mqtt|template)).*)$","type":"string"}},"required":["platform"]},"SceneComponentEntry":{"type":"object","properties":{"name":{"type":"string"},"entities":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#/definitions/EntitySceneConfig"},{"type":["string","boolean"]}]}}},"additionalProperties":false,"required":["entities","name"]},"EntitySceneConfig":{"additionalProperties":true,"type":"object","properties":{"state":{"type":"boolean"},"brightness":{"type":["string","number"]},"source":{"type":"string"},"color_temp":{"type":["string","number"]},"xy_color":{}}},"InputBooleanEntry":{"type":"object","additionalProperties":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"initial":{"type":"boolean"},"icon":{"type":"string"}},"additionalProperties":false},{"type":"null"}]}},"Script":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#/definitions/SequencedAction"},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"}]}},"SequencedAction":{"type":"object","properties":{"alias":{"type":"string"},"sequence":{"anyOf":[{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"}]}}]}},"additionalProperties":false,"required":["sequence"]},"ServiceAction":{"type":"object","properties":{"service":{"type":"string"},"service_template":{"type":"string"},"data":{},"data_template":{},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]}},"additionalProperties":false},"DelayAction":{"type":"object","properties":{"delay":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":["string","number"]}]}},"additionalProperties":false,"required":["delay"]},"WaitAction":{"type":"object","properties":{"wait_template":{"type":"string"},"timeout":{"type":"string"},"continue_on_timeout":{"type":["string","boolean"]}},"additionalProperties":false,"required":["wait_template"]},"EventAction":{"type":"object","properties":{"event":{"type":"string"},"event_data":{"$ref":"#/definitions/EventActionData"},"event_data_template":{}},"additionalProperties":false,"required":["event","event_data"]},"EventActionData":{"additionalProperties":true,"type":"object","properties":{"name":{"type":"string"},"message":{"type":"string"},"entity_id":{"type":"string"},"domain":{"type":"string"}}}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/homeassistant-scene.json b/src/server/schemas/json/homeassistant-scene.json deleted file mode 100644 index 69d294453e..0000000000 --- a/src/server/schemas/json/homeassistant-scene.json +++ /dev/null @@ -1 +0,0 @@ -{"anyOf":[{"$ref":"#/definitions/SceneComponentEntry"},{"type":"array","items":{"$ref":"#/definitions/SceneComponentEntry"}}],"definitions":{"SceneComponentEntry":{"type":"object","properties":{"name":{"type":"string"},"entities":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#/definitions/EntitySceneConfig"},{"type":["string","boolean"]}]}}},"additionalProperties":false,"required":["entities","name"]},"EntitySceneConfig":{"additionalProperties":true,"type":"object","properties":{"state":{"type":"boolean"},"brightness":{"type":["string","number"]},"source":{"type":"string"},"color_temp":{"type":["string","number"]},"xy_color":{}}}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/homeassistant-script.json b/src/server/schemas/json/homeassistant-script.json deleted file mode 100644 index 9211358bf6..0000000000 --- a/src/server/schemas/json/homeassistant-script.json +++ /dev/null @@ -1 +0,0 @@ -{"anyOf":[{"$ref":"#/definitions/SequencedAction"},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"},{"$ref":"#/definitions/Script"},{"type":"array","items":{"$ref":"#/definitions/Script"}}],"definitions":{"SequencedAction":{"type":"object","properties":{"alias":{"type":"string"},"sequence":{"anyOf":[{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"}]}}]}},"additionalProperties":false,"required":["sequence"]},"ServiceAction":{"type":"object","properties":{"service":{"type":"string"},"service_template":{"type":"string"},"data":{},"data_template":{},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]}},"additionalProperties":false},"DelayAction":{"type":"object","properties":{"delay":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":["string","number"]}]}},"additionalProperties":false,"required":["delay"]},"TimePeriod":{"type":"object","properties":{"days":{"type":["string","number"]},"hours":{"type":["string","number"]},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]},"milliseconds":{"type":["string","number"]}},"additionalProperties":false},"WaitAction":{"type":"object","properties":{"wait_template":{"type":"string"},"timeout":{"type":"string"},"continue_on_timeout":{"type":["string","boolean"]}},"additionalProperties":false,"required":["wait_template"]},"EventAction":{"type":"object","properties":{"event":{"type":"string"},"event_data":{"$ref":"#/definitions/EventActionData"},"event_data_template":{}},"additionalProperties":false,"required":["event","event_data"]},"EventActionData":{"additionalProperties":true,"type":"object","properties":{"name":{"type":"string"},"message":{"type":"string"},"entity_id":{"type":"string"},"domain":{"type":"string"}}},"NumericStateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"StateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"state":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"from":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id","state"]},"SunConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["sun"]},"before":{"type":"string"},"before_offset":{"type":"string"},"after":{"type":"string"},"after_offset":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TemplateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["template"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TimeConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["time"]},"before":{"type":"string"},"after":{"type":"string"},"weekday":{"anyOf":[{"type":"array","items":{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}},{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}]}},"additionalProperties":false,"required":["condition"]},"ZoneConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"AndConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["and"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"OrConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["or"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"Script":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#/definitions/SequencedAction"},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"}]}}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/homeassistant.json b/src/server/schemas/json/homeassistant.json deleted file mode 100644 index fc5f282162..0000000000 --- a/src/server/schemas/json/homeassistant.json +++ /dev/null @@ -1 +0,0 @@ -{"additionalProperties":true,"type":"object","properties":{"homeassistant":{"anyOf":[{"$ref":"#/definitions/HomeAssistantComponent"},{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"}]},"automation":{"anyOf":[{"type":"array","items":{"$ref":"#/definitions/Automation"}},{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"}]},"group":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/GroupComponent"}]},"panel_iframe":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/PanelIframeComponent"}]},"sensor":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/MqttSensor"},{"$ref":"#/definitions/TemplateSensor"},{"$ref":"#/definitions/OtherSensor"}]}},{"type":"null"}]},"scene":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"$ref":"#/definitions/SceneComponentEntry"}}]},"input_boolean":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/InputBooleanEntry"}]},"script":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/Script"}]},"http":{},"default_config":{},"person":{},"system_health":{},"panel_custom":{},"updater":{},"discovery":{},"conversation":{},"history":{},"config":{},"logbook":{},"sun":{},"tts":{},"recorder":{},"ifttt":{},"ios":{},"mqtt":{},"remote":{}},"definitions":{"HomeAssistantComponent":{"type":"object","properties":{"name":{"type":"string"},"latitude":{"type":["string","number"]},"longitude":{"type":["string","number"]},"elevation":{"type":["string","number"]},"unit_system":{"enum":["imperial","metric"],"type":"string"},"time_zone":{"type":"string"},"whitelist_external_dirs":{"type":"array","items":{"type":"string"}},"customize":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/CustomizeComponent"}]},"customize_domain":{},"customize_glob":{},"packages":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"$ref":"#/definitions/HomeAssistantComponent"}}]},"auth_providers":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/HomeAssistantAuthProvider"},{"$ref":"#/definitions/TrustedNetworksAuthProvider"},{"$ref":"#/definitions/CommandLineAuthProvider"},{"$ref":"#/definitions/LegacyApiPasswordAuthProvider"}]}},"auth_mfa_modules":{"anyOf":[{"type":"array","items":{}},{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"}]}},"additionalProperties":false},"IncludeTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"IncludeFolderTag":{"type":"string"},"CustomizeComponent":{"type":"object","additionalProperties":{"$ref":"#/definitions/CustomizeComponentEntry"}},"CustomizeComponentEntry":{"additionalProperties":true,"type":"object","properties":{"friendly_name":{"type":"string"},"homebridge_name":{"type":"string"},"hidden":{"type":"boolean"},"homebridge_hidden":{"type":"boolean"},"emulated_hue_hidden":{"type":"boolean"},"entity_picture":{"type":"string"},"icon":{"type":"string"},"assumed_state":{"type":"boolean"},"device_class":{"type":"string"},"unit_of_measurement":{"type":"string"},"initial_state":{"type":"boolean"}}},"HomeAssistantAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["homeassistant"]}},"additionalProperties":false,"required":["type"]},"TrustedNetworksAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["trusted_networks"]},"trusted_networks":{"anyOf":[{"type":"array","items":{}},{"type":"array","items":{"type":"string"}},{"type":"string"}]},"trusted_users":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"string"}]}},{"type":"string"}]}},"allow_bypass_login":{"type":"boolean"}},"additionalProperties":false,"required":["trusted_networks","type"]},"CommandLineAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["command_line"]},"command":{"type":"string"},"args":{},"meta":{"type":"boolean"}},"additionalProperties":false,"required":["command","type"]},"LegacyApiPasswordAuthProvider":{"type":"object","properties":{"type":{"type":"string","enum":["legacy_api_password"]},"api_password":{"anyOf":[{"$ref":"#/definitions/SecretTag"},{"type":"string"}]}},"additionalProperties":false,"required":["api_password","type"]},"SecretTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"Automation":{"type":"object","properties":{"id":{"type":"string"},"alias":{"type":"string"},"initial_state":{"type":["string","boolean"]},"hide_entity":{"type":"boolean"},"trigger":{"anyOf":[{"$ref":"#/definitions/HaTrigger"},{"$ref":"#/definitions/SunTrigger"},{"$ref":"#/definitions/TimeTrigger"},{"$ref":"#/definitions/TemplateTrigger"},{"$ref":"#/definitions/WebhookTrigger"},{"$ref":"#/definitions/EventTrigger"},{"$ref":"#/definitions/TimePatternTrigger"},{"$ref":"#/definitions/MqttTrigger"},{"$ref":"#/definitions/GeoLocationTrigger"},{"$ref":"#/definitions/StateTrigger"},{"$ref":"#/definitions/ZoneTrigger"},{"$ref":"#/definitions/NumericStateTrigger"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/HaTrigger"},{"$ref":"#/definitions/SunTrigger"},{"$ref":"#/definitions/TimeTrigger"},{"$ref":"#/definitions/TemplateTrigger"},{"$ref":"#/definitions/WebhookTrigger"},{"$ref":"#/definitions/EventTrigger"},{"$ref":"#/definitions/TimePatternTrigger"},{"$ref":"#/definitions/MqttTrigger"},{"$ref":"#/definitions/GeoLocationTrigger"},{"$ref":"#/definitions/StateTrigger"},{"$ref":"#/definitions/ZoneTrigger"},{"$ref":"#/definitions/NumericStateTrigger"}]}}]},"condition":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}},{"type":"null"}]},"action":{"anyOf":[{"$ref":"#/definitions/EventActionSchema"},{"$ref":"#/definitions/ServiceActionSchema"},{"$ref":"#/definitions/DelayActionSchema"},{"$ref":"#/definitions/ServiceActionTemplateSchema"},{"$ref":"#/definitions/WaitTemplateSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EventActionSchema"},{"$ref":"#/definitions/ServiceActionSchema"},{"$ref":"#/definitions/DelayActionSchema"},{"$ref":"#/definitions/ServiceActionTemplateSchema"},{"$ref":"#/definitions/WaitTemplateSchema"},{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}}]}},"additionalProperties":false,"required":["action","trigger"]},"HaTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["homeassistant"]},"event":{"enum":["shutdown","start"],"type":"string"}},"additionalProperties":false,"required":["event","platform"]},"SunTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["sun"]},"event":{"enum":["sunrise","sunset"],"type":"string"},"offset":{"type":"string"}},"additionalProperties":false,"required":["event","platform"]},"TimeTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["time"]},"at":{"type":"string"}},"additionalProperties":false,"required":["at","platform"]},"TemplateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["template"]},"value_template":{"type":"string"},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["platform","value_template"]},"TimePeriod":{"type":"object","properties":{"days":{"type":["string","number"]},"hours":{"type":["string","number"]},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]},"milliseconds":{"type":["string","number"]}},"additionalProperties":false},"WebhookTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["webhook"]},"webhook_id":{"type":"string"}},"additionalProperties":false,"required":["platform","webhook_id"]},"EventTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["event"]},"event_type":{"type":"string"},"event_data":{}},"additionalProperties":false,"required":["event_type","platform"]},"TimePatternTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["time_pattern"]},"hours":{"type":"string"},"minutes":{"type":["string","number"]},"seconds":{"type":["string","number"]}},"additionalProperties":false,"required":["platform"]},"MqttTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["mqtt"]},"topic":{"type":"string"},"payload":{"type":"string"},"encoding":{"type":"string"}},"additionalProperties":false,"required":["platform","topic"]},"GeoLocationTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["geo_location"]},"source":{"type":"string"},"zone":{"type":"string"},"event":{"enum":["enter","leave"],"type":"string"}},"additionalProperties":false,"required":["event","platform","source","zone"]},"StateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"from":{"type":["string","boolean"]},"to":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["entity_id","platform"]},"ZoneTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"},"event":{"enum":["enter","leave"],"type":"string"}},"additionalProperties":false,"required":["entity_id","event","platform","zone"]},"NumericStateTrigger":{"type":"object","properties":{"platform":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]}},"additionalProperties":false,"required":["entity_id","platform"]},"NumericStateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["numeric_state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"below":{"type":["string","number"]},"above":{"type":["string","number"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"StateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["state"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"state":{"type":["string","boolean"]},"for":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"from":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id","state"]},"SunConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["sun"]},"before":{"type":"string"},"before_offset":{"type":"string"},"after":{"type":"string"},"after_offset":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TemplateConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["template"]},"value_template":{"type":"string"}},"additionalProperties":false,"required":["condition"]},"TimeConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["time"]},"before":{"type":"string"},"after":{"type":"string"},"weekday":{"anyOf":[{"type":"array","items":{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}},{"enum":["fri","mon","sat","sun","thu","tue","wed"],"type":"string"}]}},"additionalProperties":false,"required":["condition"]},"ZoneConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["zone"]},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"zone":{"type":"string"}},"additionalProperties":false,"required":["condition","entity_id"]},"AndConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["and"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"OrConditionSchema":{"type":"object","properties":{"condition":{"type":"string","enum":["or"]},"conditions":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}}]}},"additionalProperties":false,"required":["condition","conditions"]},"EventActionSchema":{"type":"object","properties":{"alias":{"type":"string"},"event":{"type":"string"},"event_data":{},"event_data_template":{}},"additionalProperties":false,"required":["event"]},"ServiceActionSchema":{"type":"object","properties":{"service":{"type":"string"},"service_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"data":{},"data_template":{}},"additionalProperties":false,"required":["service"]},"DelayActionSchema":{"type":"object","properties":{"delay":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":["string","number"]}]}},"additionalProperties":false,"required":["delay"]},"ServiceActionTemplateSchema":{"type":"object","properties":{"service_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"data":{},"data_template":{}},"additionalProperties":false,"required":["service_template"]},"WaitTemplateSchema":{"type":"object","properties":{"wait_template":{"type":"string"},"timeout":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":"string"}]},"continue_on_timeout":{"type":["string","boolean"]}},"additionalProperties":false,"required":["wait_template"]},"GroupComponent":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"type":"string"}},{"$ref":"#/definitions/GroupComponentEntry"}]}},"GroupComponentEntry":{"type":"object","properties":{"name":{"type":"string"},"view":{"type":"boolean"},"icon":{"type":"string"},"control":{"type":"string"},"entities":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"all":{"type":"boolean"}},"additionalProperties":false,"required":["entities"]},"PanelIframeComponent":{"type":"object","additionalProperties":{"$ref":"#/definitions/PanelIframeComponentEntry"}},"PanelIframeComponentEntry":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"},"icon":{"type":"string"},"require_admin":{"type":"boolean"}},"additionalProperties":false,"required":["title","url"]},"MqttSensor":{"type":"object","properties":{"platform":{"type":"string","enum":["mqtt"]},"state_topic":{"type":"string"},"name":{"type":"string"},"qos":{"type":"number"},"unit_of_measurement":{"type":"string"},"icon":{"type":"string"},"expire_after":{"type":"number"},"value_template":{"type":"string"},"force_update":{"type":"boolean"},"availability_topic":{"type":"string"},"payload_available":{"type":"string"},"payload_not_available":{"type":"string"},"json_attributes_topic":{"type":"string"},"json_attributes":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"unique_id":{"type":"string"},"device_class":{"type":"string"},"device":{}},"additionalProperties":false,"required":["platform","state_topic"]},"TemplateSensor":{"type":"object","properties":{"platform":{"type":"string","enum":["template"]},"sensors":{"type":"object","additionalProperties":{"$ref":"#/definitions/TemplateSensorEntry"}}},"additionalProperties":false,"required":["platform","sensors"]},"TemplateSensorEntry":{"type":"object","properties":{"friendly_name":{"type":"string"},"friendly_name_template":{"type":"string"},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"unit_of_measurement":{"type":"string"},"value_template":{"type":"string"},"icon_template":{"type":"string"},"entity_picture_template":{"type":"string"},"device_class":{"type":"string"}},"additionalProperties":false},"OtherSensor":{"additionalProperties":true,"type":"object","properties":{"platform":{"pattern":"(^(?!.*(mqtt|template)).*)$","type":"string"}},"required":["platform"]},"SceneComponentEntry":{"type":"object","properties":{"name":{"type":"string"},"entities":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#/definitions/EntitySceneConfig"},{"type":["string","boolean"]}]}}},"additionalProperties":false,"required":["entities","name"]},"EntitySceneConfig":{"additionalProperties":true,"type":"object","properties":{"state":{"type":"boolean"},"brightness":{"type":["string","number"]},"source":{"type":"string"},"color_temp":{"type":["string","number"]},"xy_color":{}}},"InputBooleanEntry":{"type":"object","additionalProperties":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"initial":{"type":"boolean"},"icon":{"type":"string"}},"additionalProperties":false},{"type":"null"}]}},"Script":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#/definitions/SequencedAction"},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"}]}},"SequencedAction":{"type":"object","properties":{"alias":{"type":"string"},"sequence":{"anyOf":[{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/NumericStateConditionSchema"},{"$ref":"#/definitions/StateConditionSchema"},{"$ref":"#/definitions/SunConditionSchema"},{"$ref":"#/definitions/TemplateConditionSchema"},{"$ref":"#/definitions/TimeConditionSchema"},{"$ref":"#/definitions/ZoneConditionSchema"},{"$ref":"#/definitions/AndConditionSchema"},{"$ref":"#/definitions/OrConditionSchema"}]}},{"$ref":"#/definitions/ServiceAction"},{"$ref":"#/definitions/DelayAction"},{"$ref":"#/definitions/WaitAction"},{"$ref":"#/definitions/EventAction"}]}}]}},"additionalProperties":false,"required":["sequence"]},"ServiceAction":{"type":"object","properties":{"service":{"type":"string"},"service_template":{"type":"string"},"data":{},"data_template":{},"entity_id":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]}},"additionalProperties":false},"DelayAction":{"type":"object","properties":{"delay":{"anyOf":[{"$ref":"#/definitions/TimePeriod"},{"type":["string","number"]}]}},"additionalProperties":false,"required":["delay"]},"WaitAction":{"type":"object","properties":{"wait_template":{"type":"string"},"timeout":{"type":"string"},"continue_on_timeout":{"type":["string","boolean"]}},"additionalProperties":false,"required":["wait_template"]},"EventAction":{"type":"object","properties":{"event":{"type":"string"},"event_data":{"$ref":"#/definitions/EventActionData"},"event_data_template":{}},"additionalProperties":false,"required":["event","event_data"]},"EventActionData":{"additionalProperties":true,"type":"object","properties":{"name":{"type":"string"},"message":{"type":"string"},"entity_id":{"type":"string"},"domain":{"type":"string"}}}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/lovelace-cards.json b/src/server/schemas/json/lovelace-cards.json deleted file mode 100644 index 6027ed6fe7..0000000000 --- a/src/server/schemas/json/lovelace-cards.json +++ /dev/null @@ -1 +0,0 @@ -{"anyOf":[{"$ref":"#/definitions/AlarmPanelCardConfig"},{"$ref":"#/definitions/ConditionalCardConfig"},{"$ref":"#/definitions/EmptyStateCardConfig"},{"$ref":"#/definitions/EntitiesCardConfig"},{"$ref":"#/definitions/EntityButtonCardConfig"},{"$ref":"#/definitions/EntityFilterCardConfig"},{"$ref":"#/definitions/ErrorCardConfig"},{"$ref":"#/definitions/GaugeCardConfig"},{"$ref":"#/definitions/GlanceCardConfig"},{"$ref":"#/definitions/HistoryGraphConfig"},{"$ref":"#/definitions/IframeCardConfig"},{"$ref":"#/definitions/LightCardConfig"},{"$ref":"#/definitions/MapCardConfig"},{"$ref":"#/definitions/MarkdownCardConfig"},{"$ref":"#/definitions/MediaControlCardConfig"},{"$ref":"#/definitions/PictureCardConfig"},{"$ref":"#/definitions/PictureElementsCardConfig"},{"$ref":"#/definitions/PictureEntityCardConfig"},{"$ref":"#/definitions/PictureGlanceCardConfig"},{"$ref":"#/definitions/PlantStatusCardConfig"},{"$ref":"#/definitions/SensorCardConfig"},{"$ref":"#/definitions/ShoppingListCardConfig"},{"$ref":"#/definitions/StackCardConfig"},{"$ref":"#/definitions/ThermostatCardConfig"},{"$ref":"#/definitions/WeatherForecastCardConfig"},{"$ref":"#/definitions/CustomCardConfig"},{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/AlarmPanelCardConfig"},{"$ref":"#/definitions/ConditionalCardConfig"},{"$ref":"#/definitions/EmptyStateCardConfig"},{"$ref":"#/definitions/EntitiesCardConfig"},{"$ref":"#/definitions/EntityButtonCardConfig"},{"$ref":"#/definitions/EntityFilterCardConfig"},{"$ref":"#/definitions/ErrorCardConfig"},{"$ref":"#/definitions/GaugeCardConfig"},{"$ref":"#/definitions/GlanceCardConfig"},{"$ref":"#/definitions/HistoryGraphConfig"},{"$ref":"#/definitions/IframeCardConfig"},{"$ref":"#/definitions/LightCardConfig"},{"$ref":"#/definitions/MapCardConfig"},{"$ref":"#/definitions/MarkdownCardConfig"},{"$ref":"#/definitions/MediaControlCardConfig"},{"$ref":"#/definitions/PictureCardConfig"},{"$ref":"#/definitions/PictureElementsCardConfig"},{"$ref":"#/definitions/PictureEntityCardConfig"},{"$ref":"#/definitions/PictureGlanceCardConfig"},{"$ref":"#/definitions/PlantStatusCardConfig"},{"$ref":"#/definitions/SensorCardConfig"},{"$ref":"#/definitions/ShoppingListCardConfig"},{"$ref":"#/definitions/StackCardConfig"},{"$ref":"#/definitions/ThermostatCardConfig"},{"$ref":"#/definitions/WeatherForecastCardConfig"},{"$ref":"#/definitions/CustomCardConfig"}]}}],"definitions":{"AlarmPanelCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["alarm-panel"]},"entity":{"type":"string"},"name":{"type":"string"},"states":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ConditionalCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["conditional"]},"card":{"$ref":"#/definitions/LovelaceCardConfig"},"conditions":{"type":"array","items":{"$ref":"#/definitions/Condition"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["card","conditions","type"]},"LovelaceCardConfig":{"type":"object","additionalProperties":{},"properties":{"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"required":["type"]},"Condition":{"type":"object","properties":{"entity":{"type":"string"},"state":{"type":"string"},"state_not":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"EmptyStateCardConfig":{"type":"object","properties":{"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false,"required":["content","type"]},"EntitiesCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entities"]},"show_header_toggle":{"type":"boolean"},"title":{"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntitiesCardEntityConfig"},{"$ref":"#/definitions/WebLinkEntityConfig"},{"$ref":"#/definitions/CallServiceEntityConfig"},{"$ref":"#/definitions/DividerEntityConfig"},{"$ref":"#/definitions/SectionEntityConfig"},{"$ref":"#/definitions/CustomEntityConfig"},{"type":"string"}]}},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"EntitiesCardEntityConfig":{"type":"object","properties":{"type":{"type":"string"},"secondary_info":{"enum":["entity-id","last-changed"],"type":"string"},"format":{"enum":["date","datetime","relative","time","total"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"WebLinkEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["weblink"]},"url":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["type","url"]},"CallServiceEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["call-service"]},"name":{"type":"string"},"service":{"type":"string"},"icon":{"type":"string"},"action_name":{"type":"string"},"service_data":{"type":"object","additionalProperties":{},"properties":{"entity_id":{"anyOf":[{"type":"array","items":[{"type":"string"}],"minItems":1,"additionalItems":{"anyOf":[{"type":"string"}]}},{"type":"string"}]}}}},"additionalProperties":false,"required":["name","service","type"]},"DividerEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["divider"]},"style":{}},"additionalProperties":false,"required":["type"]},"SectionEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["section"]},"label":{"type":"string"}},"additionalProperties":false,"required":["type"]},"CustomEntityConfig":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"},"label":{"type":"string"}},"required":["type"]},"EntityButtonCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entity-button"]},"entity":{"type":"string"},"name":{"type":"string"},"show_name":{"type":"boolean"},"icon":{"type":"string"},"show_icon":{"type":"boolean"},"theme":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"icon_height":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ToggleActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["toggle"]}},"additionalProperties":false,"required":["action"]},"CallServiceActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["call-service"]},"service":{"type":"string"},"service_data":{"type":"object","additionalProperties":{},"properties":{"entity_id":{"anyOf":[{"type":"array","items":[{"type":"string"}],"minItems":1,"additionalItems":{"anyOf":[{"type":"string"}]}},{"type":"string"}]}}}},"additionalProperties":false,"required":["action","service"]},"NavigateActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["navigate"]},"navigation_path":{"type":"string"}},"additionalProperties":false,"required":["action","navigation_path"]},"MoreInfoActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["more-info"]}},"additionalProperties":false,"required":["action"]},"NoActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["none"]}},"additionalProperties":false,"required":["action"]},"EntityFilterCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entity-filter"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"state_filter":{"type":"array","items":{"type":"string"}},"card":{"description":"Make all properties in T optional","anyOf":[{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"}]},"show_empty":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["card","entities","state_filter","type"]},"EntityConfig":{"type":"object","properties":{"entity":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"Partial":{"type":"object","properties":{"type":{"enum":["alarm-panel"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"states":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["conditional"],"type":"string"},"card":{"$ref":"#/definitions/LovelaceCardConfig"},"conditions":{"type":"array","items":{"$ref":"#/definitions/Condition"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entities"],"type":"string"},"show_header_toggle":{"type":"boolean"},"title":{"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntitiesCardEntityConfig"},{"$ref":"#/definitions/WebLinkEntityConfig"},{"$ref":"#/definitions/CallServiceEntityConfig"},{"$ref":"#/definitions/DividerEntityConfig"},{"$ref":"#/definitions/SectionEntityConfig"},{"$ref":"#/definitions/CustomEntityConfig"},{"type":"string"}]}},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entity-button"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"show_name":{"type":"boolean"},"icon":{"type":"string"},"show_icon":{"type":"boolean"},"theme":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"icon_height":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entity-filter"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"state_filter":{"type":"array","items":{"type":"string"}},"card":{"description":"Make all properties in T optional","anyOf":[{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"}]},"show_empty":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"error":{"type":"string"},"origConfig":{"$ref":"#/definitions/LovelaceCardConfig"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["gauge"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"severity":{"$ref":"#/definitions/SeverityConfig"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"SeverityConfig":{"type":"object","properties":{"green":{"type":"number"},"yellow":{"type":"number"},"red":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["glance"],"type":"string"},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"show_icon":{"type":"boolean"},"title":{"type":"string"},"theme":{"type":"string"},"entities":{"type":"array","items":{"$ref":"#/definitions/ConfigEntity"}},"columns":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"ConfigEntity":{"type":"object","properties":{"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"entity":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"Partial":{"type":"object","properties":{"type":{"enum":["history-graph"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"hours_to_show":{"type":"number"},"title":{"type":"string"},"refresh_interval":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["iframe"],"type":"string"},"aspect_ratio":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["light"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["map"],"type":"string"},"title":{"type":"string"},"aspect_ratio":{"type":"string"},"default_zoom":{"type":"number"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"geo_location_sources":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["markdown"],"type":"string"},"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["media-control"],"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture"],"type":"string"},"image":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture-elements"],"type":"string"},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"StateBadgeElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-badge"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"StateIconElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-icon"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"StateLabelElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-label"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"prefix":{"type":"string"},"suffix":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"IconElement":{"type":"object","properties":{"type":{"type":"string","enum":["icon"]},"icon":{"type":"string"},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"title":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["icon","type"]},"ImageElement":{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{},"filter":{"type":"string"},"state_filter":{"type":"object","properties":{},"additionalProperties":true},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["type"]},"ConditionalElement":{"type":"object","properties":{"type":{"type":"string","enum":["conditional"]},"conditions":{"type":"array","items":{"$ref":"#/definitions/ElementCondition"}},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}}},"additionalProperties":false,"required":["conditions","elements","type"]},"ElementCondition":{"type":"object","properties":{"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"state":{"type":"string"},"state_not":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"CustomElement":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"},"style":{}},"required":["style","type"]},"Partial":{"type":"object","properties":{"type":{"enum":["picture-entity"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture-glance"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"enum":["auto","live"],"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["plant-status"],"type":"string"},"name":{"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["sensor"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"graph":{"type":"string"},"unit":{"type":"string"},"detail":{"type":"number"},"theme":{"type":"string"},"hours_to_show":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["shopping-list"],"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["horizontal-stack","vertical-stack"],"type":"string"},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceCardConfig"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"IncludeTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"IncludeFolderTag":{"type":"string"},"Partial":{"type":"object","properties":{"type":{"enum":["thermostat"],"type":"string"},"entity":{"type":"string"},"theme":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["weather-forecast"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"}},"additionalProperties":false},"ErrorCardConfig":{"type":"object","properties":{"error":{"type":"string"},"origConfig":{"$ref":"#/definitions/LovelaceCardConfig"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false,"required":["error","origConfig","type"]},"GaugeCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["gauge"]},"entity":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"severity":{"$ref":"#/definitions/SeverityConfig"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"GlanceCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["glance"]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"show_icon":{"type":"boolean"},"title":{"type":"string"},"theme":{"type":"string"},"entities":{"type":"array","items":{"$ref":"#/definitions/ConfigEntity"}},"columns":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"HistoryGraphConfig":{"type":"object","properties":{"type":{"type":"string","enum":["history-graph"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"hours_to_show":{"type":"number"},"title":{"type":"string"},"refresh_interval":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"IframeCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["iframe"]},"aspect_ratio":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type","url"]},"LightCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["light"]},"entity":{"type":"string"},"name":{"type":"string"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"MapCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["map"]},"title":{"type":"string"},"aspect_ratio":{"type":"string"},"default_zoom":{"type":"number"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"geo_location_sources":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"MarkdownCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["markdown"]},"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["content","type"]},"MediaControlCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["media-control"]},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"PictureCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture"]},"image":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"PictureElementsCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-elements"]},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["elements","type"]},"PictureEntityCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-entity"]},"entity":{"type":"string"},"name":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"PictureGlanceCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-glance"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"enum":["auto","live"],"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"PlantStatusCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["plant-status"]},"name":{"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"SensorCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["sensor"]},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"graph":{"type":"string"},"unit":{"type":"string"},"detail":{"type":"number"},"theme":{"type":"string"},"hours_to_show":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ShoppingListCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["shopping-list"]},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"StackCardConfig":{"type":"object","properties":{"type":{"enum":["horizontal-stack","vertical-stack"],"type":"string"},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceCardConfig"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["cards","type"]},"ThermostatCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["thermostat"]},"entity":{"type":"string"},"theme":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"WeatherForecastCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["weather-forecast"]},"entity":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"CustomCardConfig":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"}},"required":["type"]}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/lovelace-views.json b/src/server/schemas/json/lovelace-views.json deleted file mode 100644 index a5d51fa4c2..0000000000 --- a/src/server/schemas/json/lovelace-views.json +++ /dev/null @@ -1 +0,0 @@ -{"anyOf":[{"$ref":"#/definitions/LovelaceViewConfig"},{"type":"array","items":{"$ref":"#/definitions/LovelaceViewConfig"}}],"definitions":{"LovelaceViewConfig":{"additionalProperties":true,"type":"object","properties":{"id":{"type":["string","number"]},"index":{"type":"number"},"title":{"type":"string"},"badges":{"type":"array","items":{"type":"string"}},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/AlarmPanelCardConfig"},{"$ref":"#/definitions/ConditionalCardConfig"},{"$ref":"#/definitions/EmptyStateCardConfig"},{"$ref":"#/definitions/EntitiesCardConfig"},{"$ref":"#/definitions/EntityButtonCardConfig"},{"$ref":"#/definitions/EntityFilterCardConfig"},{"$ref":"#/definitions/ErrorCardConfig"},{"$ref":"#/definitions/GaugeCardConfig"},{"$ref":"#/definitions/GlanceCardConfig"},{"$ref":"#/definitions/HistoryGraphConfig"},{"$ref":"#/definitions/IframeCardConfig"},{"$ref":"#/definitions/LightCardConfig"},{"$ref":"#/definitions/MapCardConfig"},{"$ref":"#/definitions/MarkdownCardConfig"},{"$ref":"#/definitions/MediaControlCardConfig"},{"$ref":"#/definitions/PictureCardConfig"},{"$ref":"#/definitions/PictureElementsCardConfig"},{"$ref":"#/definitions/PictureEntityCardConfig"},{"$ref":"#/definitions/PictureGlanceCardConfig"},{"$ref":"#/definitions/PlantStatusCardConfig"},{"$ref":"#/definitions/SensorCardConfig"},{"$ref":"#/definitions/ShoppingListCardConfig"},{"$ref":"#/definitions/StackCardConfig"},{"$ref":"#/definitions/ThermostatCardConfig"},{"$ref":"#/definitions/WeatherForecastCardConfig"},{"$ref":"#/definitions/CustomCardConfig"}]}},"path":{"type":"string"},"icon":{"type":"string"},"theme":{"type":"string"},"panel":{"type":"boolean"},"background":{"type":"string"}}},"IncludeTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"IncludeFolderTag":{"type":"string"},"AlarmPanelCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["alarm-panel"]},"entity":{"type":"string"},"name":{"type":"string"},"states":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ConditionalCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["conditional"]},"card":{"$ref":"#/definitions/LovelaceCardConfig"},"conditions":{"type":"array","items":{"$ref":"#/definitions/Condition"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["card","conditions","type"]},"LovelaceCardConfig":{"type":"object","additionalProperties":{},"properties":{"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"required":["type"]},"Condition":{"type":"object","properties":{"entity":{"type":"string"},"state":{"type":"string"},"state_not":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"EmptyStateCardConfig":{"type":"object","properties":{"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false,"required":["content","type"]},"EntitiesCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entities"]},"show_header_toggle":{"type":"boolean"},"title":{"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntitiesCardEntityConfig"},{"$ref":"#/definitions/WebLinkEntityConfig"},{"$ref":"#/definitions/CallServiceEntityConfig"},{"$ref":"#/definitions/DividerEntityConfig"},{"$ref":"#/definitions/SectionEntityConfig"},{"$ref":"#/definitions/CustomEntityConfig"},{"type":"string"}]}},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"EntitiesCardEntityConfig":{"type":"object","properties":{"type":{"type":"string"},"secondary_info":{"enum":["entity-id","last-changed"],"type":"string"},"format":{"enum":["date","datetime","relative","time","total"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"WebLinkEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["weblink"]},"url":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["type","url"]},"CallServiceEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["call-service"]},"name":{"type":"string"},"service":{"type":"string"},"icon":{"type":"string"},"action_name":{"type":"string"},"service_data":{"type":"object","additionalProperties":{},"properties":{"entity_id":{"anyOf":[{"type":"array","items":[{"type":"string"}],"minItems":1,"additionalItems":{"anyOf":[{"type":"string"}]}},{"type":"string"}]}}}},"additionalProperties":false,"required":["name","service","type"]},"DividerEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["divider"]},"style":{}},"additionalProperties":false,"required":["type"]},"SectionEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["section"]},"label":{"type":"string"}},"additionalProperties":false,"required":["type"]},"CustomEntityConfig":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"},"label":{"type":"string"}},"required":["type"]},"EntityButtonCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entity-button"]},"entity":{"type":"string"},"name":{"type":"string"},"show_name":{"type":"boolean"},"icon":{"type":"string"},"show_icon":{"type":"boolean"},"theme":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"icon_height":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ToggleActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["toggle"]}},"additionalProperties":false,"required":["action"]},"CallServiceActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["call-service"]},"service":{"type":"string"},"service_data":{"type":"object","additionalProperties":{},"properties":{"entity_id":{"anyOf":[{"type":"array","items":[{"type":"string"}],"minItems":1,"additionalItems":{"anyOf":[{"type":"string"}]}},{"type":"string"}]}}}},"additionalProperties":false,"required":["action","service"]},"NavigateActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["navigate"]},"navigation_path":{"type":"string"}},"additionalProperties":false,"required":["action","navigation_path"]},"MoreInfoActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["more-info"]}},"additionalProperties":false,"required":["action"]},"NoActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["none"]}},"additionalProperties":false,"required":["action"]},"EntityFilterCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entity-filter"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"state_filter":{"type":"array","items":{"type":"string"}},"card":{"description":"Make all properties in T optional","anyOf":[{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"}]},"show_empty":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["card","entities","state_filter","type"]},"EntityConfig":{"type":"object","properties":{"entity":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"Partial":{"type":"object","properties":{"type":{"enum":["alarm-panel"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"states":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["conditional"],"type":"string"},"card":{"$ref":"#/definitions/LovelaceCardConfig"},"conditions":{"type":"array","items":{"$ref":"#/definitions/Condition"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entities"],"type":"string"},"show_header_toggle":{"type":"boolean"},"title":{"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntitiesCardEntityConfig"},{"$ref":"#/definitions/WebLinkEntityConfig"},{"$ref":"#/definitions/CallServiceEntityConfig"},{"$ref":"#/definitions/DividerEntityConfig"},{"$ref":"#/definitions/SectionEntityConfig"},{"$ref":"#/definitions/CustomEntityConfig"},{"type":"string"}]}},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entity-button"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"show_name":{"type":"boolean"},"icon":{"type":"string"},"show_icon":{"type":"boolean"},"theme":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"icon_height":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entity-filter"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"state_filter":{"type":"array","items":{"type":"string"}},"card":{"description":"Make all properties in T optional","anyOf":[{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"}]},"show_empty":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"error":{"type":"string"},"origConfig":{"$ref":"#/definitions/LovelaceCardConfig"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["gauge"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"severity":{"$ref":"#/definitions/SeverityConfig"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"SeverityConfig":{"type":"object","properties":{"green":{"type":"number"},"yellow":{"type":"number"},"red":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["glance"],"type":"string"},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"show_icon":{"type":"boolean"},"title":{"type":"string"},"theme":{"type":"string"},"entities":{"type":"array","items":{"$ref":"#/definitions/ConfigEntity"}},"columns":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"ConfigEntity":{"type":"object","properties":{"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"entity":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"Partial":{"type":"object","properties":{"type":{"enum":["history-graph"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"hours_to_show":{"type":"number"},"title":{"type":"string"},"refresh_interval":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["iframe"],"type":"string"},"aspect_ratio":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["light"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["map"],"type":"string"},"title":{"type":"string"},"aspect_ratio":{"type":"string"},"default_zoom":{"type":"number"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"geo_location_sources":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["markdown"],"type":"string"},"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["media-control"],"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture"],"type":"string"},"image":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture-elements"],"type":"string"},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"StateBadgeElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-badge"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"StateIconElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-icon"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"StateLabelElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-label"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"prefix":{"type":"string"},"suffix":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"IconElement":{"type":"object","properties":{"type":{"type":"string","enum":["icon"]},"icon":{"type":"string"},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"title":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["icon","type"]},"ImageElement":{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{},"filter":{"type":"string"},"state_filter":{"type":"object","properties":{},"additionalProperties":true},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["type"]},"ConditionalElement":{"type":"object","properties":{"type":{"type":"string","enum":["conditional"]},"conditions":{"type":"array","items":{"$ref":"#/definitions/ElementCondition"}},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}}},"additionalProperties":false,"required":["conditions","elements","type"]},"ElementCondition":{"type":"object","properties":{"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"state":{"type":"string"},"state_not":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"CustomElement":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"},"style":{}},"required":["style","type"]},"Partial":{"type":"object","properties":{"type":{"enum":["picture-entity"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture-glance"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"enum":["auto","live"],"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["plant-status"],"type":"string"},"name":{"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["sensor"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"graph":{"type":"string"},"unit":{"type":"string"},"detail":{"type":"number"},"theme":{"type":"string"},"hours_to_show":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["shopping-list"],"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["horizontal-stack","vertical-stack"],"type":"string"},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceCardConfig"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["thermostat"],"type":"string"},"entity":{"type":"string"},"theme":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["weather-forecast"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"}},"additionalProperties":false},"ErrorCardConfig":{"type":"object","properties":{"error":{"type":"string"},"origConfig":{"$ref":"#/definitions/LovelaceCardConfig"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false,"required":["error","origConfig","type"]},"GaugeCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["gauge"]},"entity":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"severity":{"$ref":"#/definitions/SeverityConfig"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"GlanceCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["glance"]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"show_icon":{"type":"boolean"},"title":{"type":"string"},"theme":{"type":"string"},"entities":{"type":"array","items":{"$ref":"#/definitions/ConfigEntity"}},"columns":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"HistoryGraphConfig":{"type":"object","properties":{"type":{"type":"string","enum":["history-graph"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"hours_to_show":{"type":"number"},"title":{"type":"string"},"refresh_interval":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"IframeCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["iframe"]},"aspect_ratio":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type","url"]},"LightCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["light"]},"entity":{"type":"string"},"name":{"type":"string"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"MapCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["map"]},"title":{"type":"string"},"aspect_ratio":{"type":"string"},"default_zoom":{"type":"number"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"geo_location_sources":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"MarkdownCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["markdown"]},"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["content","type"]},"MediaControlCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["media-control"]},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"PictureCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture"]},"image":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"PictureElementsCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-elements"]},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["elements","type"]},"PictureEntityCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-entity"]},"entity":{"type":"string"},"name":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"PictureGlanceCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-glance"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"enum":["auto","live"],"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"PlantStatusCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["plant-status"]},"name":{"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"SensorCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["sensor"]},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"graph":{"type":"string"},"unit":{"type":"string"},"detail":{"type":"number"},"theme":{"type":"string"},"hours_to_show":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ShoppingListCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["shopping-list"]},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"StackCardConfig":{"type":"object","properties":{"type":{"enum":["horizontal-stack","vertical-stack"],"type":"string"},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceCardConfig"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["cards","type"]},"ThermostatCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["thermostat"]},"entity":{"type":"string"},"theme":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"WeatherForecastCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["weather-forecast"]},"entity":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"CustomCardConfig":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"}},"required":["type"]}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/json/ui-lovelace.json b/src/server/schemas/json/ui-lovelace.json deleted file mode 100644 index ec739319a6..0000000000 --- a/src/server/schemas/json/ui-lovelace.json +++ /dev/null @@ -1 +0,0 @@ -{"additionalProperties":true,"type":"object","properties":{"title":{"type":"string"},"views":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceViewConfig"}]}},"background":{"type":"string"},"resources":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"type":"array","items":{"type":"object","properties":{"type":{"enum":["css","html","js","module"],"type":"string"},"url":{"type":"string"}},"additionalProperties":false,"required":["type","url"]}}]}},"required":["views"],"definitions":{"IncludeTag":{"type":"string","pattern":"[.]yaml|[.]yml$"},"IncludeFolderTag":{"type":"string"},"LovelaceViewConfig":{"additionalProperties":true,"type":"object","properties":{"id":{"type":["string","number"]},"index":{"type":"number"},"title":{"type":"string"},"badges":{"type":"array","items":{"type":"string"}},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/AlarmPanelCardConfig"},{"$ref":"#/definitions/ConditionalCardConfig"},{"$ref":"#/definitions/EmptyStateCardConfig"},{"$ref":"#/definitions/EntitiesCardConfig"},{"$ref":"#/definitions/EntityButtonCardConfig"},{"$ref":"#/definitions/EntityFilterCardConfig"},{"$ref":"#/definitions/ErrorCardConfig"},{"$ref":"#/definitions/GaugeCardConfig"},{"$ref":"#/definitions/GlanceCardConfig"},{"$ref":"#/definitions/HistoryGraphConfig"},{"$ref":"#/definitions/IframeCardConfig"},{"$ref":"#/definitions/LightCardConfig"},{"$ref":"#/definitions/MapCardConfig"},{"$ref":"#/definitions/MarkdownCardConfig"},{"$ref":"#/definitions/MediaControlCardConfig"},{"$ref":"#/definitions/PictureCardConfig"},{"$ref":"#/definitions/PictureElementsCardConfig"},{"$ref":"#/definitions/PictureEntityCardConfig"},{"$ref":"#/definitions/PictureGlanceCardConfig"},{"$ref":"#/definitions/PlantStatusCardConfig"},{"$ref":"#/definitions/SensorCardConfig"},{"$ref":"#/definitions/ShoppingListCardConfig"},{"$ref":"#/definitions/StackCardConfig"},{"$ref":"#/definitions/ThermostatCardConfig"},{"$ref":"#/definitions/WeatherForecastCardConfig"},{"$ref":"#/definitions/CustomCardConfig"}]}},"path":{"type":"string"},"icon":{"type":"string"},"theme":{"type":"string"},"panel":{"type":"boolean"},"background":{"type":"string"}}},"AlarmPanelCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["alarm-panel"]},"entity":{"type":"string"},"name":{"type":"string"},"states":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ConditionalCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["conditional"]},"card":{"$ref":"#/definitions/LovelaceCardConfig"},"conditions":{"type":"array","items":{"$ref":"#/definitions/Condition"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["card","conditions","type"]},"LovelaceCardConfig":{"type":"object","additionalProperties":{},"properties":{"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"required":["type"]},"Condition":{"type":"object","properties":{"entity":{"type":"string"},"state":{"type":"string"},"state_not":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"EmptyStateCardConfig":{"type":"object","properties":{"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false,"required":["content","type"]},"EntitiesCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entities"]},"show_header_toggle":{"type":"boolean"},"title":{"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntitiesCardEntityConfig"},{"$ref":"#/definitions/WebLinkEntityConfig"},{"$ref":"#/definitions/CallServiceEntityConfig"},{"$ref":"#/definitions/DividerEntityConfig"},{"$ref":"#/definitions/SectionEntityConfig"},{"$ref":"#/definitions/CustomEntityConfig"},{"type":"string"}]}},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"EntitiesCardEntityConfig":{"type":"object","properties":{"type":{"type":"string"},"secondary_info":{"enum":["entity-id","last-changed"],"type":"string"},"format":{"enum":["date","datetime","relative","time","total"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"WebLinkEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["weblink"]},"url":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["type","url"]},"CallServiceEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["call-service"]},"name":{"type":"string"},"service":{"type":"string"},"icon":{"type":"string"},"action_name":{"type":"string"},"service_data":{"type":"object","additionalProperties":{},"properties":{"entity_id":{"anyOf":[{"type":"array","items":[{"type":"string"}],"minItems":1,"additionalItems":{"anyOf":[{"type":"string"}]}},{"type":"string"}]}}}},"additionalProperties":false,"required":["name","service","type"]},"DividerEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["divider"]},"style":{}},"additionalProperties":false,"required":["type"]},"SectionEntityConfig":{"type":"object","properties":{"type":{"type":"string","enum":["section"]},"label":{"type":"string"}},"additionalProperties":false,"required":["type"]},"CustomEntityConfig":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"},"label":{"type":"string"}},"required":["type"]},"EntityButtonCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entity-button"]},"entity":{"type":"string"},"name":{"type":"string"},"show_name":{"type":"boolean"},"icon":{"type":"string"},"show_icon":{"type":"boolean"},"theme":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"icon_height":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ToggleActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["toggle"]}},"additionalProperties":false,"required":["action"]},"CallServiceActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["call-service"]},"service":{"type":"string"},"service_data":{"type":"object","additionalProperties":{},"properties":{"entity_id":{"anyOf":[{"type":"array","items":[{"type":"string"}],"minItems":1,"additionalItems":{"anyOf":[{"type":"string"}]}},{"type":"string"}]}}}},"additionalProperties":false,"required":["action","service"]},"NavigateActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["navigate"]},"navigation_path":{"type":"string"}},"additionalProperties":false,"required":["action","navigation_path"]},"MoreInfoActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["more-info"]}},"additionalProperties":false,"required":["action"]},"NoActionConfig":{"type":"object","properties":{"action":{"type":"string","enum":["none"]}},"additionalProperties":false,"required":["action"]},"EntityFilterCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["entity-filter"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"state_filter":{"type":"array","items":{"type":"string"}},"card":{"description":"Make all properties in T optional","anyOf":[{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"}]},"show_empty":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["card","entities","state_filter","type"]},"EntityConfig":{"type":"object","properties":{"entity":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"Partial":{"type":"object","properties":{"type":{"enum":["alarm-panel"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"states":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["conditional"],"type":"string"},"card":{"$ref":"#/definitions/LovelaceCardConfig"},"conditions":{"type":"array","items":{"$ref":"#/definitions/Condition"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entities"],"type":"string"},"show_header_toggle":{"type":"boolean"},"title":{"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntitiesCardEntityConfig"},{"$ref":"#/definitions/WebLinkEntityConfig"},{"$ref":"#/definitions/CallServiceEntityConfig"},{"$ref":"#/definitions/DividerEntityConfig"},{"$ref":"#/definitions/SectionEntityConfig"},{"$ref":"#/definitions/CustomEntityConfig"},{"type":"string"}]}},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entity-button"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"show_name":{"type":"boolean"},"icon":{"type":"string"},"show_icon":{"type":"boolean"},"theme":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"icon_height":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["entity-filter"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"state_filter":{"type":"array","items":{"type":"string"}},"card":{"description":"Make all properties in T optional","anyOf":[{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"},{"$ref":"#/definitions/Partial"}]},"show_empty":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"error":{"type":"string"},"origConfig":{"$ref":"#/definitions/LovelaceCardConfig"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["gauge"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"severity":{"$ref":"#/definitions/SeverityConfig"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"SeverityConfig":{"type":"object","properties":{"green":{"type":"number"},"yellow":{"type":"number"},"red":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["glance"],"type":"string"},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"show_icon":{"type":"boolean"},"title":{"type":"string"},"theme":{"type":"string"},"entities":{"type":"array","items":{"$ref":"#/definitions/ConfigEntity"}},"columns":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"ConfigEntity":{"type":"object","properties":{"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"entity":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"Partial":{"type":"object","properties":{"type":{"enum":["history-graph"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"hours_to_show":{"type":"number"},"title":{"type":"string"},"refresh_interval":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["iframe"],"type":"string"},"aspect_ratio":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["light"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["map"],"type":"string"},"title":{"type":"string"},"aspect_ratio":{"type":"string"},"default_zoom":{"type":"number"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"geo_location_sources":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["markdown"],"type":"string"},"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["media-control"],"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture"],"type":"string"},"image":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture-elements"],"type":"string"},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"StateBadgeElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-badge"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"StateIconElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-icon"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"StateLabelElement":{"type":"object","properties":{"type":{"type":"string","enum":["state-label"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"prefix":{"type":"string"},"suffix":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["entity","type"]},"IconElement":{"type":"object","properties":{"type":{"type":"string","enum":["icon"]},"icon":{"type":"string"},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"title":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["icon","type"]},"ImageElement":{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{},"filter":{"type":"string"},"state_filter":{"type":"object","properties":{},"additionalProperties":true},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"style":{}},"additionalProperties":false,"required":["type"]},"ConditionalElement":{"type":"object","properties":{"type":{"type":"string","enum":["conditional"]},"conditions":{"type":"array","items":{"$ref":"#/definitions/ElementCondition"}},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}}},"additionalProperties":false,"required":["conditions","elements","type"]},"ElementCondition":{"type":"object","properties":{"entity":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]},"state":{"type":"string"},"state_not":{"type":"string"}},"additionalProperties":false,"required":["entity"]},"CustomElement":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"},"style":{}},"required":["style","type"]},"Partial":{"type":"object","properties":{"type":{"enum":["picture-entity"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["picture-glance"],"type":"string"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"enum":["auto","live"],"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["plant-status"],"type":"string"},"name":{"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["sensor"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"graph":{"type":"string"},"unit":{"type":"string"},"detail":{"type":"number"},"theme":{"type":"string"},"hours_to_show":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["shopping-list"],"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["horizontal-stack","vertical-stack"],"type":"string"},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceCardConfig"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["thermostat"],"type":"string"},"entity":{"type":"string"},"theme":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"enum":["weather-forecast"],"type":"string"},"entity":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false},"Partial":{"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"}},"additionalProperties":false},"ErrorCardConfig":{"type":"object","properties":{"error":{"type":"string"},"origConfig":{"$ref":"#/definitions/LovelaceCardConfig"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"},"type":{"type":"string"}},"additionalProperties":false,"required":["error","origConfig","type"]},"GaugeCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["gauge"]},"entity":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"},"severity":{"$ref":"#/definitions/SeverityConfig"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"GlanceCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["glance"]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"show_icon":{"type":"boolean"},"title":{"type":"string"},"theme":{"type":"string"},"entities":{"type":"array","items":{"$ref":"#/definitions/ConfigEntity"}},"columns":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"HistoryGraphConfig":{"type":"object","properties":{"type":{"type":"string","enum":["history-graph"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"hours_to_show":{"type":"number"},"title":{"type":"string"},"refresh_interval":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"IframeCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["iframe"]},"aspect_ratio":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type","url"]},"LightCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["light"]},"entity":{"type":"string"},"name":{"type":"string"},"theme":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"MapCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["map"]},"title":{"type":"string"},"aspect_ratio":{"type":"string"},"default_zoom":{"type":"number"},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"geo_location_sources":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"MarkdownCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["markdown"]},"content":{"type":"string"},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["content","type"]},"MediaControlCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["media-control"]},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"PictureCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture"]},"image":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"PictureElementsCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-elements"]},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"elements":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StateBadgeElement"},{"$ref":"#/definitions/StateIconElement"},{"$ref":"#/definitions/StateLabelElement"},{"$ref":"#/definitions/IconElement"},{"$ref":"#/definitions/ImageElement"},{"$ref":"#/definitions/ConditionalElement"},{"$ref":"#/definitions/CustomElement"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["elements","type"]},"PictureEntityCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-entity"]},"entity":{"type":"string"},"name":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"show_name":{"type":"boolean"},"show_state":{"type":"boolean"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"PictureGlanceCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["picture-glance"]},"entities":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/EntityConfig"},{"type":"string"}]}},"title":{"type":"string"},"image":{"type":"string"},"camera_image":{"type":"string"},"camera_view":{"enum":["auto","live"],"type":"string"},"state_image":{"type":"object","properties":{}},"aspect_ratio":{"type":"string"},"entity":{"type":"string"},"tap_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"hold_action":{"anyOf":[{"$ref":"#/definitions/ToggleActionConfig"},{"$ref":"#/definitions/CallServiceActionConfig"},{"$ref":"#/definitions/NavigateActionConfig"},{"$ref":"#/definitions/MoreInfoActionConfig"},{"$ref":"#/definitions/NoActionConfig"}]},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entities","type"]},"PlantStatusCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["plant-status"]},"name":{"type":"string"},"entity":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"SensorCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["sensor"]},"entity":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"graph":{"type":"string"},"unit":{"type":"string"},"detail":{"type":"number"},"theme":{"type":"string"},"hours_to_show":{"type":"number"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"ShoppingListCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["shopping-list"]},"title":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["type"]},"StackCardConfig":{"type":"object","properties":{"type":{"enum":["horizontal-stack","vertical-stack"],"type":"string"},"cards":{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/IncludeTag"},{"$ref":"#/definitions/IncludeFolderTag"},{"$ref":"#/definitions/LovelaceCardConfig"}]}},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["cards","type"]},"ThermostatCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["thermostat"]},"entity":{"type":"string"},"theme":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"WeatherForecastCardConfig":{"type":"object","properties":{"type":{"type":"string","enum":["weather-forecast"]},"entity":{"type":"string"},"name":{"type":"string"},"id":{"type":"string"},"index":{"type":"number"},"view_index":{"type":"number"}},"additionalProperties":false,"required":["entity","type"]},"CustomCardConfig":{"additionalProperties":true,"type":"object","properties":{"type":{"pattern":"custom:(.*)$","type":"string"}},"required":["type"]}},"$schema":"http://json-schema.org/draft-07/schema#"} \ No newline at end of file diff --git a/src/server/schemas/mappings.json b/src/server/schemas/mappings.json deleted file mode 100644 index f00e2db638..0000000000 --- a/src/server/schemas/mappings.json +++ /dev/null @@ -1,72 +0,0 @@ -[ - { - "key": "homeassistant", - "path": "configuration.yaml", - "file": "homeassistant.json", - "tsFile": "homeassistant.ts", - "fromType": "HomeAssistantRoot" - }, - { - "key": "homeassistant-packages", - "path": "configuration.yaml/homeassistant/packages", - "file": "homeassistant-packages.json", - "tsFile": "homeassistant.ts", - "fromType": "HomeAssistantRoot" - }, - { - "key": "homeassistant-customize", - "path": "configuration.yaml/homeassistant/customize", - "file": "homeassistant-customize.json", - "tsFile": "homeassistant.ts", - "fromType": "CustomizeFile" - }, - { - "key": "homeassistant-scene", - "path": "configuration.yaml/scene", - "file": "homeassistant-scene.json", - "tsFile": "homeassistant.ts", - "fromType": "SceneComponentEntries" - }, - { - "key": "homeassistant-input-boolean", - "path": "configuration.yaml/input_boolean", - "file": "homeassistant-input-boolean.json", - "tsFile": "homeassistant.ts", - "fromType": "InputBooleanEntry" - }, - { - "key": "homeassistant-script", - "path": "configuration.yaml/script", - "file": "homeassistant-script.json", - "tsFile": "homeassistant.ts", - "fromType": "ScriptFile" - }, - { - "key": "automations", - "path": "configuration.yaml/automation", - "file": "automations.json", - "tsFile": "automation.ts", - "fromType": "AutomationsFile" - }, - { - "key": "ui-lovelace", - "path": "ui-lovelace.yaml", - "file": "ui-lovelace.json", - "tsFile": "ui-lovelace.ts", - "fromType": "LovelaceConfig" - }, - { - "key": "lovelace-views", - "path": "ui-lovelace.yaml/views", - "file": "lovelace-views.json", - "tsFile": "ui-lovelace.ts", - "fromType": "LovelaceViewConfigs" - }, - { - "key": "lovelace-cards", - "path": "ui-lovelace.yaml/views/cards", - "file": "lovelace-cards.json", - "tsFile": "ui-lovelace.ts", - "fromType": "LoveLaceCardFile" - } -] diff --git a/src/server/schemas/schemaService.ts b/src/server/schemas/schemaService.ts deleted file mode 100644 index 682047251b..0000000000 --- a/src/server/schemas/schemaService.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as path from "path"; -import * as fs from "fs"; -import { HaFileInfo } from "../haConfig/dto"; -import { JSONSchemaService, ISchemaContributions } from "yaml-language-server/out/server/src/languageservice/services/jsonSchemaService"; - -export class SchemaServiceForIncludes { - private schemaContributions: ISchemaContributions; - - constructor(private jsonSchemaService: JSONSchemaService) { } - - public onUpdate(haFiles: HaFileInfo[]) { - this.schemaContributions = this.getSchemaContributions(haFiles); - this.jsonSchemaService.clearExternalSchemas(); // otherwise it will stack the schemes in memory for every file change - this.jsonSchemaService.setSchemaContributions(this.schemaContributions); - } - - private getPathToSchemaFileMappings(): PathToSchemaMapping[] { - var jsonPath = path.join(__dirname, "mappings.json"); - var filecontents = fs.readFileSync(jsonPath, "utf-8"); - var pathToSchemaMappings: PathToSchemaMapping[] = JSON.parse(filecontents); - return pathToSchemaMappings; - } - - private getSchemaContributions(haFiles: HaFileInfo[]): ISchemaContributions { - var schemas = {}; - var schemaAssociations = {}; - var pathToSchemaFileMappings = this.getPathToSchemaFileMappings(); - - pathToSchemaFileMappings.forEach(pathToSchemaMapping => { - var jsonPath = path.join(__dirname, "json", pathToSchemaMapping.file); - var filecontents = fs.readFileSync(jsonPath, "utf-8"); - var schema = JSON.parse(filecontents); - schemas[`http://schemas.home-assistant.io/${pathToSchemaMapping.key}`] = schema; - }); - - for (var sourceFile in haFiles) { - var sourceFileMapping = haFiles[sourceFile]; - var relatedPathToSchemaMapping = pathToSchemaFileMappings.find(x => { - let sourceFileMappingPath = sourceFileMapping.path.replace("homeassistant/packages/", ""); - sourceFileMappingPath = sourceFileMappingPath.replace(/cards\/cards/g, "cards"); - var samePath = x.path === sourceFileMappingPath; - if (!samePath) { - return false; - } - return true; - }); - if (relatedPathToSchemaMapping) { - schemaAssociations[`**/${encodeURI(haFiles[sourceFile].filename)}`] = [`http://schemas.home-assistant.io/${relatedPathToSchemaMapping.key}`]; - } - } - return { - schemas: schemas, - schemaAssociations: schemaAssociations - }; - } -} - -export interface PathToSchemaMapping { - key: string; - path: string; - file: string; - tsFile: string; - fromType: string; -} \ No newline at end of file diff --git a/src/server/schemas/sensors.ts b/src/server/schemas/sensors.ts deleted file mode 100644 index 02d840bb57..0000000000 --- a/src/server/schemas/sensors.ts +++ /dev/null @@ -1,49 +0,0 @@ - -export type Sensors = MqttSensor | TemplateSensor | OtherSensor; - -/** - * @TJS-additionalProperties true - */ -export interface OtherSensor { - /** - * @TJS-pattern (^(?!.*(mqtt|template)).*)$ - */ - platform: string; -} - -export interface MqttSensor { - platform: "mqtt"; - state_topic: string; - name?: string; - qos?: number; - unit_of_measurement?: string; - icon?: string; - expire_after?: number; - value_template?: string; - force_update?: boolean; - availability_topic?: string; - payload_available?: string; - payload_not_available?: string; - json_attributes_topic?: string; - json_attributes?: string | string[]; - unique_id?: string; - device_class?: string; - device?: any; -} -export interface TemplateSensor { - platform: "template"; - sensors: { - [key: string]: TemplateSensorEntry; - }; -} - -export interface TemplateSensorEntry { - friendly_name?: string; - friendly_name_template?: string; - entity_id?: string | string[]; - unit_of_measurement?: string; - value_template?: string; - icon_template?: string; - entity_picture_template?: string; - device_class?: string; -} \ No newline at end of file diff --git a/src/server/schemas/ui-lovelace.ts b/src/server/schemas/ui-lovelace.ts deleted file mode 100644 index d65bc6603b..0000000000 --- a/src/server/schemas/ui-lovelace.ts +++ /dev/null @@ -1,478 +0,0 @@ -import { IncludeTag, IncludeFolderTag, IncludeTags } from "./homeassistant"; - -/* - -Types are copied from -https://github.com/home-assistant/home-assistant-polymer/blob/master/src/data/lovelace.ts - -Updated properties are marked with '//Updated' - -Types are serialized via 'npm run schema' using the 'typescript-json-schema' package -The generated schema (lovelace-ui.json) is also (committed) in this folder and - used as a 'yamlValidation' in the package.json - -*/ - - -/** - * @TJS-additionalProperties true - */ -export interface LovelaceConfig { - title?: string; - views: Array; - background?: string; - resources?: Array<{ type: "css" | "js" | "module" | "html"; url: string }> | IncludeTags; -} - - -export type LovelaceViewConfigs = LovelaceViewConfig | Array; - -/** - * @TJS-additionalProperties true - */ -export interface LovelaceViewConfig { - id?: string | number; //Updated - index?: number; - title?: string; - badges?: string[]; - cards?: Array; // updated - path?: string; - icon?: string; - theme?: string; - panel?: boolean; - background?: string; -} - -export type LoveLaceCardFile = LoveLaceCard | Array; - -export type LoveLaceCard = AlarmPanelCardConfig - | ConditionalCardConfig - | EmptyStateCardConfig - | EntitiesCardConfig - | EntityButtonCardConfig - | EntityFilterCardConfig - | ErrorCardConfig - | GaugeCardConfig - | GlanceCardConfig - | HistoryGraphConfig - | IframeCardConfig - | LightCardConfig - | MapCardConfig - | MarkdownCardConfig - | MediaControlCardConfig - | PictureCardConfig - | PictureElementsCardConfig - | PictureEntityCardConfig - | PictureGlanceCardConfig - | PlantStatusCardConfig - | SensorCardConfig - | ShoppingListCardConfig - | StackCardConfig - | ThermostatCardConfig - | WeatherForecastCardConfig - | CustomCardConfig; - -export interface LovelaceCardConfig { - id?: string; //Updated - index?: number; - view_index?: number; - type: string; - [key: string]: any; -} - -// updated -/** - * @TJS-additionalProperties true - */ -export interface CustomCardConfig { - /** - * @TJS-pattern custom:(.*)$ - */ - type: string; -} - -export interface ToggleActionConfig { - action: "toggle"; -} - -export interface CallServiceActionConfig { - action: "call-service"; - service: string; - service_data?: { - entity_id?: string | [string]; - [key: string]: any; - }; -} - -export interface NavigateActionConfig { - action: "navigate"; - navigation_path: string; -} - -export interface MoreInfoActionConfig { - action: "more-info"; -} - -export interface NoActionConfig { - action: "none"; -} - -export type ActionConfig = - | ToggleActionConfig - | CallServiceActionConfig - | NavigateActionConfig - | MoreInfoActionConfig - | NoActionConfig; - -export interface AlarmPanelCardConfig extends LovelaceCardConfig { - type: "alarm-panel"; //Updated - entity: string; - name?: string; - states?: string[]; -} - -export interface ConditionalCardConfig extends LovelaceCardConfig { - type: "conditional"; //Updated - card: LovelaceCardConfig; - conditions: Condition[]; -} - -export interface EmptyStateCardConfig extends LovelaceCardConfig { - content: string; - title?: string; -} - -export interface EntitiesCardEntityConfig extends EntityConfig { - type?: string; - secondary_info?: "entity-id" | "last-changed"; - format?: "relative" | "total" | "date" | "time" | "datetime"; -} - -export interface EntitiesCardConfig extends LovelaceCardConfig { - type: "entities"; //Updated - show_header_toggle?: boolean; - title?: string; - entities: Array; - theme?: string; -} - -export interface EntityButtonCardConfig extends LovelaceCardConfig { - type: "entity-button"; //Updated - entity: string; - name?: string; - show_name?: boolean; - icon?: string; - show_icon?: boolean; - theme?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; - icon_height?: string; -} - -export interface EntityFilterCardConfig extends LovelaceCardConfig { - type: "entity-filter"; //Updated - entities: Array; - state_filter: string[]; - card: Partial; - show_empty?: boolean; -} - -export interface ErrorCardConfig extends LovelaceCardConfig { - error: string; - origConfig: LovelaceCardConfig; -} - -export interface SeverityConfig { - green?: number; - yellow?: number; - red?: number; -} - -export interface GaugeCardConfig extends LovelaceCardConfig { - type: "gauge"; //Updated - entity: string; - name?: string; - unit?: string; - min?: number; - max?: number; - severity?: SeverityConfig; - theme?: string; -} - -export interface ConfigEntity extends EntityConfig { - tap_action?: ActionConfig; - hold_action?: ActionConfig; -} - -export interface GlanceCardConfig extends LovelaceCardConfig { - type: "glance"; //Updated - show_name?: boolean; - show_state?: boolean; - show_icon?: boolean; - title?: string; - theme?: string; - entities: ConfigEntity[]; - columns?: number; -} - -export interface IframeCardConfig extends LovelaceCardConfig { - type: "iframe"; //Updated - aspect_ratio?: string; - title?: string; - url: string; -} - -export interface LightCardConfig extends LovelaceCardConfig { - type: "light"; //Updated - entity: string; - name?: string; - theme?: string; -} - -export interface MapCardConfig extends LovelaceCardConfig { - type: "map"; //Updated - title?: string; - aspect_ratio?: string; - default_zoom?: number; - entities?: Array; - geo_location_sources?: string[]; -} - -export interface MarkdownCardConfig extends LovelaceCardConfig { - type: "markdown"; //Updated - content: string; - title?: string; -} - -export interface MediaControlCardConfig extends LovelaceCardConfig { - type: "media-control"; //Updated - entity: string; -} - -export interface PictureCardConfig extends LovelaceCardConfig { - type: "picture"; //Updated - image?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; -} - -export interface PictureElementsCardConfig extends LovelaceCardConfig { - type: "picture-elements"; //Updated - title?: string; - image?: string; - camera_image?: string; - state_image?: {}; - aspect_ratio?: string; - entity?: string; - elements: Elements; -} - -export interface PictureEntityCardConfig extends LovelaceCardConfig { - type: "picture-entity"; //Updated - entity: string; - name?: string; - image?: string; - camera_image?: string; - camera_view?: string; - state_image?: {}; - aspect_ratio?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; - show_name?: boolean; - show_state?: boolean; -} - -export interface PictureGlanceCardConfig extends LovelaceCardConfig { - type: "picture-glance"; //Updated - entities: Array; // Updated - title?: string; - image?: string; - camera_image?: string; - camera_view?: "live" | "auto"; //updated - state_image?: {}; - aspect_ratio?: string; - entity?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; -} - -export interface PlantStatusCardConfig extends LovelaceCardConfig { - type: "plant-status"; //Updated - name?: string; - entity: string; -} - -export interface SensorCardConfig extends LovelaceCardConfig { - type: "sensor"; //Updated - entity: string; - name?: string; - icon?: string; - graph?: string; - unit?: string; - detail?: number; - theme?: string; - hours_to_show?: number; -} - -//Updated -export interface HistoryGraphConfig extends LovelaceCardConfig { - type: "history-graph"; - entities: Array; - hours_to_show?: number; - title?: string; - refresh_interval?: number; -} -export interface ShoppingListCardConfig extends LovelaceCardConfig { - type: "shopping-list"; //Updated - title?: string; -} - -export interface StackCardConfig extends LovelaceCardConfig { - type: "vertical-stack" | "horizontal-stack"; //Updated - cards: Array; -} - -export interface ThermostatCardConfig extends LovelaceCardConfig { - type: "thermostat"; //Updated - entity: string; - theme?: string; - name?: string; -} - -export interface WeatherForecastCardConfig extends LovelaceCardConfig { - type: "weather-forecast"; //Updated - entity: string; - name?: string; -} - -export interface Condition { - entity: string; - state?: string; - state_not?: string; -} - -export interface EntityConfig { - entity: string; - type?: string; - name?: string; - icon?: string; -} - -// export interface LovelaceElementConfig { -// type: string; -// style: object; -// } - -export interface StateBadgeElement { - type: "state-badge"; - entity: EntityConfig | string; - style?: any; -} - -export interface StateIconElement { - type: "state-icon"; - entity: EntityConfig | string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; - style?: any; -} -export interface StateLabelElement { - type: "state-label"; - entity: EntityConfig | string; - prefix?: string; - suffix?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; - style?: any; -} -export interface IconElement { - type: "icon"; - icon: string; - entity?: EntityConfig | string; - title?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; - style?: any; -} -export interface ImageElement { - type: "image"; - entity?: EntityConfig | string; - image?: string; - camera_image?: string; - camera_view?: string; - state_image?: any; - filter?: string; - state_filter?: object; - aspect_ratio?: string; - tap_action?: ActionConfig; - hold_action?: ActionConfig; - style?: any; -} -export interface ConditionalElement { - type: "conditional"; - conditions: Array; - elements: Elements; -} - -/** - * @TJS-additionalProperties true - */ -export interface CustomElement { - - /** - * @TJS-pattern custom:(.*)$ - */ - type: string; - style: any; -} -export interface ElementCondition { - entity: EntityConfig | string; - state?: string; - state_not?: string; -} - -export type Elements = Array< - StateBadgeElement - | StateIconElement - | StateLabelElement - | IconElement - | ImageElement - | ConditionalElement - | CustomElement ->; - -export interface WebLinkEntityConfig { - type: "weblink"; - url: string; - name?: string; - icon?: string; -} -export interface CallServiceEntityConfig { - type: "call-service"; - name: string; - service: string; - icon?: string; - action_name?: string; - service_data?: { - entity_id?: string | [string]; - [key: string]: any; - }; -} -export interface DividerEntityConfig { - type: "divider"; - style?: any; -} -export interface SectionEntityConfig { - type: "section"; - label?: string; -} -/** - * @TJS-additionalProperties true - */ -export interface CustomEntityConfig { - /** - * @TJS-pattern custom:(.*)$ - */ - type: string; - label?: string; -} diff --git a/src/server/server.ts b/src/server/server.ts index 7597c053f0..73ee2a9f25 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,18 +1,18 @@ -import { createConnection, TextDocuments, ProposedFeatures, ServerCapabilities } from "vscode-languageserver"; -import { VsCodeFileAccessor } from "./fileAccessor"; -import { HomeAssistantLanguageService } from "./haLanguageService"; -import { HaConnection } from "./home-assistant/haConnection"; -import { JsonLanguageService } from "./jsonLanguageService"; -import { EntityIdCompletionContribution } from "./completionHelpers/entityIds"; -import { ConfigurationService } from "./configuration"; -import { ServicesCompletionContribution } from "./completionHelpers/services"; -import { IncludeDefinitionProvider } from "./definition/includes"; -import { ScriptDefinitionProvider } from "./definition/scripts"; -import { HomeAssistantConfiguration } from "./haConfig/haConfig"; +import { createConnection, TextDocuments, ProposedFeatures, ServerCapabilities, Diagnostic } from "vscode-languageserver"; import { JSONSchemaService } from "yaml-language-server/out/server/src/languageservice/services/jsonSchemaService"; import * as path from "path"; -import { YamlLanguageService } from "./yamlLanguageService"; -import { SchemaServiceForIncludes } from "./schemas/schemaService"; +import * as hals from "home-assistant-language-service"; +import { HaConnection } from "home-assistant-language-service/dist/home-assistant/haConnection"; +import { ConfigurationService } from "home-assistant-language-service/dist/configuration"; +import { HomeAssistantConfiguration } from "home-assistant-language-service/dist/haConfig/haConfig"; +import { JsonLanguageService } from "home-assistant-language-service/dist/jsonLanguageService"; +import { YamlLanguageService } from "home-assistant-language-service/dist/yamlLanguageService"; +import { SchemaServiceForIncludes } from "home-assistant-language-service/dist/schemas/schemaService"; +import { IncludeDefinitionProvider } from "home-assistant-language-service/dist/definition/includes"; +import { ScriptDefinitionProvider } from "home-assistant-language-service/dist/definition/scripts"; +import { EntityIdCompletionContribution } from "home-assistant-language-service/dist/completionHelpers/entityIds"; +import { ServicesCompletionContribution } from "home-assistant-language-service/dist/completionHelpers/services"; +import { VsCodeFileAccessor } from "./fileAccessor"; let connection = createConnection(ProposedFeatures.all); @@ -58,25 +58,53 @@ connection.onInitialize(async params => { let schemaServiceForIncludes = new SchemaServiceForIncludes(jsonSchemaService); - var homeAsisstantLanguageService = new HomeAssistantLanguageService( - documents, + var sendDiagnostics = async (uri: string, diagnostics: Diagnostic[]) => { + connection.sendDiagnostics({ + uri: uri, + diagnostics: diagnostics + }); + }; + + let discoverFilesAndUpdateSchemas = async () => { + try { + await haConfig.discoverFiles(); + await homeAsisstantLanguageService.findAndApplySchemas(); + } + catch (e) { + console.error(`Unexpected error during file discovery / schema configuration: ${e}`); + } + }; + + var homeAsisstantLanguageService = new hals.HomeAssistantLanguageService( yamlLanguageServiceWrapper, haConfig, haConnection, definitionProviders, - schemaServiceForIncludes + schemaServiceForIncludes, + sendDiagnostics, + async () => { + documents.all().forEach(async d => { + var diagnostics = await homeAsisstantLanguageService.getDiagnostics(d); + sendDiagnostics(d.uri, diagnostics); + }); + } ); - documents.onDidChangeContent((e) => homeAsisstantLanguageService.onDocumentChange(e, connection)); - documents.onDidOpen((e) => homeAsisstantLanguageService.onDocumentOpen(e, connection)); - documents.onDidSave((e) => homeAsisstantLanguageService.onDidSave(e, connection)); + documents.onDidChangeContent((e) => homeAsisstantLanguageService.onDocumentChange(e)); + documents.onDidOpen((e) => homeAsisstantLanguageService.onDocumentOpen(e)); - connection.onDocumentSymbol(homeAsisstantLanguageService.onDocumentSymbol); - connection.onDocumentFormatting(homeAsisstantLanguageService.onDocumentFormatting); - connection.onCompletion(homeAsisstantLanguageService.onCompletion); - connection.onCompletionResolve(homeAsisstantLanguageService.onCompletionResolve); - connection.onHover(homeAsisstantLanguageService.onHover); - connection.onDefinition(homeAsisstantLanguageService.onDefinition); + let onDidSaveDebounce: NodeJS.Timer; + documents.onDidSave((e) => { + clearTimeout(onDidSaveDebounce); + onDidSaveDebounce = setTimeout(discoverFilesAndUpdateSchemas, 100); + }); + + connection.onDocumentSymbol((p) => homeAsisstantLanguageService.onDocumentSymbol(documents.get(p.textDocument.uri))); + connection.onDocumentFormatting((p) => homeAsisstantLanguageService.onDocumentFormatting(documents.get(p.textDocument.uri), p.options)); + connection.onCompletion((p) => homeAsisstantLanguageService.onCompletion(documents.get(p.textDocument.uri), p.position)); + connection.onCompletionResolve((p) => homeAsisstantLanguageService.onCompletionResolve(p)); + connection.onHover((p) => homeAsisstantLanguageService.onHover(documents.get(p.textDocument.uri), p.position)); + connection.onDefinition((p) => homeAsisstantLanguageService.onDefinition(documents.get(p.textDocument.uri), p.position)); connection.onDidChangeConfiguration(async (config) => { configurationService.updateConfiguration(config); @@ -88,15 +116,7 @@ connection.onInitialize(async params => { }); //fire and forget - setTimeout(async () => { - try { - await haConfig.discoverFiles(); - await homeAsisstantLanguageService.findAndApplySchemas(connection); - } - catch (e) { - console.error(`Unexpected error during initial configuration discover: ${e}`); - } - }, 0); + setTimeout(discoverFilesAndUpdateSchemas, 0); return { capabilities: { diff --git a/src/server/yamlLanguageService.ts b/src/server/yamlLanguageService.ts deleted file mode 100644 index 06ebf4a126..0000000000 --- a/src/server/yamlLanguageService.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { YAMLDocumentSymbols } from "yaml-language-server/out/server/src/languageservice/services/documentSymbols"; -import { JSONSchemaService } from "yaml-language-server/out/server/src/languageservice/services/jsonSchemaService"; -import { YAMLCompletion } from "yaml-language-server/out/server/src/languageservice/services/yamlCompletion"; -import { YAMLHover } from "yaml-language-server/out/server/src/languageservice/services/yamlHover"; -import { YAMLValidation } from "yaml-language-server/out/server/src/languageservice/services/yamlValidation"; -import { YAMLFormatter } from "yaml-language-server/out/server/src/languageservice/services/yamlFormatter"; -import { TextDocument, TextEdit, Diagnostic } from "vscode-languageserver-types"; -import { JSONWorkerContribution, SymbolInformation, Hover, CompletionItem, CompletionList } from "vscode-json-languageservice"; -import { Includetype } from "./haConfig/dto"; -import { LanguageSettings } from "yaml-language-server/out/server/src/languageservice/yamlLanguageService"; -import { JsonLanguageService } from "./jsonLanguageService"; - - -export class YamlLanguageService { - - private yamlValidation: YAMLValidation; - private yamlDocumentSymbols: YAMLDocumentSymbols; - private yamlCompletion: YAMLCompletion; - private yamlHover: YAMLHover; - private yamlFormatter: YAMLFormatter; - - constructor(jsonSchemaService: JSONSchemaService, jsonLanguageService: JsonLanguageService, completionContributions: JSONWorkerContribution[]) { - - var languageSettings = { - validate: true, - customTags: this.getValidYamlTags(), - completion: true, - format: true, - hover: true, - isKubernetes: false - }; - - this.yamlValidation = new YAMLValidation(Promise, jsonLanguageService); - this.yamlDocumentSymbols = new YAMLDocumentSymbols(jsonLanguageService); - this.yamlCompletion = new YAMLCompletion(jsonSchemaService, completionContributions); - this.yamlHover = new YAMLHover(Promise, jsonLanguageService); - this.yamlFormatter = new YAMLFormatter(); - - this.yamlValidation.configure(languageSettings); - // enables auto completion suggestions for tags like !include () - // commeted because they end up at the top of the list which does not look nice :-) - // this.yamlCompletion.configure(languageSettings, languageSettings.customTags); - this.yamlHover.configure(languageSettings); - this.yamlFormatter.configure(languageSettings); - } - - public async doValidation(document: TextDocument): Promise { - return await this.yamlValidation.doValidation(document); - } - - public findDocumentSymbols(document: TextDocument): SymbolInformation[] { - return this.yamlDocumentSymbols.findDocumentSymbols(document); - } - - public doComplete = async (textDocument: TextDocument, position: any): Promise => { - return await this.yamlCompletion.doComplete(textDocument, position, false); - } - - public doResolve(completionItem: any): Thenable { - return this.yamlCompletion.doResolve(completionItem); - } - - public doHover(document: TextDocument, position: any): Thenable { - return this.yamlHover.doHover(document, position); - } - - public format = (document: TextDocument, options: any): TextEdit[] => { - return this.yamlFormatter.format(document, options); - } - - private getValidYamlTags(): string[] { - var validTags: string[] = []; - for (let item in Includetype) { - if (isNaN(Number(item))) { - validTags.push(`!${item} scalar`); - } - } - validTags.push("!secret scalar"); - return validTags; - } -} \ No newline at end of file