www-thermferm/getlog.php

Sat, 14 Jul 2018 17:21:25 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 14 Jul 2018 17:21:25 +0200
changeset 533
49580ca85ab7
parent 512
fd1354e2a045
permissions
-rw-r--r--

Versie 0.6.3. MQTT device berichten alleen als een fermenter ingeschakeld is. MQTT fermenter birth en death berichhten als een fementer in of uitgeschakeld wordt. MQTT node death bericht bij normaal afsluiten van de daemon. Alle MQTT persistent berichten worden nu goed opgeruikmd.

123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 /*****************************************************************************
512
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
3 * Copyright (C) 2014-2017
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 *
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * Michiel Broek <mbroek at mbse dot eu>
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 *
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * This file is part of ThermFerm
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * This is free software; you can redistribute it and/or modify it
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * under the terms of the GNU General Public License as published by the
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * Free Software Foundation; either version 2, or (at your option) any
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * later version.
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * ThermFerm is distributed in the hope that it will be useful, but
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * General Public License for more details.
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 *
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * along with ThermFerm; see the file COPYING. If not, write to the Free
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 *****************************************************************************/
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 require_once('utilities.php');
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 191
diff changeset
27 $answer = send_cmd("LIST LOG ".$_GET["unit"]);
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 $arr = explode("\r\n", $answer);
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 $row = '[';
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 /* We don't use json_encode because it doesn't work for our purpose */
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 if (startsWith($arr[0], "212")) {
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 $j = 1;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 while (1) {
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 if (strcmp($arr[$j], ".") == 0)
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 break;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 if ($j > 1)
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 $row .= ',';
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 $f = explode(",", $arr[$j]);
512
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
42 $reply = array (
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
43 'Date' => $f[0],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
44 'Mode' => $f[1],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
45 'Air' => $f[2],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
46 'Beer' => $f[3],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
47 'Target_lo' => $f[4],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
48 'Heater' => $f[5] / 100,
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
49 'Cooler' => $f[6] / 100,
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
50 'HeatUse' => $f[7],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
51 'CoolUse' => $f[8],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
52 'Room' => $f[9],
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
53 'Target_hi' => $f[10]
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
54 );
fd1354e2a045 Small web page changes
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
55 $row .= json_encode($reply, JSON_NUMERIC_CHECK);
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 $j++;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 }
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 }
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 $row .= ']';
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 echo $row;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 ?>

mercurial