Pre-release demo version
[ampy.git] / html / index.php
1 <!DOCTYPE html>
2 <meta charset="UTF-8">
3 <link rel="shortcut icon" href="favicon.svg">
4 <title>ampy - Le compteur espion qui ne moucharde pas</title>
5 <script src='/javascript/jquery/jquery.js'></script>
6 <script>
7 function refresh_power() {
8         $.ajax({
9                 url : 'currentjson.php',
10                 success : function(result) {
11                         document.getElementById('currentpower').innerHTML = result['watts'].toFixed(1);
12                         document.getElementById('totalpower').innerHTML = result['counter'].toFixed(5);
13                 },
14                 complete : function() {
15                         setTimeout(refresh_power, 1000);
16                 }
17         });
18 }
19 function refresh_graph(hours=0, minutes=0) {
20         img = document.getElementById('loadcurve');
21         img.src = 'graph.php?h='+hours+'&m='+minutes+'&t='+new Date().getTime();
22 }
23 </script>
24
25 Puissance instantannĂ©e: <span id=currentpower>unknown</span> watts
26 <script>refresh_power();</script>
27
28 -
29
30 Compteur: <span id=totalpower>unknown</span> kWh
31
32 -
33
34 Graphique:
35 <a href='javascript:refresh_graph(0,5)'>5m</a> 
36 <a href='javascript:refresh_graph(0,30)'>30m</a> 
37 <a href='javascript:refresh_graph(1)'>1h</a> 
38 <a href='javascript:refresh_graph(2)'>2h</a>
39 <a href='javascript:refresh_graph(6)'>6h</a>
40 <a href='javascript:refresh_graph(12)'>12h</a>
41 <a href='javascript:refresh_graph(24)'>1d</a>
42 <a href='javascript:refresh_graph(2*24)'>2d</a>
43 <a href='javascript:refresh_graph(7*24)'>7d</a>
44 <a href='javascript:refresh_graph(30*24)'>30d</a>
45
46 <br>
47
48 <img id='loadcurve' src='graph.php'>