Fri, 17 Apr 2020 11:29:37 +0200
Version 0.3.31 Switched plato to sg calculation in bmsd.
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
645
3b1510050c9b
Changed the last dropdown lists events to select
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
2 | * Copyright (C) 2019-2020 |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of BMS |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * Brewery Management System istributed in the hope that it will be useful, but |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
191
fd1d7225ca6e
Version 0.0.4. Added confirm popup window to abort a running profile. Translated the toggle buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
23 | function createAbortElements() { |
526 | 24 | $('#eventWindow').jqxWindow({ |
25 | theme: theme, | |
26 | position: { x: 440, y: 210 }, | |
27 | width: 400, | |
28 | height: 200, | |
29 | resizable: false, | |
30 | isModal: true, | |
31 | modalOpacity: 0.4, | |
32 | okButton: $('#delOk'), | |
33 | cancelButton: $('#delCancel'), | |
34 | initContent: function() { | |
35 | $('#delOk').jqxButton({ template: 'danger', width: '65px', theme: theme }); | |
36 | $('#delCancel').jqxButton({ template: 'success', width: '65px', theme: theme }); | |
37 | $('#delCancel').focus(); | |
38 | } | |
39 | }); | |
40 | $('#eventWindow').jqxWindow('hide'); | |
191
fd1d7225ca6e
Version 0.0.4. Added confirm popup window to abort a running profile. Translated the toggle buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
41 | } |
fd1d7225ca6e
Version 0.0.4. Added confirm popup window to abort a running profile. Translated the toggle buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
189
diff
changeset
|
42 | |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
526 | 44 | $(document).ready(function() { |
45 | ||
46 | var record = {}, | |
47 | blank = {}, | |
48 | ppayload = '', | |
49 | newBase = false, | |
50 | newProduct = false, | |
51 | newSwitch = false, | |
52 | newProfile = false, | |
53 | schedule = 0, | |
54 | yl = 12, // Normal yeast temp range | |
55 | yh = 24, | |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | |
526 | 57 | productSource = { |
58 | datatype: 'json', | |
59 | cache: false, | |
60 | datafields: [ | |
61 | { name: 'code', type: 'string' }, | |
62 | { name: 'name', type: 'string' }, | |
63 | { name: 'uuid', type: 'string' }, | |
64 | { name: 'stage', type: 'int' }, | |
65 | { name: 'yeast_lo', type: 'float' }, | |
66 | { name: 'yeast_hi', type: 'float' } | |
67 | ], | |
68 | id: 'code', | |
69 | url: 'includes/db_product.php?select=ferment' | |
70 | }, | |
71 | productlist = new $.jqx.dataAdapter(productSource, { | |
72 | beforeLoadComplete: function(records) { | |
73 | var row, i, data = new Array(); | |
74 | // Create a dummy beer on top to store in idle fermenters. | |
75 | blank['code'] = 'Free'; // Will override this later. | |
76 | blank['name'] = 'Dummy'; | |
77 | blank['uuid'] = '66ecccbf-e942-4a35-af49-8b02314561a5'; | |
78 | blank['stage'] = 10; | |
79 | blank['yeast_lo'] = 12.0; | |
80 | blank['yeast_hi'] = 24.0; | |
81 | data.push(blank); | |
82 | for (i = 0; i < records.length; i++) { | |
83 | row = records[i]; | |
84 | data.push(row); | |
85 | } | |
86 | return data; | |
87 | }, | |
88 | loadError: function(jqXHR, status, error) { | |
89 | $('#err').text(status + ' ' + error); | |
90 | }, | |
91 | }), | |
92 | profileSource = { | |
93 | datatype: 'json', | |
94 | cache: false, | |
95 | datafields: [ | |
96 | { name: 'record', type: 'int' }, | |
97 | { name: 'uuid', type: 'string' }, | |
98 | { name: 'name', type: 'string' }, | |
99 | { name: 'inittemp_lo', type: 'float' }, | |
100 | { name: 'inittemp_hi', type: 'float' }, | |
101 | { name: 'fridgemode', type: 'int' }, | |
102 | { name: 'totalsteps', type: 'int' }, | |
103 | { name: 'duration', type: 'int' }, | |
104 | { name: 'steps', type: 'array' } | |
105 | ], | |
106 | id: 'record', | |
107 | url: 'includes/db_profile_fermentation.php' | |
108 | }, | |
109 | profilelist = new $.jqx.dataAdapter(profileSource, { | |
110 | beforeLoadComplete: function(records) { | |
111 | var data = new Array(), | |
112 | empty = {}, i, row; | |
113 | // Create a dummy profile on top of the list. | |
114 | empty['record'] = -1; | |
115 | empty['uuid'] = ''; | |
116 | empty['name'] = 'Wis profiel'; | |
117 | empty['inittemp_lo'] = 20; | |
118 | empty['inittemp_hi'] = 20; | |
119 | empty['fridgemode'] = 0; | |
120 | empty['totalsteps'] = 0; | |
121 | empty['duration'] = 0; | |
122 | empty['steps'] = '[]'; | |
123 | data.push(empty); | |
124 | for (i = 0; i < records.length; i++) { | |
125 | row = records[i]; | |
126 | data.push(row); | |
127 | } | |
128 | return data; | |
129 | }, | |
130 | loadError: function(jqXHR, status, error) { | |
131 | $('#err').text(status + ' ' + error); | |
132 | }, | |
133 | }), | |
134 | gaugeoptions = { | |
548
c67cd0d9249b
Version 0.3.23. Maximum fermentation temperature changed to 45 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
526
diff
changeset
|
135 | min: 0, max: 45, width: 375, height: 375, |
526 | 136 | ranges: [{ startValue: 0, endValue: yl, style: { fill: '#3399FF', stroke: '#3399FF' }, endWidth: 10, startWidth: 10 }, |
137 | { startValue: yl, endValue: yh, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 }, | |
548
c67cd0d9249b
Version 0.3.23. Maximum fermentation temperature changed to 45 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
526
diff
changeset
|
138 | { startValue: yh, endValue: 45, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }], |
526 | 139 | ticksMinor: { interval: 1, size: '5%' }, |
140 | ticksMajor: { interval: 5, size: '9%' }, | |
141 | labels: { interval: 5 }, | |
142 | style: { fill: '#eeeeee', stroke: '#666666' }, | |
143 | value: 0, | |
144 | colorScheme: 'scheme05' | |
145 | }, | |
146 | gaugeSmalloptions = { | |
147 | min: -15, max: 25, width: 190, height: 190, | |
148 | ranges: [{ startValue: -15, endValue: 0, startWidth: 5, endWidth: 5, style: { fill: '#3399FF', stroke: '#3399FF' }}, | |
149 | { startValue: 0, endValue: 10, startWidth: 5, endWidth: 5, style: { fill: '#00CC33', stroke: '#00CC33' }}, | |
150 | { startValue: 10, endValue: 25, startWidth: 5, endWidth: 5, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }}], | |
151 | ticksMinor: { interval: 1, size: '5%' }, | |
152 | ticksMajor: { interval: 5, size: '9%' }, | |
153 | labels: { interval: 5 }, | |
154 | style: { fill: '#eeeeee', stroke: '#666666' }, | |
155 | value: 0, | |
156 | colorScheme: 'scheme05', | |
157 | caption: { value: 'Koeler', position: 'bottom', offset: [0, 10] } | |
158 | }, | |
159 | switchoptions = { | |
160 | height: 68, | |
161 | width: 35, | |
162 | onLabel: 'AAN', | |
163 | offLabel: 'UIT', | |
164 | theme: theme, | |
165 | thumbSize: '50%', | |
166 | orientation: 'vertical' | |
167 | }, | |
548
c67cd0d9249b
Version 0.3.23. Maximum fermentation temperature changed to 45 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
526
diff
changeset
|
168 | targetoptions = { inputMode: 'simple', theme: theme, width: 70, min: 0, max: 45, decimalDigits: 1, spinButtons: true }, |
526 | 169 | url = 'getfermenter.php?uuid="' + my_uuid + '"', |
170 | source = { | |
171 | datatype: 'json', | |
172 | datafields: [ | |
173 | { name: 'record', type: 'int' }, | |
174 | { name: 'uuid', type: 'string' }, | |
175 | { name: 'alias', type: 'string' }, | |
176 | { name: 'node', type: 'string' }, | |
177 | { name: 'online', type: 'int' }, | |
178 | { name: 'beercode', type: 'string' }, | |
179 | { name: 'beername', type: 'string' }, | |
180 | { name: 'air_state', type: 'string' }, | |
181 | { name: 'air_temperature', type: 'float' }, | |
182 | { name: 'beer_state', type: 'string' }, | |
183 | { name: 'beer_temperature', type: 'float' }, | |
184 | { name: 'chiller_state', type: 'string' }, | |
185 | { name: 'chiller_temperature', type: 'float' }, | |
186 | { name: 'heater_state', type: 'int' }, | |
187 | { name: 'heater_usage', type: 'int' }, | |
188 | { name: 'cooler_state', type: 'int' }, | |
189 | { name: 'cooler_usage', type: 'int' }, | |
190 | { name: 'fan_state', type: 'int' }, | |
191 | { name: 'fan_usage', type: 'int' }, | |
192 | { name: 'light_address', type: 'string' }, | |
193 | { name: 'light_state', type: 'int' }, | |
194 | { name: 'light_usage', type: 'int' }, | |
195 | { name: 'door_address', type: 'string' }, | |
196 | { name: 'door_state', type: 'int' }, | |
197 | { name: 'psu_address', type: 'string' }, | |
198 | { name: 'psu_state', type: 'int' }, | |
199 | { name: 'mode', type: 'string' }, | |
200 | { name: 'alarm', type: 'int' }, | |
201 | { name: 'setpoint_high', type: 'float' }, | |
202 | { name: 'setpoint_low', type: 'float' }, | |
203 | { name: 'profile_uuid', type: 'string' }, | |
204 | { name: 'profile_name', type: 'string' }, | |
205 | { name: 'profile_state', type: 'string' }, | |
206 | { name: 'profile_percent', type: 'int' }, | |
207 | { name: 'profile_inittemp_high', type: 'float' }, | |
208 | { name: 'profile_inittemp_low', type: 'float' }, | |
209 | { name: 'profile_steps', type: 'string' }, | |
210 | { name: 'stage', type: 'string' }, | |
211 | { name: 'beeruuid', type: 'string' }, | |
212 | { name: 'yeast_lo', type: 'float' }, | |
213 | { name: 'yeast_hi', type: 'float' }, | |
214 | { name: 'webcam_url', type: 'string' }, | |
215 | { name: 'webcam_light', type: 'int' } | |
216 | ], | |
217 | id: 'record', | |
218 | url: url | |
219 | }, | |
220 | dataAdapter = new $.jqx.dataAdapter(source, { | |
221 | loadComplete: function(records) { | |
222 | record = dataAdapter.records[0]; | |
223 | var range, oline = (record.online) ? 'On-line' : 'Off-line'; | |
224 | $('#info_uuid').html(record.uuid); | |
225 | $('#info_system').html(record.node + '/' + record.alias); | |
226 | $('#info_online').html(oline); | |
227 | $('#info_beer').html(record.beercode + ' - ' + record.beername); | |
228 | $('#info_mode').jqxDropDownList('selectItem', record.mode); | |
229 | $('#info_stage').jqxDropDownList('selectItem', record.stage); | |
230 | $('#info_profile').html(record.profile_name); | |
231 | blank['name'] = record.alias; | |
232 | blank['code'] = record.alias.toUpperCase(); | |
233 | blank['uuid'] = record.uuid; | |
234 | if (record.profile_name == '') | |
235 | $('#info_mode').jqxDropDownList('disableItem', 'PROFILE'); | |
236 | else | |
237 | $('#info_mode').jqxDropDownList('enableItem', 'PROFILE'); | |
238 | $('#target_lo').val(record.setpoint_low); | |
239 | $('#target_hi').val(record.setpoint_high); | |
240 | if (record.online && ((record.mode == 'FRIDGE') || (record.mode == 'BEER'))) { | |
241 | $('#target_lo').jqxNumberInput({ readOnly: false, Width: 70, spinButtons: true }); | |
242 | $('#target_hi').jqxNumberInput({ readOnly: false, Width: 70, spinButtons: true }); | |
243 | } else { | |
244 | $('#target_lo').jqxNumberInput({ readOnly: true, Width: 50, spinButtons: false }); | |
245 | $('#target_hi').jqxNumberInput({ readOnly: true, Width: 50, spinButtons: false }); | |
246 | } | |
247 | ||
248 | if (record.online && record.door_address && (record.door_state != '0')) { | |
249 | $('#fermenter_doorled').html('<div class="LEDyellow_on"></div>Door'); | |
250 | } else { | |
251 | $('#fermenter_doorled').html('<div class="LEDyellow_off"></div>Door'); | |
252 | } | |
253 | if (record.online && record.light_address && (record.light_state != '0')) { | |
254 | $('#fermenter_lightled').html('<div class="LEDyellow_on"></div>Light'); | |
255 | } else { | |
256 | $('#fermenter_lightled').html('<div class="LEDyellow_off"></div>Light'); | |
257 | } | |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
258 | |
526 | 259 | if (record.online && (record.mode != 'OFF')) { |
260 | $('#fermenter_powerled').html('<div class="LEDblue_on"></div>Power'); | |
261 | $('#select_beer').jqxDropDownList({ disabled: true }); | |
262 | $('#select_beer').jqxDropDownList('clearSelection'); | |
263 | $('#select_beer').hide(); | |
264 | } else { | |
265 | $('#fermenter_powerled').html('<div class="LEDblue_off"></div>Power'); | |
266 | $('#select_beer').show(); | |
267 | $('#select_beer').jqxDropDownList({ disabled: false }); | |
268 | } | |
269 | if (record.online && (record.alarm != '0')) { | |
270 | $('#fermenter_alarmled').html('<div class="LEDred_on"></div>Alarm'); | |
271 | } else { | |
272 | $('#fermenter_alarmled').html('<div class="LEDred_off"></div>Alarm'); | |
273 | } | |
274 | ||
275 | if (record.online && (record.heater_state != '0')) { | |
276 | $('#fermenter_led1').html('<div class="LEDgreen_on"></div>Heat'); | |
277 | } else { | |
278 | $('#fermenter_led1').html('<div class="LEDgreen_off"></div>Heat'); | |
279 | } | |
280 | if (record.online && (record.cooler_state != '0')) { | |
281 | $('#fermenter_led2').html('<div class="LEDgreen_on"></div>Cool'); | |
282 | } else { | |
283 | $('#fermenter_led2').html('<div class="LEDgreen_off"></div>Cool'); | |
284 | } | |
285 | if (record.online && (record.fan_state != '0')) { | |
286 | $('#fermenter_led3').html('<div class="LEDgreen_on"></div>Fan'); | |
287 | } else { | |
288 | $('#fermenter_led3').html('<div class="LEDgreen_off"></div>Fan'); | |
289 | } | |
290 | if (record.online && (record.mode == 'NONE')) { | |
291 | $('#fermenter_toggle1').jqxSwitchButton('enable'); | |
292 | $('#fermenter_toggle2').jqxSwitchButton('enable'); | |
293 | $('#fermenter_toggle3').jqxSwitchButton('enable'); | |
294 | } else { | |
295 | $('#fermenter_toggle1').jqxSwitchButton('disable'); | |
296 | $('#fermenter_toggle2').jqxSwitchButton('disable'); | |
297 | $('#fermenter_toggle3').jqxSwitchButton('disable'); | |
298 | $('#fermenter_toggle1').val(record.heater_state != '0'); | |
299 | $('#fermenter_toggle2').val(record.cooler_state != '0'); | |
300 | $('#fermenter_toggle3').val(record.fan_state != '0'); | |
301 | } | |
302 | ||
303 | if (record.online && (record.mode == 'PROFILE')) { | |
304 | if (record.profile_state == 'OFF') { | |
305 | $('#select_profile').show(); | |
306 | $('#select_profile').jqxDropDownList({ disabled: false }); | |
307 | $('#info_mode').jqxDropDownList({ disabled: false }); | |
308 | $('#Profile1').jqxButton({ template: 'success', value: 'Starten' }); | |
309 | $('#Profile1').show(); | |
310 | $('#Profile2').hide(); | |
311 | $('#status_profile').html(''); | |
312 | } else if (record.profile_state == 'RUN') { | |
313 | $('#select_profile').jqxDropDownList({ disabled: true }); | |
314 | $('#select_profile').hide(); | |
315 | $('#info_mode').jqxDropDownList({ disabled: true }); | |
316 | $('#Profile1').jqxButton({ template: 'danger', value: 'Afbreken' }); | |
317 | $('#Profile2').jqxButton({ template: 'primary', value: 'Pauze' }); | |
318 | $('#Profile1').show(); | |
319 | $('#Profile2').show(); | |
320 | $('#status_profile').html('Profiel actief, ' + record.profile_percent + '% gereed'); | |
321 | } else if (record.profile_state == 'PAUSE') { | |
322 | $('#select_profile').jqxDropDownList({ disabled: true }); | |
323 | $('#select_profile').hide(); | |
324 | $('#info_mode').jqxDropDownList({ disabled: true }); | |
325 | $('#Profile1').jqxButton({ template: 'danger', value: 'Afbreken' }); | |
326 | $('#Profile2').jqxButton({ template: 'success', value: 'Doorgaan' }); | |
327 | $('#Profile1').show(); | |
328 | $('#Profile2').show(); | |
329 | $('#status_profile').html('Profiel pauze, ' + record.profile_percent + '% gereed'); | |
330 | } else if (record.profile_state == 'DONE') { | |
331 | $('#select_profile').jqxDropDownList({ disabled: true }); | |
332 | $('#select_profile').hide(); | |
333 | $('#info_mode').jqxDropDownList({ disabled: true }); | |
334 | $('#Profile1').jqxButton({ template: 'primary', value: 'Profiel Ok' }); | |
335 | $('#Profile1').show(); | |
336 | $('#Profile2').hide(); | |
337 | $('#status_profile').html('Profiel is gereed'); | |
338 | } | |
339 | } else { | |
340 | $('#select_profile').show(); | |
341 | $('#select_profile').jqxDropDownList({ disabled: false }); | |
342 | $('#info_mode').jqxDropDownList({ disabled: false }); | |
343 | $('#Profile1').hide(); | |
344 | $('#Profile2').hide(); | |
345 | $('#status_profile').html(''); | |
346 | } | |
347 | if (record.online && (record.webcam_url != '')) { | |
348 | $('#Camera').show(); | |
349 | } else { | |
350 | $('#Camera').hide(); | |
351 | } | |
352 | ||
353 | yl = record.yeast_lo; | |
354 | yh = record.yeast_hi; | |
355 | range = { ranges: [{ startValue: 0, endValue: yl, style: { fill: '#3399FF', stroke: '#3399FF' }, endWidth: 10, startWidth: 10 }, | |
356 | { startValue: yl, endValue: yh, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 }, | |
548
c67cd0d9249b
Version 0.3.23. Maximum fermentation temperature changed to 45 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
526
diff
changeset
|
357 | { startValue: yh, endValue: 45, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }]}; |
526 | 358 | $('#gaugeContainer_air').jqxGauge(range); |
359 | $('#gaugeContainer_beer').jqxGauge(range); | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
360 | |
526 | 361 | $('#gaugeContainer_air').jqxGauge({ caption: { value: 'Lucht: ' + record.air_temperature.toFixed(3) }}); |
362 | $('#gaugeContainer_air').jqxGauge({ value: record.air_temperature }); | |
363 | if (record.air_state == 'OK') { | |
364 | $('#gaugeContainer_air').jqxGauge({ disabled: false }); | |
365 | } else { | |
366 | $('#gaugeContainer_air').jqxGauge({ disabled: true }); | |
367 | } | |
368 | $('#gaugeContainer_beer').jqxGauge({ caption: { value: 'Bier: ' + record.beer_temperature.toFixed(3) }}); | |
369 | $('#gaugeContainer_beer').jqxGauge({ value: record.beer_temperature }); | |
370 | if (record.beer_state == 'OK') { | |
371 | $('#gaugeContainer_beer').jqxGauge({ disabled: false }); | |
372 | } else { | |
373 | $('#gaugeContainer_beer').jqxGauge({ disabled: true }); | |
374 | } | |
375 | $('#gaugeContainer_chiller').jqxGauge({ value: record.chiller_temperature }); | |
376 | if (record.chiller_state == 'OK') { | |
377 | $('#gaugeContainer_chiller').jqxGauge({ disabled: false }); | |
378 | } else { | |
379 | $('#gaugeContainer_chiller').jqxGauge({ disabled: true }); | |
380 | } | |
381 | } | |
382 | }); | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
383 | |
526 | 384 | $('#select_beer').jqxDropDownList({ |
385 | placeHolder: 'Kies bier:', | |
386 | theme: theme, | |
387 | source: productlist, | |
388 | displayMember: 'code', | |
389 | width: 150, | |
390 | height: 24, | |
391 | dropDownWidth: 500, | |
392 | autoDropDownHeight: true, | |
393 | renderer: function(index, label, value) { | |
394 | var datarecord = productlist.records[index]; | |
395 | return datarecord.code + ' - ' + datarecord.name; | |
396 | } | |
397 | }); | |
398 | $('#select_profile').jqxDropDownList({ | |
399 | placeHolder: 'Kies profiel:', | |
400 | theme: theme, | |
401 | source: profilelist, | |
402 | displayMember: 'name', | |
403 | width: 150, | |
404 | height: 24, | |
405 | dropDownWidth: 500, | |
406 | autoDropDownHeight: true, | |
407 | }); | |
408 | ||
409 | $('#gaugeContainer_air').jqxGauge(gaugeoptions); | |
410 | $('#gaugeContainer_air').jqxGauge({ caption: { value: 'Lucht: 00.000' }}); | |
411 | $('#gaugeContainer_beer').jqxGauge(gaugeoptions); | |
412 | $('#gaugeContainer_beer').jqxGauge({ caption: { value: 'Bier: 00.000' }}); | |
413 | $('#gaugeContainer_chiller').jqxGauge(gaugeSmalloptions); | |
414 | ||
415 | $('#fermenter_toggle1').jqxSwitchButton(switchoptions); | |
416 | $('#fermenter_toggle2').jqxSwitchButton(switchoptions); | |
417 | $('#fermenter_toggle3').jqxSwitchButton(switchoptions); | |
418 | ||
419 | srcMode = ['OFF', 'NONE', 'FRIDGE', 'BEER', 'PROFILE']; | |
420 | srcStage = ['PRIMARY', 'SECONDARY', 'TERTIARY', 'CARBONATION']; | |
421 | $('#info_mode').jqxDropDownList({ theme: theme, source: srcMode, width: 100, height: 24, dropDownHeight: 156 }); | |
422 | $('#info_stage').jqxDropDownList({ theme: theme, source: srcStage, width: 150, height: 24, dropDownHeight: 125 }); | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
423 | |
526 | 424 | $('#target_lo').jqxNumberInput(targetoptions); |
425 | $('#target_hi').jqxNumberInput(targetoptions); | |
426 | ||
427 | $('#Profile1').jqxButton({ template: 'info', width: '150px', height: 24, theme: theme }); | |
428 | $('#Profile2').jqxButton({ template: 'info', width: '150px', height: 24, theme: theme }); | |
429 | $('#Profile1').hide(); // Hide these until they are needed. | |
430 | $('#Profile2').hide(); | |
431 | ||
432 | function sendBase(stage, mode, tlo, thi) { | |
433 | ||
434 | console.log('sendBase(' + stage + ', ' + mode + ', ' + tlo + ', ' + thi + ')'); | |
435 | var data = 'node=' + record.node + '&alias=' + record.alias + '&payload={"stage":"' + stage; | |
436 | data += '","mode":"' + mode + '","setpoint":{"low":' + tlo + ',"high":' + thi + '}}'; | |
437 | $.ajax({ | |
438 | url: 'cmd_fermenter.php', | |
439 | data: data, | |
440 | type: 'POST', | |
441 | success: function(data) {}, | |
442 | error: function(jqXHR, textStatus, errorThrown) { console.log('sendBase() error'); } | |
443 | }); | |
444 | } | |
445 | ||
446 | function sendSwitch(sw1, sw2, sw3, sw4) { | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
447 | |
526 | 448 | console.log('sendSwitch(' + sw1 + ', ' + sw2 + ', ' + sw3 + ', ' + sw4 + ')'); |
449 | var data = 'node=' + record.node + '&alias=' + record.alias + '&payload='; | |
450 | data += '{"heater":{"state":' + sw1 + '},"cooler":{"state":' + sw2 + '},"fan":{"state":' + sw3 + '},"light":{"state":' + sw4 + '}}'; | |
451 | $.ajax({ | |
452 | url: 'cmd_fermenter.php', | |
453 | data: data, | |
454 | type: 'POST', | |
455 | success: function(data) {}, | |
456 | error: function(jqXHR, textStatus, errorThrown) { console.log('sendSwitch() error'); } | |
457 | }); | |
458 | } | |
459 | ||
460 | function sendProduct(code, name, uuid, yeast_lo, yeast_hi) { | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
461 | |
526 | 462 | console.log('sendProduct(' + code + ', ' + name + ', ' + uuid + ', ' + yeast_lo + ', ' + yeast_hi + ')'); |
463 | var data = 'node=' + record.node + '&alias=' + record.alias + '&payload='; | |
464 | data += '{"product":{"code":"' + code + '","name":"' + name + '","uuid":"' + uuid + '","yeast_lo":' + yeast_lo + ',"yeast_hi":' + yeast_hi + '}}'; | |
465 | $.ajax({ | |
466 | url: 'cmd_fermenter.php', | |
467 | data: data, | |
468 | type: 'POST', | |
469 | success: function(data) {}, | |
470 | error: function(jqXHR, textStatus, errorThrown) { console.log('sendProduct() error'); } | |
471 | }); | |
472 | } | |
473 | ||
474 | function sendProfile(payload) { | |
475 | ||
476 | console.log('sendProfile(' + payload + ')'); | |
477 | var data = 'node=' + record.node + '&alias=' + record.alias + '&payload=' + payload; | |
478 | $.ajax({ | |
479 | url: 'cmd_fermenter.php', | |
480 | data: data, | |
481 | type: 'POST', | |
482 | success: function(data) {}, | |
483 | error: function(jqXHR, textStatus, errorThrown) { console.log('sendProfile() error'); } | |
484 | }); | |
485 | } | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
486 | |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
455
diff
changeset
|
487 | |
526 | 488 | // Get the data immediatly and then at regular intervals to refresh. |
489 | dataAdapter.dataBind(); | |
490 | setInterval(function() { | |
491 | var skip = false; | |
492 | if (newBase) { | |
493 | sendBase(record.stage, record.mode, record.setpoint_low, record.setpoint_high); | |
494 | newBase = false; | |
495 | skip = true; | |
496 | } | |
497 | if (newSwitch) { | |
498 | sendSwitch(record.heater_state, record.cooler_state, record.fan_state, record.light_state); | |
499 | newSwitch = false; | |
500 | skip = true; | |
501 | } | |
502 | if (newProduct) { | |
503 | sendProduct(record.beercode, record.beername, record.beeruuid, record.yeast_lo, record.yeast_hi); | |
504 | newProduct = false; | |
505 | skip = true; | |
506 | } | |
507 | if (newProfile) { | |
508 | sendProfile(ppayload); | |
509 | newProfile = false; | |
510 | skip = true; | |
511 | } | |
512 | if (skip) { | |
513 | schedule = 4; // 2 seconds wait to get the results | |
514 | } else { | |
515 | if (schedule > 0) | |
516 | schedule--; | |
517 | } | |
189
6470e5c6a001
In bmsd added missing json percent. The Makefile didn't install the fpdf library. Added profile commands. Small changes to the monitor fermenters screen. The monitor fermenters scheduler is now more responsive. Profiles selection and commands in the remote thermferm.
Michiel Broek <mbroek@mbse.eu>
parents:
188
diff
changeset
|
518 | |
526 | 519 | if (schedule <= 0) { |
520 | dataAdapter.dataBind(); | |
521 | schedule = 20; | |
522 | } | |
523 | }, 500); | |
185
4c25db9e8102
Added configuration settings for MQTT in config.php. Finished screen box sizes for the fermenters monitor. Select beername and code from the current brew products and send it to the fermenter. Added switch commands to the fermenter. Delay data get from the fermenter after sending any command so there is time to process the commands. Turn switches off when the mode changes. Removed 0.2 degrees setpoint diffs for low and high, the fermenter must deal with it. Prevent turning the heater and cooler together on.
Michiel Broek <mbroek@mbse.eu>
parents:
184
diff
changeset
|
524 | |
645
3b1510050c9b
Changed the last dropdown lists events to select
Michiel Broek <mbroek@mbse.eu>
parents:
548
diff
changeset
|
525 | $('#info_mode').on('select', function(event) { |
526 | 526 | var args = event.args; |
527 | if (args) { | |
528 | record.mode = args.item.value; | |
529 | $('#fermenter_toggle1').val(0); | |
530 | $('#fermenter_toggle2').val(0); | |
531 | $('#fermenter_toggle3').val(0); | |
532 | } | |
533 | newBase = true; | |
534 | }); | |
535 | $('#info_stage').on('select', function(event) { | |
536 | var args = event.args; | |
537 | if (args) | |
538 | record.stage = args.item.value; | |
539 | newBase = true; | |
540 | }); | |
541 | $('#select_beer').on('select', function(event) { | |
542 | if (event.args) { | |
543 | var index = event.args.index, | |
544 | datarecord = productlist.records[index]; | |
545 | record.beercode = datarecord.code; | |
546 | record.beername = datarecord.name; | |
547 | record.beeruuid = datarecord.uuid; | |
548 | record.yeast_lo = datarecord.yeast_lo; | |
549 | record.yeast_hi = datarecord.yeast_hi; | |
550 | newProduct = true; | |
551 | } | |
552 | }); | |
553 | $('#select_profile').on('select', function(event) { | |
554 | if (event.args) { | |
555 | var index = event.args.index, | |
556 | datarecord = profilelist.records[index], | |
557 | row, i; | |
558 | if (datarecord.record == -1) { | |
559 | ppayload = '{"profile":null}'; | |
560 | } else { | |
561 | ppayload = '{"profile":{"uuid":"' + datarecord.uuid + '","name":"' + datarecord.name + '",'; | |
562 | ppayload += '"inittemp":{"low":' + datarecord.inittemp_lo + ',"high":' + datarecord.inittemp_hi + '},'; | |
563 | ppayload += '"fridgemode":' + datarecord.fridgemode + ',"steps":['; | |
564 | for (i = 0; i < datarecord.steps.length; i++) { | |
565 | row = datarecord.steps[i]; | |
566 | if (i > 0) | |
567 | ppayload += ','; | |
568 | ppayload += '{"steptime":' + row['steptime'] + ',"resttime":' + row['resttime']; | |
569 | ppayload += ',"target_lo":' + row['target_lo'] + ',"target_hi":' + row['target_hi']; | |
570 | ppayload += ',"fridgemode":' + row['fridgemode'] + ',"name":"' + row['name'] + '"}'; | |
571 | } | |
572 | ppayload += ']}}'; | |
573 | } | |
574 | newProfile = true; | |
575 | } | |
576 | }); | |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
577 | |
526 | 578 | $('#target_lo').on('change', function(event) { |
579 | record.setpoint_low = parseFloat(event.args.value); | |
580 | // Keep the high target above the low. | |
581 | if (record.setpoint_low > record.setpoint_high) { | |
582 | record.setpoint_high = record.setpoint_low; | |
583 | $('#target_hi').val(record.setpoint_high); | |
584 | } | |
585 | newBase = true; | |
586 | }); | |
587 | $('#target_hi').on('change', function(event) { | |
588 | record.setpoint_high = parseFloat(event.args.value); | |
589 | // Keep the low target below the high. | |
590 | if (record.setpoint_high < record.setpoint_low) { | |
591 | record.setpoint_low = record.setpoint_high; | |
592 | $('#target_lo').val(record.setpoint_low); | |
593 | } | |
594 | newBase = true; | |
595 | }); | |
183
a810539dc218
Added cmd_fermenter.php which interfaces http POST commands to MQTT using mosquitto_pub in a shell. Several chnges to the monitor fermenter screen.
Michiel Broek <mbroek@mbse.eu>
parents:
182
diff
changeset
|
596 | |
526 | 597 | $('#fermenter_toggle1').on('checked', function(event) { |
598 | if (record.mode == 'NONE') { | |
599 | record.heater_state = 0; | |
600 | newSwitch = true; | |
601 | } | |
602 | }); | |
603 | $('#fermenter_toggle1').on('unchecked', function(event) { | |
604 | if (record.mode == 'NONE') { | |
605 | record.heater_state = 100; | |
606 | record.cooler_state = 0; | |
607 | $('#fermenter_toggle2').val(0); | |
608 | newSwitch = true; | |
609 | } | |
610 | }); | |
611 | $('#fermenter_toggle2').on('checked', function(event) { | |
612 | if (record.mode == 'NONE') { | |
613 | record.cooler_state = 0; | |
614 | newSwitch = true; | |
615 | } | |
616 | }); | |
617 | $('#fermenter_toggle2').on('unchecked', function(event) { | |
618 | if (record.mode == 'NONE') { | |
619 | record.cooler_state = 100; | |
620 | record.heater_state = 0; | |
621 | $('#fermenter_toggle1').val(0); | |
622 | newSwitch = true; | |
623 | } | |
624 | }); | |
625 | $('#fermenter_toggle3').on('checked', function(event) { | |
626 | if (record.mode == 'NONE') { | |
627 | record.fan_state = 0; | |
628 | newSwitch = true; | |
629 | } | |
630 | }); | |
631 | $('#fermenter_toggle3').on('unchecked', function(event) { | |
632 | if (record.mode == 'NONE') { | |
633 | record.fan_state = 100; | |
634 | newSwitch = true; | |
635 | } | |
636 | }); | |
637 | $('#Profile1').click(function() { | |
638 | if (record.mode == 'PROFILE') { | |
639 | if (record.profile_state == 'OFF') { | |
640 | ppayload = '{"profile":{"command":"start"}}'; | |
641 | newProfile = true; | |
642 | } else if ((record.profile_state == 'RUN') || (record.profile_state == 'PAUSE')) { | |
643 | // Open a popup to confirm this action. | |
644 | $('#eventWindow').jqxWindow('open'); | |
645 | $('#delOk').click(function() { | |
646 | ppayload = '{"profile":{"command":"abort"}}'; | |
647 | newProfile = true; | |
648 | }); | |
649 | } else if (record.profile_state == 'DONE') { | |
650 | ppayload = '{"profile":{"command":"done"}}'; | |
651 | newProfile = true; | |
652 | } | |
653 | } | |
654 | }); | |
655 | $('#Profile2').click(function() { | |
656 | if (record.mode == 'PROFILE') { | |
657 | if ((record.profile_state == 'RUN') || (record.profile_state == 'PAUSE')) { | |
658 | ppayload = '{"profile":{"command":"pause"}}'; | |
659 | newProfile = true; | |
660 | } | |
661 | } | |
662 | }); | |
183
a810539dc218
Added cmd_fermenter.php which interfaces http POST commands to MQTT using mosquitto_pub in a shell. Several chnges to the monitor fermenter screen.
Michiel Broek <mbroek@mbse.eu>
parents:
182
diff
changeset
|
663 | |
526 | 664 | // The chart button. |
665 | $('#FLog').jqxButton({ template: 'primary', width: '150px', theme: theme }); | |
666 | $('#FLog').click(function() { | |
667 | window.open('log_fermentation.php?code=' + record.beercode + '&name=' + record.beername); | |
668 | }); | |
669 | $('#Camera').jqxButton({ template: 'primary', width: '150px', theme: theme }); | |
670 | $('#Camera').click(function() { | |
671 | record.light_state = 100; | |
672 | newSwitch = true; | |
673 | window.open(record.webcam_url); | |
674 | }); | |
675 | createAbortElements(); | |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
676 | }); |