Mercurial > code > home > repos > homeauto
comparison service/mqtt_graph_bridge/index.html @ 1496:e2d5290bef22
tester page that can PUT some statements
Ignore-this: 238b55764b2f4f59a21a7e7907e7039a
darcs-hash:c38f9eaddc08f0e6c773840e2e8ebf77d535156f
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Fri, 31 Jan 2020 23:55:04 -0800 |
parents | 928b1833de0f |
children |
comparison
equal
deleted
inserted
replaced
1495:690226a7dddb | 1496:e2d5290bef22 |
---|---|
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title></title> | 4 <title>mqtt_graph_bridge</title> |
5 <meta charset="utf-8" /> | 5 <meta charset="utf-8"> |
6 <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents.min.js"></script> | |
7 <script src="/lib/require/require-2.3.3.js"></script> | |
8 <script src="/rdf/common_paths_and_ns.js"></script> | |
9 | |
10 <link rel="stylesheet" href="/rdf/browse/style.css"> | |
11 | |
6 </head> | 12 </head> |
7 <body> | 13 <body class="rdfBrowsePage"> |
8 mqtt_graph_bridge | 14 mqtt_graph_bridge |
15 | |
16 | |
17 <p>Send demo statements to bridge:</p> | |
18 <div><button data-post="output?s=:kitchenLight&p=:brightness" data-body="0.0">Send (:kitchenLight :brightness 0.0)</button></div> | |
19 <div><button data-post="output?s=:kitchenLight&p=:brightness" data-body="1.0">Send (:kitchenLight :brightness 1.0)</button></div> | |
20 <div><button data-post="output?s=:livingLampShelf&p=:brightness" data-body="0.0">Send (:livingLampShelf :brightness 0.0)</button></div> | |
21 <div><button data-post="output?s=:livingLampShelf&p=:brightness" data-body="1.0">Send (:livingLampShelf :brightness 1.0)</button></div> | |
22 | |
23 <script> | |
24 Array.from(document.querySelectorAll("button")).forEach((el) => { | |
25 el.addEventListener("click", (ev) => { | |
26 fetch(el.dataset.post, { | |
27 method: "PUT", | |
28 body: el.dataset.body | |
29 }); | |
30 }); | |
31 }); | |
32 </script> | |
33 | |
9 </body> | 34 </body> |
10 </html> | 35 </html> |