Subversion Repositories HomeAutomation

Rev

Rev 2056 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 2056 Rev 2057
Line 1... Line 1...
1
<?php
1
<?php
2
$aliasesDimmer = array("powerMeter", "heatMeter");
2
$aliasesDimmer = array("bardisk_tv", "TakSovrum");
3
//$aliasesPower = array("powerMeter", "heatMeter");
3
$aliasesOther = 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
 
8
$response = array();
8
$response = array();
Line 19... Line 19...
19
  echo json_encode($response);
19
  echo json_encode($response);
20
  exit(0);
20
  exit(0);
21
}
21
}
22
else if (isset($_GET["getvalue"]))
22
else if (isset($_GET["getvalue"]))
23
{
23
{
24
  foreach ($aliasesDimmer as $alias)
24
  foreach ($_GET["alias"] as $alias)
25
  {
25
  {
26
    $response[$alias] = GetLastValue($alias);
26
    $response[$alias] = GetLastValue($alias);
27
  }
27
  }
28
 
28
 
29
  echo json_encode($response);
29
  echo json_encode($response);
30
  exit(0);
30
  exit(0);
31
}
31
}
32
else if (isset($_GET["getdata"]))
32
else if (isset($_GET["getdata"]))
33
{
33
{
34
  foreach ($aliasesDimmer as $alias)
34
  foreach ($_GET["alias"] as $alias)
35
  {
35
  {
36
    $responseData = GetLastData($alias);
36
    $responseData = GetLastData($alias);
37
 
37
 
38
    foreach ($responseData as $name => $value)
38
    foreach ($responseData as $name => $value)
39
    {
39
    {
Line 67... Line 67...
67
    {
67
    {
68
      <?php
68
      <?php
69
      foreach ($aliasesDimmer as $alias)
69
      foreach ($aliasesDimmer as $alias)
70
      {
70
      {
71
      ?>
71
      ?>
72
        $('#slider<?php=$alias?>' ).bind('change', function(event, ui){ makeAjaxChange("<?php=$alias?>"); });
72
        $('#slider<?php  echo $alias?>' ).bind('change', function(event, ui){ makeAjaxChange("<?php  echo $alias?>"); });
73
      <?php
73
      <?php
74
      }
74
      }
75
      ?>
75
      ?>
76
      delayed_start_of_poll();
76
      delayed_start_of_poll();
77
    });
77
    });
Line 81... Line 81...
81
   
81
   
82
    <?php
82
    <?php
83
    foreach ($aliasesDimmer as $alias)
83
    foreach ($aliasesDimmer as $alias)
84
    {
84
    {
85
    ?>
85
    ?>
86
      current_value['<?php=$alias?>'] = 0;
86
      current_value['<?php echo $alias?>'] = 0;
87
      next_value['<?php=$alias?>'] = -1;
87
      next_value['<?php echo $alias?>'] = -1;
88
    <?php
88
    <?php
89
    }
89
    }
90
    ?>
90
    ?>
91
    var updating_current = false;
91
    var updating_current = false;
92
    var timer = null;
92
    var timer = null;
93
 
93
 
94
    function checkCurrentValue()
94
    function checkCurrentValue()
95
    {
95
    {
96
      updating_current = true;
96
      updating_current = true;
97
      /*
-
 
98
      jQuery.getJSON("?getvalue=1", "", function(data)
97
      jQuery.getJSON("?getvalue=1", "<? echo "alias[]=" . implode("&alias[]=", $aliasesDimmer)?>", function(data)
99
      {
98
      {
100
       
99
       
101
       
100
       
102
        jQuery.each(data, function(alias, value)
101
        jQuery.each(data, function(alias, value)
103
        {
102
        {
104
          current_value[alias] = value;
103
          current_value[alias] = value;
105
          $('#slider' + alias).val(value).slider("refresh");
104
          $('#slider' + alias).val(value).slider("refresh");
106
        });
105
        });
107
       
106
       
108
        updating_current = false;
107
        updating_current = false;
109
      });*/
108
      });
110
      jQuery.getJSON("?getdata=1", "", function(data)
109
      jQuery.getJSON("?getdata=1", "<? echo "alias[]=" . implode("&alias[]=", $aliasesOther)?>", function(data)
111
      {
110
      {
112
      var element = $("#current-information");
111
      var element = $("#current-information");
113
 
112
 
114
      element.empty();
113
      element.empty();
115
 
114
 
Line 204... Line 203...
204
      <?php
203
      <?php
205
      foreach ($aliasesDimmer as $alias)
204
      foreach ($aliasesDimmer as $alias)
206
      {
205
      {
207
      ?>
206
      ?>
208
      <div data-role="fieldcontain" id="slider-container">
207
      <div data-role="fieldcontain" id="slider-container">
209
        <label for="slider<?php=$alias?>"><?php=ucfirst($alias)?>:</label>
208
        <label for="slider<?php echo $alias?>"><?php echo ucfirst($alias)?>:</label>
210
        <input type="range" name="slider<?php=$alias?>" id="slider<?php=$alias?>" value="<?php=intval($level)?>" min="0" max="255"  />
209
        <input type="range" name="slider<?php echo $alias?>" id="slider<?php echo $alias?>" value="<?php echo intval($level)?>" min="0" max="255"  />
211
      </div>
210
      </div>
212
 
211
 
213
      <div style="">
212
      <div style="">
214
 
213
 
215
      </div>
214
      </div>
Line 226... Line 225...
226
      <?php
225
      <?php
227
      foreach ($aliasesPower as $alias)
226
      foreach ($aliasesPower as $alias)
228
      {
227
      {
229
      ?>
228
      ?>
230
      <div data-role="fieldcontain" id="slider-container">
229
      <div data-role="fieldcontain" id="slider-container">
231
        <label for="slider<?php=$alias?>"><?php=ucfirst($alias)?>:</label>
230
        <label for="slider<?php echo $alias?>"><?php echo ucfirst($alias)?>:</label>
232
      </div>
231
      </div>
233
 
232
 
234
      <div style="">
233
      <div style="">
235
 
234
 
236
      </div>
235
      </div>