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>
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <link rel="shortcut icon" href="/favicon.ico" />
- <link rel="apple-touch-icon" href="images/touch-icon-iphone.png">
- <link href='http://fonts.googleapis.com/css?family=Arimo' rel='stylesheet' type='text/css'>
- <link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css'>
- <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
- <style>
- body,html{
- height: 100%;
- margin: 0;
- padding: 0;
- background-color: black;
- }
- div#cnt {
- width: 990px;
- height: 100%;
- margin: 0 auto;
- text-align: center;
- }
- .v-wrap{
- height: 100%;
- white-space: nowrap;
- text-align: center;
- }
- .v-wrap:before {
- content: "";
- display: inline-block;
- vertical-align: middle;
- width: 0;
- margin-right: -.25em;
- height: 100%;
- }
- .v-box{
- display: inline-block;
- vertical-align: middle;
- white-space: normal;
- }
- img{
- border:1px solid #;
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- }
- a, a:visited { text-decoration: none; color: #336699; }
- a:hover { text-decoration: none; color: #003366; }
- #frame {
- float: left;
- margin: 0px;
- padding: 0px 4px 4px 4px;
- }
- #desc_cell1, #desc_cell2, #desc_cell3, #desc_cell4,
- #desc_cell5, #desc_cell6, #desc_cell7, #desc_cell9,
- #desc_cell10, #desc_cell11, #desc_cell12, #desc_cell13, #desc_cell14,
- #desc_cell15, #desc_cell16, #desc_cell17, #desc_cell18 {
- font-family: Arimo;
- font-weight: normal;
- color: #ABACB0; //kleur van item beschrijving
- font-size: 17px;
- margin-top: -19px;
- height: 25px;
- line-height: 10px;
- }
- #cell1, #cell2, #cell3, #cell4, #cell5,
- #cell6, #cell7, #cell9, #cell10, #cell11, #cell12,
- #cell13, #cell14, #cell15, #cell16, #cell17, #cell18 {
- font-family: 'Open Sans', sans-serif;
- font-weight: bold;
- width: 162px;
- padding: 10px;
- border: 1px solid #333;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
- background-color: #070707;
- height: 84px;
- line-height: 75px;
- font-size: 50px;
- color: white; //Kleur waardes van cellen
- }
- #cell6, #cell7, #cell2, #cell9, #cell10, #cell11,
- #cell12, #cell13, #cell14, #cell15, #cell16,
- #cell17, #cell18 {
- height: 84px;
- line-height: 70px;
- color: white;
- }
- #cell2 {
- width: 569px;
- line-height: 62px;
- font-size: 90px;
- color: #2980B9;
- }
- #cell8 {
- width: 589px;
- border: 1px solid black;
- height: 216px;
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- }
- #cell11, #cell16 {
- width: 185px;
- }
- #all {
- margin-left: -35px;
- margin-top: 5px;
- width: 1050px;height: 570px;
- }
- #fade{
- display: none;
- position: fixed;
- top: 0%;
- left: 0%;
- width: 100%;
- height: 100%;
- background-color: #000;
- z-index:1001;
- -moz-opacity: 0.7;
- opacity:.70;
- filter: alpha(opacity=70);
- }
- #light{
- display: none;
- position: absolute;
- top: 50%;
- left: 50%;
- width: 300px;
- height: 75px;
- margin-left: -150px;
- margin-top: -100px;
- padding: 10px;
- border: 2px solid red;
- background: #333;
- z-index:1002;
- overflow:visible;
- font-family: 'Open Sans', sans-serif;
- font-weight: bold;
- font-size: 25px;
- color: white;
- line-height: 75px;
- text-align: center;
- -webkit-border-radius: 15px 15px 15px 15px;
- border-radius: 15px 15px 15px 15px;
- }
- .camera {
- background: url(offline.jpg) no-repeat;
- -moz-opacity: 0.7;
- opacity:.70;
- filter: alpha(opacity=70);
- background-size: 292px 216px;
- width: 292px;
- height: 216px;
- }
- </style>
- </head>
- <body>
- <div id="cnt" class="v-wrap">
- <div class="v-box">
- <div>
- <div id="frame">
- <div id="cell1">--</div><div id="desc_cell1">cell1</div>
- </div>
- <div id="frame">
- <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>
- <div>
- <div id="frame">
- <div id="cell4">--</div><div id="desc_cell4">cell4</div>
- <div id="cell6">--</div><div id="desc_cell6">cell6</div>
- </div>
- <div id="frame">
- <div id="cell8">
- <img src="http://10.0.0.60/camsnapshot.jpg?idx=1&t=" height="216px" width="292px" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 100)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' class='camera' />
- <img src="http://www3.buienradar.nl/images.aspx?jaar=-3&soort=sb&t=" height="216px" width="292px" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 15000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' class='camera' />
- </div>
- </div>
- <div id="frame">
- <div id="cell5">--</div><div id="desc_cell5">cell5</div>
- <div id="cell7">--</div><div id="desc_cell7">cell7</div>
- </div>
- </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 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>
- <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 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>
- </div>
- </div>
- <div id="light">Schakelaar is beveiligd</div>
- <div id="fade" onClick="lightbox_close();"></div>
- <script type="text/javascript" charset="utf-8">
- function lightbox_open(){
- window.scrollTo(0,0);
- $('#light').fadeIn('fast');
- $('#fade').fadeIn('fast');
- return setTimeout(function() {
- // run close function on completion of timeout0-9p
- lightbox_close();
- }, 2000);
- }
- function lightbox_close(){
- $('#light').fadeOut('fast');
- $('#fade').fadeOut('fast');
- }
- 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");
- vdata=new String(vdata).replace("true","protected");
- //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);
- }
- }
- //If IDX matches '48' (Electricity today) or '49' (Gas today), then round the numbers with 1 decimal
- if(item.idx == '48' || item.idx == '49'){
- vdata=new String(vdata).split("kWh",1)[0];
- vdata=new String(vdata).split("m3",1)[0];
- vdata=Math.round(vdata * 10) / 10;
- }
- //If IDX matches '380' (Water) covert m3 to liters
- if(item.idx == '380'){
- vdata=new String(vdata).split("m3",1)[0];
- vdata=Math.round(vdata * 1000);
- }
- // 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. Apply background when switch is not protected.
- alarmcss='';
- if (item.Protected == true) {
- if (vdata == 'On') {
- alarmcss=';color:#1B9772;';
- vdata = 'Aan';
- }
- if (vdata == 'Off') {
- alarmcss=';color:#E24E2A;';
- vdata = 'Uit';
- }
- } else {
- if (vdata == 'On') {
- alarmcss=';color:#1B9772;background-color:#171717;';
- vdata = 'Aan';
- }
- if (vdata == 'Off') {
- alarmcss=';color:#E24E2A;;background-color:#171717;';
- vdata = 'Uit';
- }
- }
- // if extra css attributes. Make switch not switchable when it is protected.
- if (typeof vattr == 'undefined') {
- if (item.Protected == true) {
- $('#'+vlabel).html('<div onClick="lightbox_open();" style='+alarmcss+'>'+vdata+'</div>');
- } else {
- $('#'+vlabel).html('<div '+switchclick+' style='+alarmcss+'>'+vdata+'</div>');
- }
- }
- if (item.Protected == true) {
- $('#'+vlabel).html( '<div onClick="lightbox_open();" style='+vattr+alarmcss+'>'+vdata+'</div>');
- } else {
- $('#'+vlabel).html( '<div '+switchclick+' style='+vattr+alarmcss+'>'+vdata+'</div>');
- }
- $('#desc_'+vlabel).html(vdesc);
- }
- }
- });
- }
- });
- $.refreshTimer = setInterval(RefreshData, 4000);
- }
- // ############################################################################################################
- // #### vvvvv USER VALUES below vvvvv #######
- // ############################################################################################################
- $(document).ready(function() {
- $.roomplan=9; // define roomplan in Domoticz and create items below.
- $.domoticzurl="http://10.0.0.60";
- //format: idx, value, label, description, [override css], [alarm value]
- $.PageArray = [
- ['49', 'CounterToday', 'cell1', 'Gas Vandaag (m3)',],
- ['60', 'Temp', 'cell2', 'Woonkamer (°C)'],
- ['48', 'CounterToday', 'cell3', 'Electra Vandaag (kWh)',],
- ['380', 'CounterToday', 'cell4', 'Water Vandaag (l)',],
- ['48', 'Usage', 'cell5', 'Huidig Verbruik (W)',],
- ['249', 'Status', 'cell6', 'Alarm Systeem',],
- ['629', 'Status', 'cell7', 'Iemand Aanwezig ?'],
- ['503', 'Temp', 'cell9', 'Garage (°C)'],
- ['30', 'Status', 'cell10', 'Woonkamer Verlichting',],
- ['621', 'Status', 'cell11', 'Woonkamer Sfeer',],
- ['624', 'Status', 'cell12', 'Verlichting Eethoek Wit',],
- ['387', 'Temp', 'cell13', 'Badkamer (°C)'],
- ['207', 'Temp', 'cell14', 'Buiten (°C)'],
- ['622', 'Data', 'cell15', 'Woonkamer Normaal',],
- ['628', 'Data', 'cell16', 'Woonkamer Fel',],
- ['7', 'Status', 'cell17', 'Verlichting Overkapping',],
- ['504', 'Temp', 'cell18', 'Slaapkamer (°C)'],
- ];
- // ###########################################################################################################
- // #### ^^^^^ 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