Mon, 25 Mar 2024 17:14:56 +0100
Brought the retry attempts to read the DHT11 sensors to the main devices loop. The actual read function is now very simple. Called every 30 seconds when all is well, or 2 seconds if something is wrong.
357 | 1 | <?php |
2 | /***************************************************************************** | |
536
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
512
diff
changeset
|
3 | * Copyright (C) 2015-2018 |
357 | 4 | * |
5 | * Michiel Broek <mbroek at mbse dot eu> | |
6 | * | |
7 | * This file is part of ThermFerm | |
8 | * | |
9 | * This is free software; you can redistribute it and/or modify it | |
10 | * under the terms of the GNU General Public License as published by the | |
11 | * Free Software Foundation; either version 2, or (at your option) any | |
12 | * later version. | |
13 | * | |
14 | * ThermFerm is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
21 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
22 | *****************************************************************************/ | |
23 | ||
24 | require_once('utilities.php'); | |
25 | ||
26 | ||
27 | $answer = send_cmd("ARCHIVE LOG ".$_GET["name"]); | |
28 | $arr = explode("\r\n", $answer); | |
29 | ||
30 | ||
31 | $row = '['; | |
32 | ||
33 | /* We don't use json_encode because it doesn't work for our purpose */ | |
34 | if (startsWith($arr[0], "212")) { | |
35 | $j = 1; | |
36 | while (1) { | |
37 | if (strcmp($arr[$j], ".") == 0) | |
38 | break; | |
39 | if ($j > 1) | |
40 | $row .= ','; | |
41 | $f = explode(",", $arr[$j]); | |
512 | 42 | $reply = array ( |
43 | 'Date' => $f[0], | |
44 | 'Mode' => $f[1], | |
45 | 'Air' => $f[2], | |
46 | 'Beer' => $f[3], | |
47 | 'Target_lo' => $f[4], | |
48 | 'Heater' => $f[5] / 100, | |
49 | 'Cooler' => $f[6] / 100, | |
50 | 'HeatUse' => $f[7], | |
51 | 'CoolUse' => $f[8], | |
52 | 'Room' => $f[9], | |
536
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
512
diff
changeset
|
53 | 'Target_hi' => $f[10], |
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
512
diff
changeset
|
54 | 'Chiller' => $f[11] |
512 | 55 | ); |
56 | $row .= json_encode($reply, JSON_NUMERIC_CHECK); | |
357 | 57 | $j++; |
58 | } | |
59 | } | |
60 | ||
61 | $row .= ']'; | |
62 | echo $row; | |
63 | ||
64 | ?> |