Skip to content

Commit 8a0ef13

Browse files
committed
Added code to show various events
1 parent 7034657 commit 8a0ef13

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

data.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,14 @@ function getWho($reason)
104104
$dataPoints1[] = array('x' => doubleval($row['whentime']), 'y' => floatval($row['temperature']));
105105
} else {
106106
$dataPoints1[] = array('x' => doubleval($row['whentime']), 'y' => floatval($row['temperature']));
107-
$airconon = $row['airconon'];
108-
109-
$ac = "off";
110-
if($airconon == 1)
111-
$ac = "on";
112107
}
113108

114109
$dataPoints2[] = array('x' => doubleval($row['whentime']), 'y' => floatval($row['humidity']));
115110
$dataPoints3[] = array('x' => doubleval($row['whentime']), 'y' => floatval($row['feelslike']));
116111
$dataPoints4[] = array('x' => doubleval($row['whentime']), 'y' => floatval($row['rssi']));
117112
}
118113

114+
$ac = "off";
119115
$query = "SELECT *, DATE_FORMAT(whentime, '%H:%i') as wttime, UNIX_TIMESTAMP(whentime) * 1000 as startTS FROM sensibo WHERE uid='$uid' ORDER BY whentime DESC";
120116
$res = mysqli_query($link, $query);
121117
if(mysqli_num_rows($res) > 0)
@@ -124,8 +120,18 @@ function getWho($reason)
124120
$currtemp = $row['temperature'];
125121
$currhumid = $row['humidity'];
126122
$currtime = $row['wttime'];
123+
127124
if($startTS == -1)
128125
$startTS = $row['startTS'];
126+
127+
if($row['airconon'] == 1)
128+
$ac = "on";
129+
} else {
130+
$currtemp = 0.0;
131+
$currhumid = 0;
132+
$currtime = "00:00";
133+
if($startTS == -1)
134+
$startTS = time() * 1000;
129135
}
130136

131137
$commands = '';

0 commit comments

Comments
 (0)