Add code to mock API for demo on home-assistant.io
This commit is contained in:
parent
e3961b7532
commit
249d4d7062
3 changed files with 13 additions and 3 deletions
|
@ -1,2 +1,2 @@
|
||||||
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
||||||
VERSION = "0492fc0ecdb4c78626038490eb76b3e1"
|
VERSION = "43a1e2517105b676c05bb1b8dce357b3"
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -279,8 +279,18 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
call_api: function(method, path, parameters, onSuccess, onError) {
|
call_api: function(method, path, parameters, onSuccess, onError) {
|
||||||
|
var url = "/api/" + path;
|
||||||
|
|
||||||
|
// set to true to generate a frontend to be used as demo on the website
|
||||||
|
if (false) {
|
||||||
|
if (path === "states" || path === "services" || path === "events") {
|
||||||
|
url = "/demo/" + path + ".json";
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
req.open(method, "/api/" + path, true);
|
req.open(method, url, true);
|
||||||
req.setRequestHeader("X-HA-access", this.auth);
|
req.setRequestHeader("X-HA-access", this.auth);
|
||||||
|
|
||||||
req.onreadystatechange = function() {
|
req.onreadystatechange = function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue