www-thermferm/liveview.php

Mon, 02 May 2016 16:15:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 02 May 2016 16:15:37 +0200
changeset 499
602d9968960f
parent 404
6205c7931659
child 517
5fd12d9f3f84
permissions
-rw-r--r--

Created mqtt sourcefiles. Use flags to trigger publish messages. The main source does not know and does not care if MQTT messages will be sent. Version 0.5.5

100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 /*****************************************************************************
305
fc2fae36f4ba Better tab switching with a cookie
Michiel Broek <mbroek@mbse.eu>
parents: 304
diff changeset
3 * Copyright (C) 2014-2015
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 *
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * Michiel Broek <mbroek at mbse dot eu>
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 *
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * This file is part of ThermFerm
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * This is free software; you can redistribute it and/or modify it
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * under the terms of the GNU General Public License as published by the
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * Free Software Foundation; either version 2, or (at your option) any
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * later version.
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * ThermFerm is distributed in the hope that it will be useful, but
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * General Public License for more details.
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 *
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * along with ThermFerm; see the file COPYING. If not, write to the Free
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 *****************************************************************************/
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 require_once('utilities.php');
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
29 function showunit($unit, $unr, $name)
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 {
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
31 global $my_style;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
32
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
33 $outstr = ' <!-- showunit(' . $unit . ', ' . $unr . ', ' . $name . ') -->' . PHP_EOL;
102
e37b9c571a56 Units can display the temperature
Michiel Broek <mbroek@mbse.eu>
parents: 100
diff changeset
34 $air_state = $beer_state = 1;
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
35 $answer = send_cmd("UNIT GET ".$unit);
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 $arr = explode("\r\n", $answer);
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 if (startsWith($arr[0], "213")) {
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
40 $set_temperature_lo = "NA";
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
41 $set_temperature_hi = "NA";
169
47358c2cc285 Small fix for NA values
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
42 $air_temperature = "NA";
47358c2cc285 Small fix for NA values
Michiel Broek <mbroek@mbse.eu>
parents: 168
diff changeset
43 $beer_temperature = "NA";
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
44 $profile = "";
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
45 $prof_state = "OFF";
153
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
46 $power_led = $cooler_led = $heater_led = $fan_led = "off";
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
47 $heater = $cooler = $fan = "no";
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
48 $heater_state = $cooler_state = $fan_state = 0;
153
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
49
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
50 foreach($arr as $l) {
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
51 $vals = explode(",", $l);
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
52 if (strcmp($vals[0], "MODE") == 0) {
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
53 $mode = $vals[1];
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
54 if (strcmp($mode, "OFF"))
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
55 $power_led = "on";
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
56 }
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
57 if (strcmp($vals[0], "AIR_STATE") == 0) {
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
58 $air_state = $vals[1];
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
59 }
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
60 if ((strcmp($vals[0], "AIR_TEMPERATURE") == 0) && ($air_state == 0)) {
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
61 $air_temperature = $vals[1];
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
62 }
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
63 if (strcmp($vals[0], "BEER_STATE") == 0) {
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
64 $beer_state = $vals[1];
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
65 }
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
66 if ((strcmp($vals[0], "BEER_TEMPERATURE") == 0) && ($beer_state == 0)) {
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
67 $beer_temperature = $vals[1];
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
68 }
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
69 if ((strcmp($vals[0], "HEATER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) {
153
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
70 $heater = "yes";
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
71 }
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
72 if (strcmp($vals[0], "HEATER_STATE") == 0) {
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
73 $heater_state = $vals[1];
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
74 }
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
75 if ((strcmp($vals[0], "COOLER_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) {
153
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
76 $cooler = "yes";
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
77 }
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
78 if (strcmp($vals[0], "COOLER_STATE") == 0) {
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
79 $cooler_state = $vals[1];
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
80 }
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
81 if ((strcmp($vals[0], "FAN_ADDRESS") == 0) && (strcmp($vals[1], "(null)"))) {
153
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
82 $fan = "yes";
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
83 }
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
84 if (strcmp($vals[0], "FAN_STATE") == 0) {
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
85 $fan_state = $vals[1];
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
86 }
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
87 if (strcmp($vals[0], "PROFILE") == 0) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
88 $profile = $vals[1];
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
89 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
90 if (strcmp($vals[0], "PROF_STATE") == 0) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
91 $prof_state = $vals[1];
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
92 }
186
7c44b11a10b0 Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
93 if (($vals[0] == "BEER_SET") && ($mode == "BEER")) {
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
94 $set_temperature_lo = $set_temperature_hi = $vals[1];
186
7c44b11a10b0 Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
95 }
7c44b11a10b0 Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
96 if (($vals[0] == "FRIDGE_SET") && ($mode == "FRIDGE")) {
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
97 $set_temperature_lo = $set_temperature_hi = $vals[1];
186
7c44b11a10b0 Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
98 }
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
99 if (($vals[0] == "PROF_TARGET_LO") && ($mode == "PROFILE")) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
100 $set_temperature_lo = $vals[1];
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
101 }
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
102 if (($vals[0] == "PROF_TARGET_HI") && ($mode == "PROFILE")) {
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
103 $set_temperature_hi = $vals[1];
186
7c44b11a10b0 Added setting of initial target temperature
Michiel Broek <mbroek@mbse.eu>
parents: 185
diff changeset
104 }
153
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
105 }
866a947b732a Added the framework for the units editor. In the dashboard the radio selector buttons are converteed to jqwidgets radiobuttons.
Michiel Broek <mbroek@mbse.eu>
parents: 151
diff changeset
106
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
107 $outstr .= ' <script type="text/javascript">'.PHP_EOL;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
108 $outstr .= ' $(document).ready(function () {'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
109
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
110 $outstr .= ' function getExportServer'.$unr.'() {'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
111 $outstr .= ' return "http://www.jqwidgets.com/export_server/export.php";'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
112 $outstr .= ' }'.PHP_EOL;
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
113 $outstr .= ' var source'.$unr.' ='.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
114 $outstr .= ' {'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
115 $outstr .= ' datatype: "json",'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
116 $outstr .= ' datafields: ['.PHP_EOL;
374
20999ef6d487 Fixed php scripts for jqwidgets version 3.8.0
Michiel Broek <mbroek@mbse.eu>
parents: 360
diff changeset
117 $outstr .= ' { name: "Date", type: "date", format: "yyyy-MM-dd HH:mm" },'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
118 $outstr .= ' { name: "Mode" },'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
119 $outstr .= ' { name: "Air", type: "float" },'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
120 $outstr .= ' { name: "Beer", type: "float" },'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
121 $outstr .= ' { name: "Target_lo", type: "float" },'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
122 $outstr .= ' { name: "Target_hi", type: "float" },'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
123 $outstr .= ' { name: "Heater", type: "int" },'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
124 $outstr .= ' { name: "Cooler", type: "int" },'.PHP_EOL;
299
d1c52fb43e30 Show heater/cooler usgae in percent on the web page. Bunped to version 0.2.5
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
125 $outstr .= ' { name: "HeatUse", type: "int" },'.PHP_EOL;
358
8b7ef338bf49 Plot room temperature on the dashboard.
Michiel Broek <mbroek@mbse.eu>
parents: 320
diff changeset
126 $outstr .= ' { name: "CoolUse", type: "int" },'.PHP_EOL;
8b7ef338bf49 Plot room temperature on the dashboard.
Michiel Broek <mbroek@mbse.eu>
parents: 320
diff changeset
127 $outstr .= ' { name: "Room", type: "float" }'.PHP_EOL;
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
128 $outstr .= ' ],'.PHP_EOL;
124
350401bac16e Added maintenance tabs and extended server output
Michiel Broek <mbroek@mbse.eu>
parents: 123
diff changeset
129 $outstr .= ' url: \'getlog.php?unit='.$unit.'\''.PHP_EOL;
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
130 $outstr .= ' };'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
131
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
132 $outstr .= ' var dataAdapter'.$unr.' = new $.jqx.dataAdapter(source'.$unr.','.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
133 $outstr .= ' {'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
134 $outstr .= ' autoBind: true,'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
135 $outstr .= ' async: false,'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
136 $outstr .= ' downloadComplete: function () { },'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
137 $outstr .= ' loadComplete: function () { },'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
138 $outstr .= ' loadError: function () { }'.PHP_EOL;
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
139 $outstr .= ' });'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
140
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
141 $outstr .= ' var settings'.$unr.' = {'.PHP_EOL;
380
75afd21885f2 Help screens for the commands are moved into the commands.
Michiel Broek <mbroek@mbse.eu>
parents: 375
diff changeset
142 $outstr .= ' title: "'.$name.'",'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
143 $outstr .= ' description: "",'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
144 $outstr .= ' padding: { left: 5, top: 5, right: 5, bottom: 5 },'.PHP_EOL;
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
145 $outstr .= ' titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },'.PHP_EOL;
123
597688feda2f Now uses the real data for the chart
Michiel Broek <mbroek@mbse.eu>
parents: 122
diff changeset
146 $outstr .= ' source: dataAdapter'.$unr.','.PHP_EOL;
374
20999ef6d487 Fixed php scripts for jqwidgets version 3.8.0
Michiel Broek <mbroek@mbse.eu>
parents: 360
diff changeset
147 $outstr .= ' xAxis:'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
148 $outstr .= ' {'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
149 $outstr .= ' dataField: \'Date\','.PHP_EOL;
374
20999ef6d487 Fixed php scripts for jqwidgets version 3.8.0
Michiel Broek <mbroek@mbse.eu>
parents: 360
diff changeset
150 $outstr .= ' type: \'date\','.PHP_EOL;
384
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
151 $outstr .= ' formatFunction: function (value) {'.PHP_EOL;
385
260e92f0f998 Fixed month display in live view and archive view. Bumped to version 0.3.7.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
152 $outstr .= ' return value.getDate() + \'-\' + (value.getMonth() + 1) + \'-\' + value.getFullYear()'.PHP_EOL;
384
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
153 $outstr .= ' },'.PHP_EOL;
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
154 $outstr .= ' toolTipFormatFunction: function (value) {'.PHP_EOL;
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
155 $outstr .= ' var h = value.getHours();'.PHP_EOL;
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
156 $outstr .= ' var m = value.getMinutes();'.PHP_EOL;
385
260e92f0f998 Fixed month display in live view and archive view. Bumped to version 0.3.7.
Michiel Broek <mbroek@mbse.eu>
parents: 384
diff changeset
157 $outstr .= ' return value.getDate() + \'-\' + (value.getMonth() + 1) + \'-\' + value.getFullYear()';
384
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
158 $outstr .= ' + \' \' + (h < 10 ? \'0\' + h : h) + \':\' + (m < 10 ? \'0\' + m : m);'.PHP_EOL;
5db8186fe803 Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
159 $outstr .= ' },'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
160 $outstr .= ' textRotationAngle: 45,'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
161 $outstr .= ' showGridLines: false'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
162 $outstr .= ' },'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
163 $outstr .= ' colorScheme: \'scheme01\','.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
164 $outstr .= ' seriesGroups:'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
165 $outstr .= ' [{'.PHP_EOL;
300
4ce46ff3e37d The LIST LOG command now automatic adjusts the number of output lines and resolution by calculating a reasonable interval between 1 and 60 minutes. Bumped to version 0.2.6
Michiel Broek <mbroek@mbse.eu>
parents: 299
diff changeset
166 $outstr .= ' type: "line",'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
167 $outstr .= ' valueAxis:'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
168 $outstr .= ' {'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
169 $outstr .= ' minValue: 0,'.PHP_EOL;
299
d1c52fb43e30 Show heater/cooler usgae in percent on the web page. Bunped to version 0.2.5
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
170 $outstr .= ' maxValue: 100,'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
171 $outstr .= ' displayValueAxis: false,'.PHP_EOL;
299
d1c52fb43e30 Show heater/cooler usgae in percent on the web page. Bunped to version 0.2.5
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
172 $outstr .= ' description: "Heat/Cool %"'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
173 $outstr .= ' },'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
174 $outstr .= ' series: ['.PHP_EOL;
299
d1c52fb43e30 Show heater/cooler usgae in percent on the web page. Bunped to version 0.2.5
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
175 $outstr .= ' { dataField: "CoolUse", lineWidth: 1, displayText: "Cool %", opacity: 0.5 },'.PHP_EOL;
d1c52fb43e30 Show heater/cooler usgae in percent on the web page. Bunped to version 0.2.5
Michiel Broek <mbroek@mbse.eu>
parents: 296
diff changeset
176 $outstr .= ' { dataField: "HeatUse", lineWidth: 1, displayText: "Heat %", opacity: 0.5 }'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
177 $outstr .= ' ]'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
178 $outstr .= ' },'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
179 $outstr .= ' {'.PHP_EOL;
387
03635517595c Changed graph spline type into line type.
Michiel Broek <mbroek@mbse.eu>
parents: 385
diff changeset
180 $outstr .= ' type: "line",'.PHP_EOL;
266
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
181 $outstr .= ' valueAxis:'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
182 $outstr .= ' {'.PHP_EOL;
07819a7ad3c1 Better log output for web graphs. Webgraphs can now display heater and cooler usage.
Michiel Broek <mbroek@mbse.eu>
parents: 265
diff changeset
183 $outstr .= ' minValue: 0,'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
184 $outstr .= ' description: \'Degrees C\''.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
185 $outstr .= ' },'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
186 $outstr .= ' series: ['.PHP_EOL;
296
0569f28b0806 Thinner lines for chart drawing
Michiel Broek <mbroek@mbse.eu>
parents: 295
diff changeset
187 $outstr .= ' { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL;
0569f28b0806 Thinner lines for chart drawing
Michiel Broek <mbroek@mbse.eu>
parents: 295
diff changeset
188 $outstr .= ' { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
189 $outstr .= ' { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
190 $outstr .= ' { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL;
358
8b7ef338bf49 Plot room temperature on the dashboard.
Michiel Broek <mbroek@mbse.eu>
parents: 320
diff changeset
191 $outstr .= ' { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 }'.PHP_EOL;
121
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
192 $outstr .= ' ]'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
193 $outstr .= ' }]'.PHP_EOL;
03306c3bfd60 Initial setup to draw charts
Michiel Broek <mbroek@mbse.eu>
parents: 118
diff changeset
194 $outstr .= ' };'.PHP_EOL;
185
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
195 /* Direct draw for the first time */
154
83502d2099eb Added style to radiobuttons
Michiel Broek <mbroek@mbse.eu>
parents: 153
diff changeset
196 $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart(settings'.$unr.');'.PHP_EOL;
185
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
197 /* Regular updates of the chart */
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
198 // $outstr .= ' setInterval(function(){'.PHP_EOL;
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
199 // $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart("update");'.PHP_EOL;
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
200 // $outstr .= ' }, 3000);'.PHP_EOL;
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
201
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
202 $outstr .= ' $("#print_'.$unr.'").click(function () {'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
203 $outstr .= ' var content = $("#fermentor_chart_'.$unit.'")[0].outerHTML;'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
204 $outstr .= ' var newWindow = window.open("", "", "width=750, height=400"),'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
205 $outstr .= ' document = newWindow.document.open(),'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
206 $outstr .= ' pageContent ='.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
207 $outstr .= ' \'<!DOCTYPE html>\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
208 $outstr .= ' \'<html>\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
209 $outstr .= ' \'<head>\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
210 $outstr .= ' \'<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
211 $outstr .= ' \'<meta charset="utf-8" />\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
212 $outstr .= ' \'<title>jQWidgets Chart</title>\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
213 $outstr .= ' \'</head>\' +'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
214 $outstr .= ' \'<body>\' + content + \'</body></html>\';'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
215 $outstr .= ' document.write(pageContent);'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
216 $outstr .= ' document.close();'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
217 $outstr .= ' newWindow.print();'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
218 $outstr .= ' });'.PHP_EOL;
375
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
219 $outstr .= ' $("#print_'.$unr.'").jqxButton({ width: 70, height: 25, theme: "ui-redmond" });'.PHP_EOL;
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
220
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
221 $outstr .= ' $("#pngButton_'.$unr.'").click(function () {'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
222 // call the export server to create a PNG image
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
223 $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart("saveAsPNG", "Chart_'.$name.'.png", getExportServer'.$unr.'());'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
224 $outstr .= ' });'.PHP_EOL;
375
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
225 $outstr .= ' $("#pdfButton_'.$unr.'").click(function () {'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
226 $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer'.$unr.'());'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
227 $outstr .= ' });'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
228 $outstr .= ' $("#pngButton_'.$unr.'").jqxButton({ width: 70, height: 25, theme: "ui-redmond" });'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
229 $outstr .= ' $("#pdfButton_'.$unr.'").jqxButton({ width: 70, height: 25, theme: "ui-redmond" });'.PHP_EOL;
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
230
171
15f92e5eecef Ajax screen updates now use a single call to the server
Michiel Broek <mbroek@mbse.eu>
parents: 169
diff changeset
231 $outstr .= ' setInterval(function(){'.PHP_EOL;
185
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
232 $outstr .= ' $.getJSON("getstate.php?uuid='.$unit.'", function(data) {'.PHP_EOL;
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
233 $outstr .= ' $("#load_air_'.$unr.'").html(data.air_temperature);'.PHP_EOL;
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
234 $outstr .= ' $("#load_beer_'.$unr.'").html(data.beer_temperature);'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
235 $outstr .= ' $("#load_target_lo_'.$unr.'").html(data.target_temperature_lo);'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
236 $outstr .= ' $("#load_target_hi_'.$unr.'").html(data.target_temperature_hi);'.PHP_EOL;
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
237 $outstr .= ' $("#load_select_'.$unr.'").html(data.mode);'.PHP_EOL;
193
4136193a0c22 Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
238 $outstr .= ' $("#load_led1_'.$unr.'").html(data.led1);'.PHP_EOL;
4136193a0c22 Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
239 $outstr .= ' $("#load_led2_'.$unr.'").html(data.led2);'.PHP_EOL;
4136193a0c22 Auto refresh LED's state added.
Michiel Broek <mbroek@mbse.eu>
parents: 186
diff changeset
240 $outstr .= ' $("#load_led3_'.$unr.'").html(data.led3);'.PHP_EOL;
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
241 $outstr .= ' $("#load_sw1_'.$unr.'").html(data.sw1);'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
242 $outstr .= ' $("#load_sw2_'.$unr.'").html(data.sw2);'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
243 $outstr .= ' $("#load_sw3_'.$unr.'").html(data.sw3);'.PHP_EOL;
284
9e6fb5aed618 Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
244 if ($mode == "PROFILE")
9e6fb5aed618 Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
245 $outstr .= ' $("#prof_state_'.$unr.'").html(data.profile_state);'.PHP_EOL;
185
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
246 $outstr .= ' });'.PHP_EOL;
4f34271cf1e7 PID finetuning
Michiel Broek <mbroek@mbse.eu>
parents: 178
diff changeset
247 $outstr .= ' }, 10000);'.PHP_EOL;
400
d36f4fefd4e2 Adding tooltips in the liveview screen.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
248
d36f4fefd4e2 Adding tooltips in the liveview screen.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
249 /*
d36f4fefd4e2 Adding tooltips in the liveview screen.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
250 * Tooltips
d36f4fefd4e2 Adding tooltips in the liveview screen.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
251 */
404
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
252 $outstr .= ' $("#load_air_'.$unr.'").jqxTooltip({ content: "The measured air temperature.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
253 $outstr .= ' $("#load_beer_'.$unr.'").jqxTooltip({ content: "The measured beer temperature.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
254 $outstr .= ' $("#load_target_lo_'.$unr.'").jqxTooltip({ content: "The target low temperature.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
255 $outstr .= ' $("#load_target_hi_'.$unr.'").jqxTooltip({ content: "The target high temperature.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
256 $outstr .= ' $("#load_select_'.$unr.'").jqxTooltip({ content: "Select unit mode.", theme: "'.$my_style.'" });'.PHP_EOL;
403
230a9a169adb More tooltips
Michiel Broek <mbroek@mbse.eu>
parents: 400
diff changeset
257 if (($mode == "NONE") && ($cooler == "yes"))
404
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
258 $outstr .= ' $("#load_sw1_'.$unr.'").jqxTooltip({ content: "Manual control cooler.", theme: "'.$my_style.'" });'.PHP_EOL;
403
230a9a169adb More tooltips
Michiel Broek <mbroek@mbse.eu>
parents: 400
diff changeset
259 if (($mode == "NONE") && ($heater == "yes"))
404
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
260 $outstr .= ' $("#load_sw2_'.$unr.'").jqxTooltip({ content: "Manual control heater.", theme: "'.$my_style.'" });'.PHP_EOL;
403
230a9a169adb More tooltips
Michiel Broek <mbroek@mbse.eu>
parents: 400
diff changeset
261 if (($mode == "NONE") && ($fan== "yes"))
404
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
262 $outstr .= ' $("#load_sw3_'.$unr.'").jqxTooltip({ content: "Manual control fan.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
263 $outstr .= ' $("#print_'.$unr.'").jqxTooltip({ content: "Print the current graph.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
264 $outstr .= ' $("#pngButton_'.$unr.'").jqxTooltip({ content: "Save the current graph as png image.", theme: "'.$my_style.'" });'.PHP_EOL;
6205c7931659 More tooltips again.
Michiel Broek <mbroek@mbse.eu>
parents: 403
diff changeset
265 $outstr .= ' $("#pdfButton_'.$unr.'").jqxTooltip({ content: "Save the current graph as PDF file.", theme: "'.$my_style.'" });'.PHP_EOL;
400
d36f4fefd4e2 Adding tooltips in the liveview screen.
Michiel Broek <mbroek@mbse.eu>
parents: 397
diff changeset
266
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
267 $outstr .= ' });'.PHP_EOL;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
268 $outstr .= ' </script>'.PHP_EOL;
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 $outstr .= ' <div id="fermentor">'.PHP_EOL;
154
83502d2099eb Added style to radiobuttons
Michiel Broek <mbroek@mbse.eu>
parents: 153
diff changeset
270 $outstr .= ' <div id="fermentor_chart_'.$unit.'" style="width:720px; height:377px; float:left"></div>'.PHP_EOL;
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271
151
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
272 $outstr .= ' <div id="fermentor_panel_top">'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
273 $outstr .= ' <div id="fermentor_selector">'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
274 $outstr .= ' <form id="select_'.$unr.'" action="index.php" method="post">'.PHP_EOL;
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
275 $outstr .= ' <div id="load_select_'.$unr.'">'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
276 strcmp($mode, "OFF") ? $se = "" : $se = " checked";
168
1288dbf0f9b5 Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
277 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="OFF"'.$se.'>Off<br>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
278 strcmp($mode, "NONE") ? $se = "" : $se = " checked";
168
1288dbf0f9b5 Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
279 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="NONE"'.$se.'>None<br>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
280 (strcmp($heater, "no") || strcmp($cooler, "no")) ? $dis = "" : $dis = " disabled";
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
281 strcmp($mode, "FRIDGE") ? $se = "" : $se = " checked";
168
1288dbf0f9b5 Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
282 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="FRIDGE"'.$se.$dis.'>Fridge<br>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
283 strcmp($mode, "BEER") ? $se = "" : $se = " checked";
168
1288dbf0f9b5 Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
284 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="BEER"'.$se.$dis.'>Beer<br>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
285 strcmp($mode, "PROFILE") ? $se = "" : $se = " checked";
168
1288dbf0f9b5 Temperature auto refresh and some layout improvements.
Michiel Broek <mbroek@mbse.eu>
parents: 155
diff changeset
286 $outstr .= ' <input type="radio" name="mode" onchange="this.form.submit()" class="select" value="PROFILE"'.$se.$dis.'>Profile'.PHP_EOL;
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
287 $outstr .= ' </div>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
288 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL;
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
289 $outstr .= ' </form>'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
290 $outstr .= ' </div>'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
291
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
292 $outstr .= ' <div id="fermentor_powerled">'.PHP_EOL;
225
b18b06c17a80 Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
293 $outstr .= ' <div class="LEDblue_'.$power_led.'"></div>Pwr'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
294 $outstr .= ' </div>'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
295
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
296 $outstr .= ' <div id="fermentor_mode_control">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
297 if ($mode == "FRIDGE") {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
298 $outstr .= ' <form id="set_fridge_'.$unr.'" action="index.php" method="post">'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
299 $outstr .= ' <input type="text" name="Fridge" size="5" value="'.$set_temperature_lo.'"><br>'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
300 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
301 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
302 $outstr .= ' </form>'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
303 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
304 if ($mode == "BEER") {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
305 $outstr .= ' <form id="set_beer_'.$unr.'" action="index.php" method="post">'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
306 $outstr .= ' <input type="text" name="Beer" size="5" value="'.$set_temperature_lo.'">'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
307 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
308 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
309 $outstr .= ' </form>'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
310 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
311 if ($mode == "PROFILE") {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
312 /*
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
313 * First, load a list with available profiles.
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
314 */
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
315 $answer = send_cmd("PROFILE LIST");
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
316 $reply = explode("\r\n", $answer);
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
317
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
318 /*
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
319 * Show loaded profile.
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
320 */
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
321 if ($profile == "(null)") {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
322 $prof_name = "None";
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
323 }else {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
324 if (startsWith($reply[0], "212")) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
325 $i = 1;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
326 while (1) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
327 if (strcmp($reply[$i], ".") == 0)
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
328 break;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
329 $f = explode(",", $reply[$i]);
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
330 if ($f[0] == $profile) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
331 $prof_name = $f[1];
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
332 break;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
333 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
334 $i++;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
335 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
336 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
337 }
258
e02393b29733 Updated web dashboard layout
Michiel Broek <mbroek@mbse.eu>
parents: 257
diff changeset
338 $outstr .= ' <div style="color: blue; width: 148px; height: 23px; overflow: hidden;">Profile: '.$prof_name.'</div>'.PHP_EOL;
284
9e6fb5aed618 Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
339 $outstr .= ' <div id="prof_state_'.$unr.'" style="color: blue; width: 148px; height: 23px; overflow: hidden;">State: '.$prof_state.'</div>'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
340
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
341 $outstr .= ' <form id="set_profile_'.$unr.'" action="index.php" method="post">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
342 if ($prof_state == "OFF") {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
343 $outstr .= ' <select name="SetProfile" style="width: 130px;">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
344 $outstr .= ' <option value="">None</option>'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
345 if (startsWith($reply[0], "212")) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
346 $i = 1;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
347 while (1) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
348 if (strcmp($reply[$i], ".") == 0)
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
349 break;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
350 $f = explode(",", $reply[$i]);
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
351 if ($f[2] > 0) {
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
352 ($f[0] == $profile) ? $se = " selected" : $se = "";
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
353 $outstr .= ' <option value="'.$f[0].'"'.$se.'>'.$f[1].'</option>'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
354 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
355 $i++;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
356 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
357 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
358 $outstr .= ' </select>'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
359 $outstr .= ' <input type="submit" value="Set" name="key">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
360 if ($profile != "(null)")
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
361 $outstr .= ' <input type="submit" value="Start" name="key">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
362
284
9e6fb5aed618 Profile progress is visible in the web interface
Michiel Broek <mbroek@mbse.eu>
parents: 271
diff changeset
363 } else if (startsWith($prof_state, "RUN")) {
219
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
364 $outstr .= ' <input type="hidden" value="'.$profile.'" name="SetProfile">'.PHP_EOL;
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
365 $outstr .= ' <input type="submit" value="Pause" name="key">'.PHP_EOL;
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
366 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
367 } else if ($prof_state == "PAUSE") {
219
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
368 $outstr .= ' <input type="hidden" value="'.$profile.'" name="SetProfile">'.PHP_EOL;
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
369 $outstr .= ' <input type="submit" value="Resume" name="key">'.PHP_EOL;
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
370 $outstr .= ' <input type="submit" value="Abort" name="key">'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
371 } else if ($prof_state == "DONE") {
219
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
372 $outstr .= ' <input type="hidden" value="'.$profile.'" name="SetProfile">'.PHP_EOL;
ae720212accc Added profile running and steps handling.
Michiel Broek <mbroek@mbse.eu>
parents: 196
diff changeset
373 $outstr .= ' <input type="submit" value="Off" name="key">'.PHP_EOL;
195
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
374 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
375 $outstr .= ' <input type="hidden" value="'.$unit.'" name="UUID">'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
376 $outstr .= ' </form>'.PHP_EOL;
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
377 }
b34a1b2421fb Reset output when a different profile is selected. Better startup logging about the unit state. Added Beer, Fridge and partial Profile settings from the liveview weeb screen.
Michiel Broek <mbroek@mbse.eu>
parents: 193
diff changeset
378 $outstr .= ' </div>'.PHP_EOL;
151
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
379 $outstr .= ' </div> <!-- fermentor_panel_top -->'.PHP_EOL;
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
380
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
381 $outstr .= ' <div id="fermentor_panel_display">'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
382 $outstr .= ' <div id="fermentor_display1">'.PHP_EOL;
397
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
383 $outstr .= ' <div id="load_target_hi_'.$unr.'" class="htemp">'.$set_temperature_hi.'</div>'.PHP_EOL;
00ca08f5a6f8 Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents: 387
diff changeset
384 $outstr .= ' <div id="load_target_lo_'.$unr.'" class="ltemp">'.$set_temperature_lo.'</div>'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
385 $outstr .= ' </div>'.PHP_EOL;
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
386 $outstr .= ' <div id="fermentor_display2">'.PHP_EOL;
173
7259ee8778e9 More style updates
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
387 $outstr .= ' <div id="load_air_'.$unr.'" class="dtemp">'.$air_temperature.'</div>Air'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
388 $outstr .= ' </div>'.PHP_EOL;
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
389 $outstr .= ' <div id="fermentor_display3">'.PHP_EOL;
173
7259ee8778e9 More style updates
Michiel Broek <mbroek@mbse.eu>
parents: 171
diff changeset
390 $outstr .= ' <div id="load_beer_'.$unr.'" class="dtemp">'.$beer_temperature.'</div>Beer'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
391 $outstr .= ' </div>'.PHP_EOL;
151
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
392 $outstr .= ' </div> <!-- fermentor_panel_display -->'.PHP_EOL;
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
393
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
394 $outstr .= ' <div id="fermentor_panel_control">'.PHP_EOL;
360
0f3fe4fa0977 Leds on if any state value is set.
Michiel Broek <mbroek@mbse.eu>
parents: 358
diff changeset
395 if ($cooler_state)
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
396 $cooler_led = "on";
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
397 $outstr .= ' <div id="fermentor_led1">'.PHP_EOL;
225
b18b06c17a80 Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
398 $outstr .= ' <div id="load_led1_'.$unr.'"><div class="LEDgreen_'.$cooler_led.'"></div></div>Cool'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
399 $outstr .= ' </div>'.PHP_EOL;
360
0f3fe4fa0977 Leds on if any state value is set.
Michiel Broek <mbroek@mbse.eu>
parents: 358
diff changeset
400 if ($heater_state)
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
401 $heater_led = "on";
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
402 $outstr .= ' <div id="fermentor_led2">'.PHP_EOL;
225
b18b06c17a80 Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
403 $outstr .= ' <div id="load_led2_'.$unr.'"><div class="LEDgreen_'.$heater_led.'"></div></div>Heat'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
404 $outstr .= ' </div>'.PHP_EOL;
360
0f3fe4fa0977 Leds on if any state value is set.
Michiel Broek <mbroek@mbse.eu>
parents: 358
diff changeset
405 if ($fan_state)
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
406 $fan_led = "on";
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
407 $outstr .= ' <div id="fermentor_led3">'.PHP_EOL;
225
b18b06c17a80 Changed CSS colors for the LED's. Removed the old LED's.
Michiel Broek <mbroek@mbse.eu>
parents: 224
diff changeset
408 $outstr .= ' <div id="load_led3_'.$unr.'"><div class="LEDgreen_'.$fan_led.'"></div></div>Fan'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
409 $outstr .= ' </div>'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
410
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
411 $outstr .= ' <div id="fermentor_toggle1">'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
412 $outstr .= ' <form action="index.php" method="post">'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
413 (($mode == "NONE") && ($cooler == "yes")) ? $dis = "" : $dis = " disabled";
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
414 ($cooler_state == "0") ? $ch = " checked" : $ch = "";
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
415 $outstr .= ' <div id="load_sw1_'.$unr.'">'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
416 $outstr .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
417 ($cooler_state == "100") ? $ch = " checked" : $ch = "";
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
418 $outstr .= ' <input type="radio" name="CoolerState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
419 $outstr .= ' </div>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
420 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL;
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
421 $outstr .= ' </form>'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
422 $outstr .= ' </div>'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
423
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
424 $outstr .= ' <div id="fermentor_toggle2">'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
425 $outstr .= ' <form action="index.php" method="post">'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
426 (($mode == "NONE") && ($heater == "yes")) ? $dis = "" : $dis = " disabled";
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
427 ($heater_state == "0") ? $ch = " checked" : $ch = "";
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
428 $outstr .= ' <div id="load_sw2_'.$unr.'">'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
429 $outstr .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
430 ($heater_state == "100") ? $ch = " checked" : $ch = "";
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
431 $outstr .= ' <input type="radio" name="HeaterState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
432 $outstr .= ' </div>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
433 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL;
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
434 $outstr .= ' </form>'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
435 $outstr .= ' </div>'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
436
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
437 $outstr .= ' <div id="fermentor_toggle3">'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
438 $outstr .= ' <form action="index.php" method="post">'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
439 (($mode == "NONE") && ($fan== "yes")) ? $dis = "" : $dis = " disabled";
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
440 ($fan_state == "0") ? $ch = " checked" : $ch = "";
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
441 $outstr .= ' <div id="load_sw3_'.$unr.'">'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
442 $outstr .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="0"'.$dis.$ch.'>Off<br>'.PHP_EOL;
178
988a898974f3 Web - server communication for switches improved.
Michiel Broek <mbroek@mbse.eu>
parents: 175
diff changeset
443 ($fan_state == "100") ? $ch = " checked" : $ch = "";
257
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
444 $outstr .= ' <input type="radio" name="FanState" onchange="this.form.submit()" value="100"'.$dis.$ch.'>On'.PHP_EOL;
abdba3f9d9e2 Automatic ajax updates of radio buttons
Michiel Broek <mbroek@mbse.eu>
parents: 225
diff changeset
445 $outstr .= ' </div>'.PHP_EOL;
155
0d86f3c0a07b Unit mode can switch between OFF and NONE.
Michiel Broek <mbroek@mbse.eu>
parents: 154
diff changeset
446 $outstr .= ' <input type="hidden" name="UUID" value="'.$unit.'">'.PHP_EOL;
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
447 $outstr .= ' </form>'.PHP_EOL;
113
cf3f906ffe0d Created control panel layout
Michiel Broek <mbroek@mbse.eu>
parents: 112
diff changeset
448 $outstr .= ' </div>'.PHP_EOL;
151
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
449 $outstr .= ' </div> <!-- fermentor_panel_control -->'.PHP_EOL;
ab90da2da45d Improved dashboard panel style, added (ugly) led's
Michiel Broek <mbroek@mbse.eu>
parents: 134
diff changeset
450
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
451 $outstr .= ' <div id="fermentor_panel_buttons">'.PHP_EOL;
375
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
452 $outstr .= ' <div style="margin-top: 2px; margin-left: 5px;">'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
453 $outstr .= ' <input style="float: left;" id="print_'.$unr.'" type="button" value="Print" />'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
454 $outstr .= ' <input style="float: left; margin-left: 7px;" id="pngButton_'.$unr.'" type="button" value="as PNG" />'.PHP_EOL;
f707d22c72f8 In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents: 374
diff changeset
455 $outstr .= ' <input style="float: left; margin-left: 7px;" id="pdfButton_'.$unr.'" type="button" value="as PDF" />'.PHP_EOL;
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
456 $outstr .= ' </div>'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
457 $outstr .= ' </div> <!-- fermentor_panel_buttons -->'.PHP_EOL;
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
458
122
e57043423e72 Added fermentor maintenance windows
Michiel Broek <mbroek@mbse.eu>
parents: 121
diff changeset
459 $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL;
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 }
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 return $outstr;
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463 }
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
467 function liveview()
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
468 {
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
469 $outstr = PHP_EOL;
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
470
196
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
471 $answer = send_cmd("LIST");
4d7a96c5d1ff Code cleanup
Michiel Broek <mbroek@mbse.eu>
parents: 195
diff changeset
472 if (strlen($answer)) {
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
473 $arr = explode("\r\n", $answer);
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
474
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
475 $outstr .= ' <div id="jqxTabs">'.PHP_EOL;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
476 $outstr .= ' <ul>'.PHP_EOL;
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
477 if (startsWith($arr[0], "212")) {
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478 $i = 1;
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
479 while (1) {
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
480 if (strcmp($arr[$i], ".") == 0)
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
481 break;
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
482 $parts = explode(",", $arr[$i]);
131
528dc0bb81ab Always use uuid to select units and remove numeric record id's.
Michiel Broek <mbroek@mbse.eu>
parents: 124
diff changeset
483 $outstr .= ' <li style="margin-left: 20px;">'.$parts[1].'</li>'.PHP_EOL;
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
484 $i++;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
485 }
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
486 }
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
487 $outstr .= ' </ul>'.PHP_EOL;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
488
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
489 if (startsWith($arr[0], "212")) {
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
490 $i = 1;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
491 while (1) {
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
492 if (strcmp($arr[$i], ".") == 0)
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
493 break;
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
494 $parts = explode(",", $arr[$i]);
295
e88d182657ca Added print and save as png buttons
Michiel Broek <mbroek@mbse.eu>
parents: 294
diff changeset
495 $outstr .= showunit($parts[0], $i, $parts[1]);
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
496 $i++;
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
497 }
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
498 }
117
7119ea8a5225 Initial setup of wqwidgets
Michiel Broek <mbroek@mbse.eu>
parents: 116
diff changeset
499 $outstr .= ' </div> <!-- jqxTabs -->'.PHP_EOL;
100
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
500 }
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
501
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 return $outstr;
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
503 }
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
504
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
505
012576d7386d Basic web idea
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
506 ?>

mercurial