Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Domoticz Monitor</title>
- <link href='http://fonts.googleapis.com/css?family=Arimo' rel='stylesheet' type='text/css'>
- <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
- <style>
- div#cnt {
- width: 990px;
- margin: 0 auto;
- text-align: center;
- }
- a, a:visited { text-decoration: none; color: #336699; }
- a:hover { text-decoration: none; color: #003366; }
- #frame {
- float: left;
- margin: 0px;
- padding: 0px 2px 0px 2px;
- }
- #desc_cell1, #desc_cell2, #desc_cell3, #desc_cell4,
- #desc_cell5, #desc_cell6, #desc_cell7, #desc_cell8, #desc_cell9,
- #desc_cell10, #desc_cell11, #desc_cell12, #desc_cell13, #desc_cell14,
- #desc_cell15, #desc_cell16, #desc_cell17, #desc_cell18, #desc_cell19,
- #desc_cell20, #desc_cell21, #desc_cell22, #desc_cell23, #desc_cell24
- {
- font-family: Arimo;
- font-weight: normal;
- color: #ABACB0; //kleur van item beschrijving
- font-size: 17px;
- margin-top: -20px;
- height: 25px;
- line-height: 10px;
- }
- #cell3 {
- font-family: Arimo, serif;
- font-weight: bold;
- width: 570px;
- padding: 5px;
- border: 1px solid #666;
- height: 217px;
- line-height: 210px;
- font-size: 180px;
- color: #2980B9;
- margin: 0px ;
- }
- #cell1, #cell2, #cell4, #cell5,
- #cell6, #cell7, #cell8, #cell9, #cell10,
- #cell11, #cell12, #cell13, #cell14, #cell15,
- #cell16, #cell17, #cell18, #cell19
- {
- font-family: Arimo, serif;
- font-weight: bold;
- width: 162px;
- padding: 10px;
- border: 1px solid #666;
- height: 90px;
- line-height: 75px;
- font-size: 50px;
- color: white; //Kleur waardes van cellen
- font-size:40px;
- }
- #cell20
- {
- font-family: Arimo, serif;
- font-weight: bold;
- width: 162px;
- padding: 10px;
- border: 1px solid #666;
- height: 90px;
- line-height: 75px;
- font-size: 50px;
- color: white; //Kleur waardes van cellen
- font-size:30px;
- }
- #cell6, #cell7, #cell8, #cell9, #cell10,
- #cell11, #cell12, #cell13, #cell14, #cell15,
- #cell16, #cell17, #cell18, #cell19, #cell20,
- #cell21, #cell22, #cell23 {
- height: 65px;
- line-height: 55px;
- color: white;
- }
- #cell8, #cell13, #cell18 {
- width: 184px;
- }
- #cell22 {
- width: 560px;
- font-size: 40px;
- line-height: 55px;
- }
- #all {
- margin-left: -35px;
- margin-top: 5px;
- width: 1050px;height: 570px;
- }
- </style>
- </head>
- <body bgcolor="#000">
- <div id="cnt">
- <div>
- <div id="frame">
- <div id="cell1">--</div><div id="desc_cell1">cell1</div>
- <div id="cell2">--</div><div id="desc_cell2">cell2</div>
- </div>
- <div id="frame">
- <div id="cell3">--</div><div id="desc_cell3"">cell3</div>
- </div>
- <div id="frame">
- <div id="cell4">--</div><div id="desc_cell4">cell4</div>
- <div id="cell5">--</div><div id="desc_cell5">cell5</div>
- </div>
- </div>
- <div>
- <div id="frame">
- <div id="cell6">--</div><div id="desc_cell6">cell6</div>
- </div>
- <div id="frame">
- <div id="cell7">--</div><div id="desc_cell7">cell7</div>
- </div>
- <div id="frame">
- <div id="cell8">--</div><div id="desc_cell8">cell8</div>
- </div>
- <div id="frame">
- <div id="cell9">--</div><div id="desc_cell9">cell9</div>
- </div>
- <div id="frame">
- <div id="cell10">--</div><div id="desc_cell10">cell10</div>
- </div>
- </div>
- <div>
- <div id="frame">
- <div id="cell11">--</div><div id="desc_cell11">cell11</div>
- </div>
- <div id="frame">
- <div id="cell12">--</div><div id="desc_cell12">cell12</div>
- </div>
- <div id="frame">
- <div id="cell13">--</div><div id="desc_cell13">cell13</div>
- </div>
- <div id="frame">
- <div id="cell14">--</div><div id="desc_cell14">cell14</div>
- </div>
- <div id="frame">
- <div id="cell15">--</div><div id="desc_cell15">cell15</div>
- </div>
- </div>
- <div>
- <div id="frame">
- <div id="cell16">--</div><div id="desc_cell16">cell16</div>
- </div>
- <div id="frame">
- <div id="cell17">--</div><div id="desc_cell17">cell17</div>
- </div>
- <div id="frame">
- <div id="cell18">--</div><div id="desc_cell18">cell18</div>
- </div>
- <div id="frame">
- <div id="cell19">--</div><div id="desc_cell19">cell19</div>
- </div>
- <div id="frame">
- <div id="cell20">--</div><div id="desc_cell20">cell20</div>
- </div>
- </div>
- </div>
- <script type="text/javascript" charset="utf-8">
- function RefreshData()
- {
- clearInterval($.refreshTimer);
- var jurl=$.domoticzurl+"/json.htm?type=devices&plan="+$.roomplan+"&jsoncallback=?";
- $.getJSON(jurl,
- {
- format: "json"
- },
- function(data) {
- if (typeof data.result != 'undefined') {
- $.each(data.result, function(i,item){
- for( var ii = 0, len = $.PageArray.length; ii < len; ii++ ) {
- if( $.PageArray[ii][0] === item.idx ) { // Domoticz idx number
- var vtype= $.PageArray[ii][1]; // Domotitcz type (like Temp, Humidity)
- var vlabel= $.PageArray[ii][2]; // cell number from HTML layout
- var vdesc= $.PageArray[ii][3]; // description
- var vattr= $.PageArray[ii][4]; // extra css attributes
- var valarm= $.PageArray[ii][5]; // alarm value to turn text to red
- var vdata= item[vtype]; // current value
- if (typeof vdata == 'undefined') {
- vdata="??";
- } else {
- // remove too much text
- vdata=new String(vdata).split("Watt",1)[0];
- vdata=new String(vdata).split("kWh",1)[0];
- vdata=new String(vdata).split("m3",1)[0];
- vdata=new String(vdata).split(" Level:",1)[0];
- vdata=new String(vdata).replace("Set","On");
- //If IDX matches '1' (RAM usage) or '5' (CPU usage), then strip off the '%' and round the numbers
- if(item.idx == '1' || item.idx == '5'){
- vdata=new String(vdata).split("%",1)[0];
- vdata=Math.round(vdata);
- }
- }
- // create switchable value when item is switch
- switchclick='';
- if (vdata == 'Off' ) {
- switchclick = 'onclick="SwitchToggle('+item.idx+', \'On\');"';
- }
- if (vdata == 'On' ) {
- switchclick = 'onclick="SwitchToggle('+item.idx+', \'Off\');"';
- }
- // if alarm threshold is defined, make value red
- //alarmcss='';
- //if (typeof valarm != 'undefined') {
- // if ( eval(vdata + valarm)) { // note orig: vdata > alarm
- // alarmcss=';color:red;';
- // }
- //}
- // if switch is on, make green, if off, make red
- alarmcss='';
- if (vdata == 'On') { // note orig: vdata > alarm
- alarmcss=';color:#1B9772;';
- vdata = 'Aan';
- }
- if (vdata == 'Off') { // note orig: vdata > alarm
- alarmcss=';color:#E24E2A;';
- vdata = 'Uit';
- }
- // if extra css attributes
- if (typeof vattr == 'undefined') {
- $('#'+vlabel).html('<div '+switchclick+' style='+alarmcss+'>'+vdata+'</div>');
- } else {
- $('#'+vlabel).html( '<div '+switchclick+' style='+vattr+alarmcss+'>'+vdata+'</div>');
- }
- $('#desc_'+vlabel).html(vdesc);
- }
- }
- });
- }
- });
- $.refreshTimer = setInterval(RefreshData, 8000);
- }
- // ############################################################################################################
- // #### vvvvv USER VALUES below vvvvv #######
- // ############################################################################################################
- $(document).ready(function() {
- $.roomplan=5; // define roomplan in Domoticz and create items below.
- $.domoticzurl="http://192.168.4.15:8080";
- //format: idx, value, label, description, [override css], [alarm value]
- $.PageArray = [
- ['82', 'Temp', 'cell1', 'Aanvoer CV (°C)'],
- ['83', 'Temp', 'cell2', 'Retour CV (°C)'],
- ['84', 'Temp', 'cell3', 'Woonkamer (°C)'],
- ['33', 'CounterToday', 'cell4', 'Electra vandaag (kWh)',],
- ['34', 'CounterToday', 'cell5', 'Gas vandaag (m<sup>3</sup>)',],
- ['68', 'Status', 'cell6', 'CV-ketel',],
- ['6', 'Status', 'cell7', 'Keuken',],
- ['7', 'Status', 'cell8', 'Booglamp'],
- ['8', 'Status', 'cell9', 'LED-strip TV + Kast'],
- ['33', 'Usage', 'cell10', 'Huidig verbruik (W)',],
- ['87', 'Temp', 'cell11', 'Buitentemperatuur (°C)'],
- ['888', 'Data', 'cell12', 'RAM gebruik Pi (%)'],
- ['25', 'Status', 'cell13', 'Lampje Expedit'],
- ['63', 'Status', 'cell14', 'Lampje TV-meubel'],
- ['5', 'Data', 'cell15', 'CPU Gebruik Pi (%)'],
- ['87', 'Humidity', 'cell16', 'Luchtv. buiten (%)'],
- ['85', 'Status', 'cell17', 'Schemer'],
- ['87', 'ForecastStr', 'cell18', 'Voorspelling'],
- ['64', 'Status', 'cell19', 'Eettafel'],
- ['1', 'Data', 'cell20', 'RAM gebruik Pi (%)'],
- ];
- // ############################################################################################################
- // #### ^^^^^ USER VALUES above ^^^^^ #######
- // ############################################################################################################
- RefreshData();
- });
- function SwitchToggle(idx, switchcmd)
- {
- console.log('function called');
- $.ajax({
- url: "json.htm?type=command¶m=switchlight" + "&idx=" + idx + "&switchcmd=" + switchcmd + "&level=0",
- async: false,
- dataType: 'json',
- success: function(){
- console.log('SUCCES');
- },
- error: function(){
- console.log('ERROR');
- }
- });
- RefreshData();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement