1
0
Fork 0
BangleApps/apps/ha/trigger.html

39 lines
1.2 KiB
HTML

<html>
<head>
<link rel="stylesheet" href="../../css/spectre.min.css">
</head>
<body>
<h3>Upload Tiggers</h3>
<p>You must upload a list of json objects -- an example is given below</p>
<p><textarea id="triggers">
[
{"display": "Open", "trigger": "OPEN_DOOR", "icon":"door"},
{"display": "Office", "trigger": "TOGGLE_LIGHT", "icon":"light"},
{"display": "Living Room", "trigger": "OVEN", "icon":"fire"}
]
</textarea></p>
<p><button id="upload" class="btn btn-primary">Upload</button></p>
<script src="../../core/lib/customize.js"></script>
<script>
// When the 'upload' button is clicked...
document.getElementById("upload").addEventListener("click", function() {
// get the text to add
var text = document.getElementById("triggers").value;
console.log(text);
// build the app's text using a templated String
var app = text;
// send finished app (in addition to contents of app.json)
sendCustomizedApp({
storage:[
{name:"ha.trigger.json", url:"ha.trigger.json", content:app},
]
});
console.log("Sent ha.trigger.json!");
});
</script>
</body>
</html>