www/js/mon_ispindel.js

Sat, 25 Sep 2021 10:42:54 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Sep 2021 10:42:54 +0200
changeset 778
e64fd38c469c
parent 699
4d5f3e9f7744
child 848
542bdc7f6522
permissions
-rw-r--r--

If during styles import the CATEGORY_NUMBER is empty, insert 0 in the database instead.

570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /*****************************************************************************
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
2 * Copyright (C) 2019-2020
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Michiel Broek <mbroek at mbse dot eu>
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * This file is part of BMS
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This is free software; you can redistribute it and/or modify it
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * under the terms of the GNU General Public License as published by the
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * Free Software Foundation; either version 2, or (at your option) any
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * later version.
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 *
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * Brewery Management System istributed in the hope that it will be useful, but
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * General Public License for more details.
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 *
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 *****************************************************************************/
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 $(document).ready(function() {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 var record = {},
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 blank = {},
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 productSource = {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 datatype: 'json',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 cache: false,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 datafields: [
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 { name: 'code', type: 'string' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 { name: 'name', type: 'string' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 { name: 'uuid', type: 'string' }
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 ],
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 id: 'code',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 url: 'includes/db_product.php?select=ferment'
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 productlist = new $.jqx.dataAdapter(productSource, {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 beforeLoadComplete: function(records) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 var row, i, data = new Array();
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 // Create a dummy beer on top to store in idle meters.
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 blank['code'] = 'Free'; // Will override this later.
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 blank['name'] = 'Dummy';
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 blank['uuid'] = '66ecccbf-e942-4a35-af49-8b02314561a5';
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 data.push(blank);
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 for (i = 0; i < records.length; i++) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 row = records[i];
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 data.push(row);
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 }
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 return data;
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 },
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
54 loadError: function(jqXHR, status, error) { console.log(status + ' ' + error); },
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 }),
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 gaugeoptionst = {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 min: 10, max: 40, width: 375, height: 375,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 ranges: [{ startValue: 10, endValue: 20, style: { fill: '#3399FF', stroke: '#3399FF' }, endWidth: 10, startWidth: 10 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 { startValue: 20, endValue: 28, style: { fill: '#00CC33', stroke: '#00CC33' }, endWidth: 10, startWidth: 10 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 { startValue: 28, endValue: 40, style: { fill: '#FC6A6A', stroke: '#FC6A6A' }, endWidth: 10, startWidth: 10 }],
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 ticksMinor: { interval: 1, size: '5%' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 ticksMajor: { interval: 5, size: '9%' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 labels: { interval: 5 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 style: { fill: '#eeeeee', stroke: '#666666' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 value: 0,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 colorScheme: 'scheme05'
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 gaugeoptionsg = {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 orientation: 'vertical',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 labels: { position: 'near', interval: 10 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 ticksMinor: { size: '5%', interval: 2 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 ticksMajor: { size: '9%', interval: 10 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 ticksPosition: 'near',
579
1253a237b620 Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents: 578
diff changeset
74 min: 0990, max: 1150, width: 120, height: 375,
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 value: 1000,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 pointer: { pointerType: 'arrow', size: '15%', visible: true, offset: 0 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 colorScheme: 'scheme05',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 showRanges: false
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 },
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
80 url = 'getispindel.php?uuid="' + my_uuid + '"',
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 source = {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 datatype: 'json',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 datafields: [
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 { name: 'record', type: 'int' },
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
85 { name: 'uuid', type: 'string' },
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
86 { name: 'alias', type: 'string' },
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 { name: 'node', type: 'string' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 { name: 'online', type: 'int' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 { name: 'beercode', type: 'string' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 { name: 'beername', type: 'string' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 { name: 'beeruuid', type: 'string' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 { name: 'alarm', type: 'int' },
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
93 { name: 'angle', type: 'float' },
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 { name: 'temperature', type: 'float' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 { name: 'battery', type: 'float' },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 { name: 'gravity', type: 'float' },
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
97 { name: 'up_interval', type: 'int' },
628
a42166cbb19a Record iSpindel original plato by updating to the highest measured value. Reset this value when a new beer is set. Added current status to the monitor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 596
diff changeset
98 { name: 'mode', type: 'string' },
a42166cbb19a Record iSpindel original plato by updating to the highest measured value. Reset this value when a new beer is set. Added current status to the monitor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 596
diff changeset
99 { name: 'og_gravity', type: 'float' }
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 ],
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 id: 'record',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 url: url
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 },
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 dataAdapter = new $.jqx.dataAdapter(source, {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 loadComplete: function(records) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 record = dataAdapter.records[0];
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
107 updateScreen();
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
108 blank['name'] = record.alias;
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
109 blank['code'] = record.alias.toUpperCase();
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
110 blank['uuid'] = record.uuid;
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
111 }
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
112 });
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
114 function updateScreen() {
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
115
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
116 $('#info_uuid').html(record.uuid);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
117 $('#info_system').html(record.node + '/' + record.alias);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
118 $('#info_beer').html(record.beercode + ' - ' + record.beername);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
119 $('#info_mode').jqxDropDownList('selectItem', record.mode);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
120
681
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
121 if (record.mode != 'OFF') {
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
122 $('#select_beer').jqxDropDownList({ disabled: true });
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
123 $('#select_beer').jqxDropDownList('clearSelection');
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
124 $('#select_beer').hide();
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
125 } else {
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
126 $('#select_beer').show();
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
127 $('#select_beer').jqxDropDownList({ disabled: false });
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
128 }
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
129
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
130 if (record.online) {
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
131 $('#info_online').html('On-line');
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
132 if (record.mode != 'OFF') {
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 $('#ispindel_powerled').html('<div class="LEDblue_on"></div>Power');
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 } else {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 $('#ispindel_powerled').html('<div class="LEDblue_off"></div>Power');
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 }
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 if (record.online && (record.alarm != '0')) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 $('#ispindel_alarmled').html('<div class="LEDred_on"></div>Alarm');
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 } else {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 $('#ispindel_alarmled').html('<div class="LEDred_off"></div>Alarm');
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 }
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
143 $('#gaugeContainer_temperature').jqxGauge({ disabled: false });
681
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
144 $('#gaugeContainer_gravity').jqxLinearGauge({ disabled: false })
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145
628
a42166cbb19a Record iSpindel original plato by updating to the highest measured value. Reset this value when a new beer is set. Added current status to the monitor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 596
diff changeset
146 var sg = plato_to_sg(record.gravity);
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 $('#info_battery').val(record.battery);
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
148 $('#info_tilt').val(record.angle);
579
1253a237b620 Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents: 578
diff changeset
149 $('#info_plato').val(record.gravity);
628
a42166cbb19a Record iSpindel original plato by updating to the highest measured value. Reset this value when a new beer is set. Added current status to the monitor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 596
diff changeset
150 $('#info_sg').val(sg);
a42166cbb19a Record iSpindel original plato by updating to the highest measured value. Reset this value when a new beer is set. Added current status to the monitor screen.
Michiel Broek <mbroek@mbse.eu>
parents: 596
diff changeset
151
629
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
152 if (record.og_gravity) {
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
153 var og = plato_to_sg(record.og_gravity);
655
f4e00869f39f Calculate the svg using Brew by the Numbers, Micahel L. Hall.
Michiel Broek <mbroek@mbse.eu>
parents: 645
diff changeset
154 var svg = calc_svg(og, sg);
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
155 var max = Math.ceil(og * 100, 0) * 10;
681
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
156 var gravity = sg * 1000;
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
158 console.log ('set max ' + max);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
159 $('#gaugeContainer_gravity').jqxLinearGauge({ max: max });
629
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
160 $('#vg_og1').html(og.toFixed(4));
699
4d5f3e9f7744 More decimals for Plato
Michiel Broek <mbroek@mbse.eu>
parents: 685
diff changeset
161 $('#vg_og2').html(record.og_gravity.toFixed(3) + '&deg;P');
629
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
162 $('#vg_sg1').html(sg.toFixed(4));
699
4d5f3e9f7744 More decimals for Plato
Michiel Broek <mbroek@mbse.eu>
parents: 685
diff changeset
163 $('#vg_sg2').html(record.gravity.toFixed(3) + '&deg;P');
631
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
164 $('#vg_svg').html(svg.toFixed(1) + '%');
629
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
165 $('#vg_abv').html(abvol(og, sg).toFixed(2) + '%');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
166 } else {
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
167 $('#gaugeContainer_gravity').jqxLinearGauge({ max: 1150 });
629
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
168 $('#vg_og1').html('');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
169 $('#vg_og2').html('');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
170 $('#vg_sg1').html('');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
171 $('#vg_sg2').html('');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
172 $('#vg_svg').html('');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
173 $('#vg_abv').html('');
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
174 }
92afe6b59610 Division by zero protection
Michiel Broek <mbroek@mbse.eu>
parents: 628
diff changeset
175
631
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
176 var batt = record.battery - 3.064; // 0% voltage.
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
177 if (batt < 0)
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
178 batt = 0;
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
179 batt = Math.round(batt / 1.17875 * 100); // 100% range
632
8a2f2e76c727 Fix battery level above 100%
Michiel Broek <mbroek@mbse.eu>
parents: 631
diff changeset
180 if (batt > 100)
8a2f2e76c727 Fix battery level above 100%
Michiel Broek <mbroek@mbse.eu>
parents: 631
diff changeset
181 batt = 100;
631
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
182 $('#vg_batt').html(batt + '%');
450ac489bbe7 Added battery status percentage.
Michiel Broek <mbroek@mbse.eu>
parents: 629
diff changeset
183
681
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
184 $('#gaugeContainer_temperature').jqxGauge({ caption: { value: record.temperature.toFixed(3) + '°C' }});
7ed5c380e21b Removed some debug log messages. Fixed beer select during offline mode. Fixed block show temperature after offline.
Michiel Broek <mbroek@mbse.eu>
parents: 680
diff changeset
185 $('#gaugeContainer_temperature').jqxGauge({ value: record.temperature });
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 $('#gaugeContainer_gravity').jqxLinearGauge({ value: gravity });
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
187
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
188 } else { // offline
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
189 $('#info_online').html('Off-line');
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
190 $('#ispindel_powerled').html('<div class="LEDblue_off"></div>Power');
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
191 $('#ispindel_alarmled').html('<div class="LEDred_on"></div>Alarm');
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
192 $('#gaugeContainer_temperature').jqxGauge({ disabled: true });
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
193 $('#gaugeContainer_gravity').jqxLinearGauge({ disabled: true });
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 }
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
195 }
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 $('#select_beer').jqxDropDownList({
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 placeHolder: 'Kies bier:',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 theme: theme,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 source: productlist,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 displayMember: 'code',
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 width: 150,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 height: 24,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 dropDownWidth: 500,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 autoDropDownHeight: true,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 renderer: function(index, label, value) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 var datarecord = productlist.records[index];
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 return datarecord.code + ' - ' + datarecord.name;
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 }
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 });
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211
596
2270a73628b5 iSpindel battery voltage shows 3 decimals.
Michiel Broek <mbroek@mbse.eu>
parents: 593
diff changeset
212 $('#info_battery').jqxNumberInput(Show3dec);
587
31caffee8c9c Changed several float precision values. Changed some database fields to double. Everything has now the same precision as received values from the iSpindel.
Michiel Broek <mbroek@mbse.eu>
parents: 580
diff changeset
213 $('#info_tilt').jqxNumberInput(Show5dec);
699
4d5f3e9f7744 More decimals for Plato
Michiel Broek <mbroek@mbse.eu>
parents: 685
diff changeset
214 $('#info_plato').jqxNumberInput(Show3dec);
579
1253a237b620 Added check for database changes for iSpindels such as a new beer, or changing mode. Added denity in Plato and SG to the iSpindel web screen. The iSpindels must be calibrated in Plato! A bit of documentation updated.
Michiel Broek <mbroek@mbse.eu>
parents: 578
diff changeset
215 $('#info_sg').jqxNumberInput(Show4dec);
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 $('#gaugeContainer_temperature').jqxGauge(gaugeoptionst);
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
218 $('#gaugeContainer_temperature').jqxGauge({ caption: { value: '0.000°C' }});
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 $('#gaugeContainer_gravity').jqxLinearGauge(gaugeoptionsg);
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
221 srcMode = ['OFF', 'ON'];
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
222 $('#info_mode').jqxDropDownList({ theme: theme, source: srcMode, width: 100, height: 24, dropDownHeight: 65 });
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
223
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
224 // Get the data immediatly.
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 dataAdapter.dataBind();
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 $('#select_beer').on('select', function(event) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 if (event.args) {
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 var index = event.args.index,
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 datarecord = productlist.records[index];
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 record.beercode = datarecord.code;
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 record.beername = datarecord.name;
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 record.beeruuid = datarecord.uuid;
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
234 console.log('Select beer ' + record.beercode + ', ' + record.beername);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
235 websocket.send('{"device":"ispindels","node":"' + record.node + '","unit":"' + record.alias +
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
236 '","beeruuid":"' + record.beeruuid + '","beercode":"' + record.beercode + '","beername":"' + record.beername + '"}');
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237 }
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 });
645
3b1510050c9b Changed the last dropdown lists events to select
Michiel Broek <mbroek@mbse.eu>
parents: 632
diff changeset
239 $('#info_mode').on('select', function(event) {
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
240 if (event.args && event.args.item.value != record.mode) {
593
e0230bf4ac3f Less logging noise.
Michiel Broek <mbroek@mbse.eu>
parents: 587
diff changeset
241 record.mode = event.args.item.value;
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
242 websocket.send('{"device":"ispindels","node":"' + record.node + '","unit":"' + record.alias + '","mode":"' + record.mode + '"}');
578
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
243 }
e75ce5bbda73 Changed the interface from the iSpindels to be the same as other devices. A webpage converts each call to two standard MQTT messages. The nodes MQTT message extended with an interval parameter. iSpindels now have a generated uuid made up from the chipid.
Michiel Broek <mbroek@mbse.eu>
parents: 570
diff changeset
244 });
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 // The chart button.
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 $('#VLog').jqxButton({ template: 'primary', width: '150px', theme: theme });
580
9cd6873bda75 Fixed ispindel_death. Added ispindel log graph.
Michiel Broek <mbroek@mbse.eu>
parents: 579
diff changeset
248 $('#VLog').click(function() {
9cd6873bda75 Fixed ispindel_death. Added ispindel log graph.
Michiel Broek <mbroek@mbse.eu>
parents: 579
diff changeset
249 window.open('log_ispindel.php?code=' + record.beercode + '&name=' + record.beername);
9cd6873bda75 Fixed ispindel_death. Added ispindel log graph.
Michiel Broek <mbroek@mbse.eu>
parents: 579
diff changeset
250 });
680
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
251
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
252 websocket.onmessage = function(evt) {
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
253 var msg = evt.data;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
254 var obj = JSON.parse(msg);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
255 if (obj.device == "ispindels" && obj.node == record.node) {
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
256 console.log('ws got this device ' + msg);
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
257 record.online = obj.online;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
258 if (obj.online) {
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
259 record.beeruuid = obj.beeruuid;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
260 record.beercode = obj.beercode;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
261 record.beername = obj.beername;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
262 record.mode = obj.mode;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
263 record.alarm = obj.alarm;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
264 record.angle = obj.angle;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
265 record.temperature = obj.temperature;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
266 record.battery = obj.battery;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
267 record.gravity = obj.gravity;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
268 record.up_interval = obj.up_interval;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
269 record.og_gravity = obj.og_gravity;
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
270 }
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
271 updateScreen();
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
272 }
0bb48333d133 Fixed missing co2meters websocket data. Added websockets and removed polling for the mon-ispindel screen. The iSpindel SG gauge adjusts the resolution to the highest detected OG.
Michiel Broek <mbroek@mbse.eu>
parents: 655
diff changeset
273 }
570
c8a20234d7e7 Added iSpindel monitor screen design.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 });

mercurial