Subversion Repositories HomeAutomation

Rev

Rev 2051 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2051 Rev 2054
Line 1... Line 1...
1
<?php
1
<?php
2
$aliasesDimmer = array("TakSovrum", "bardisk", "bardisk_tak", "bardisk_tv");
2
$aliasesDimmer = array("TakSovrum", "bardisk", "bardisk_tak", "bardisk_tv","Power", "PowerBRF");
3
$aliasesPower = array("Power", "PowerBRF");
3
$aliasesPower = array("Power", "PowerBRF");
4
 
4
 
5
require 'atom_interface.php';
5
require 'atom_interface.php';
6
require 'getSetData.php';
6
require 'getSetData.php';
7
 
7
 
Line 31... Line 31...
31
}
31
}
32
else if (isset($_GET["getdata"]))
32
else if (isset($_GET["getdata"]))
33
{
33
{
34
  foreach ($aliasesDimmer as $alias)
34
  foreach ($aliasesDimmer as $alias)
35
  {
35
  {
36
    $response[$alias] = GetLastData($alias);
36
    $responseData = GetLastData($alias);
-
 
37
 
-
 
38
    foreach ($responseData as $name => $value)
-
 
39
    {
-
 
40
      $response[$name] = $value;
-
 
41
    }
37
  }
42
  }
38
 
43
 
39
  echo json_encode($response);
44
  echo json_encode($response);
40
  exit(0);
45
  exit(0);
41
}
46
}
Line 57... Line 62...
57
//  <script src="jquery.mobile-1.0b1.min.js"></script> 
62
//  <script src="jquery.mobile-1.0b1.min.js"></script> 
58
?>
63
?>
59
  <script>
64
  <script>
60
 
65
 
61
    $(document).bind("pagecreate", function(event, ui)
66
    $(document).bind("pagecreate", function(event, ui)
62
    {
67
    {
63
      <?
68
      <?
64
      foreach ($aliasesDimmer as $alias)
69
      foreach ($aliasesDimmer as $alias)
65
      {
70
      {
66
      ?>
71
      ?>
67
        $('#slider<?=$alias?>' ).bind('change', function(event, ui){ makeAjaxChange("<?=$alias?>"); });
72
        $('#slider<?=$alias?>' ).bind('change', function(event, ui){ makeAjaxChange("<?=$alias?>"); });
68
      <?
73
      <?
69
      }
74
      }
70
      ?>
75
      ?>
71
      delayed_start_of_poll();
76
      delayed_start_of_poll();
72
    });
77
    });
73
 
78
 
74
    var current_value = {};
79
    var current_value = {};
75
    var next_value = {};
80
    var next_value = {};
76
   
81
   
77
    <?
82
    <?
78
    foreach ($aliasesDimmer as $alias)
83
    foreach ($aliasesDimmer as $alias)
79
    {
84
    {
80
    ?>
85
    ?>
81
      current_value['<?=$alias?>'] = 0;
86
      current_value['<?=$alias?>'] = 0;
82
      next_value['<?=$alias?>'] = -1;
87
      next_value['<?=$alias?>'] = -1;
83
    <?
88
    <?
84
    }
89
    }
Line 87... Line 92...
87
    var timer = null;
92
    var timer = null;
88
 
93
 
89
    function checkCurrentValue()
94
    function checkCurrentValue()
90
    {
95
    {
91
      updating_current = true;
96
      updating_current = true;
-
 
97
      /*
92
      jQuery.getJSON("?getvalue=1", "", function(data)
98
      jQuery.getJSON("?getvalue=1", "", function(data)
93
      {
99
      {
94
       
100
       
95
       
101
       
96
        jQuery.each(data, function(alias, value)
102
        jQuery.each(data, function(alias, value)
Line 98... Line 104...
98
          current_value[alias] = value;
104
          current_value[alias] = value;
99
          $('#slider' + alias).val(value).slider("refresh");
105
          $('#slider' + alias).val(value).slider("refresh");
100
        });
106
        });
101
       
107
       
102
        updating_current = false;
108
        updating_current = false;
-
 
109
      });*/
-
 
110
      jQuery.getJSON("?getdata=1", "", function(data)
-
 
111
      {
-
 
112
      var element = $("#current-information");
-
 
113
 
-
 
114
      element.empty();
-
 
115
 
-
 
116
      var text = "";
-
 
117
 
-
 
118
      jQuery.each(data, function(alias, aliasData)
-
 
119
      {
-
 
120
        text += "<b>" + alias + "</b><br/>";
-
 
121
 
-
 
122
        jQuery.each(aliasData, function(name, value)
-
 
123
        {
-
 
124
          text += name + "=" + value.value + "<br/>";
-
 
125
        });
-
 
126
 
-
 
127
        text += "<br/>";
-
 
128
      });
-
 
129
 
-
 
130
      element.html(text);
-
 
131
 
-
 
132
 
103
      });
133
      });
104
      timer = setTimeout(checkCurrentValue, 1000);
134
      timer = setTimeout(checkCurrentValue, 5000);
105
    }
135
    }
106
 
136
 
107
    function makeAjaxChange(alias)
137
    function makeAjaxChange(alias)
108
    {
138
    {
109
      if (updating_current)
139
      if (updating_current)
Line 212... Line 242...
212
      <div data-role="collapsible-set" data-theme="" data-content-theme="">
242
      <div data-role="collapsible-set" data-theme="" data-content-theme="">
213
    <div data-role="collapsible" data-collapsed="true">
243
    <div data-role="collapsible" data-collapsed="true">
214
      <h3>
244
      <h3>
215
        Ute temperatur
245
        Ute temperatur
216
      </h3>
246
      </h3>
-
 
247
      <div id="current-information">None</div>
217
<?
248
<?
218
//    <div style="width: 997px; height: 519px; position: relative; background-color: #fbfbfb; border: 1px solid #b8b8b8;">
249
//    <div style="width: 997px; height: 519px; position: relative; background-color: #fbfbfb; border: 1px solid #b8b8b8;">
219
//      <img style=" top: 50%; left: 50%; " src="http://linuxz-home.mine.nu/CANgraph/outside_day.png" />
250
//      <img style=" top: 50%; left: 50%; " src="http://linuxz-home.mine.nu/CANgraph/outside_day.png" />
220
//    </div>
251
//    </div>
221
?>
252
?>