Add code to mock API for demo on home-assistant.io

This commit is contained in:
Paulus Schoutsen 2014-12-21 15:07:01 -08:00
parent e3961b7532
commit 249d4d7062
3 changed files with 13 additions and 3 deletions

View file

@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "0492fc0ecdb4c78626038490eb76b3e1"
VERSION = "43a1e2517105b676c05bb1b8dce357b3"

File diff suppressed because one or more lines are too long

View file

@ -279,8 +279,18 @@
},
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();
req.open(method, "/api/" + path, true);
req.open(method, url, true);
req.setRequestHeader("X-HA-access", this.auth);
req.onreadystatechange = function() {