Mon, 06 Jan 2020 11:35:26 +0100
Display alcohol tolerance with 1 decimal
181
db4e62482d0b
Moved javascript out of mon_node.php
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:
573
diff
changeset
|
2 | * Copyright (C) 2019-2020 |
181
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of BMS |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * This is free software; you can redistribute it and/or modify it |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * Brewery Management System istributed in the hope that it will be useful, but |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
526 | 24 | $(document).ready(function() { |
181
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | |
526 | 26 | var url = 'getnode.php?uuid="' + my_uuid + '"', |
27 | source = { | |
28 | datatype: 'json', | |
29 | datafields: [ | |
30 | { name: 'record', type: 'int' }, | |
31 | { name: 'uuid', type: 'string' }, | |
32 | { name: 'node', type: 'string' }, | |
572
7a03181d29a3
Version 0.3.27 More code for iSpindels. All online/offline data in the database is now handles as integers. Nodes timeout use the configured interval time from the nodes.
Michiel Broek <mbroek@mbse.eu>
parents:
526
diff
changeset
|
33 | { name: 'online', type: 'int' }, |
526 | 34 | { name: 'group_id', type: 'string' }, |
35 | { name: 'hardwaremake', type: 'string' }, | |
36 | { name: 'hardwaremodel', type: 'string' }, | |
37 | { name: 'os', type: 'string' }, | |
38 | { name: 'os_version', type: 'string' }, | |
39 | { name: 'firmware', type: 'string' }, | |
40 | { name: 'firstseen', type: 'string' }, | |
41 | { name: 'lastseen', type: 'string' }, | |
42 | { name: 'temperature', type: 'float' }, | |
43 | { name: 'humidity', type: 'float' }, | |
44 | { name: 'barometer', type: 'float' }, | |
45 | { name: 'gps_latitude', type: 'float' }, | |
46 | { name: 'gps_longitude', type: 'float' }, | |
47 | { name: 'gps_altitude', type: 'float' }, | |
48 | { name: 'net_address', type: 'string' }, | |
49 | { name: 'net_ifname', type: 'string' }, | |
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:
573
diff
changeset
|
50 | { name: 'net_rssi', type: 'int' }, |
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:
573
diff
changeset
|
51 | { name: 'up_interval', type: 'int' } |
526 | 52 | ], |
53 | id: 'record', | |
54 | url: url | |
55 | }, | |
56 | dataAdapter = new $.jqx.dataAdapter(source, { | |
57 | loadComplete: function(records) { | |
58 | var record = dataAdapter.records[0], | |
573
c4c891d5c4f8
Fix a small bug in mon_nodes view. More relaxed check nodes timeout, now 5 seconds instead of 0,1 second.
Michiel Broek <mbroek@mbse.eu>
parents:
572
diff
changeset
|
59 | oline = (record.online) ? 'On-line' : 'Off-line', |
526 | 60 | html = '<div id="node_table">'; |
61 | html += '<table style="width: 100%; padding: 10px;">'; | |
62 | html += '<tr><th colspan=2>Systeem overzicht</th></tr>'; | |
63 | html += '<tr><td>Uuid</td><td>' + record.uuid + '</td></tr>'; | |
64 | html += '<tr><td>Systeem</td><td>' + record.node + '</td></tr>'; | |
572
7a03181d29a3
Version 0.3.27 More code for iSpindels. All online/offline data in the database is now handles as integers. Nodes timeout use the configured interval time from the nodes.
Michiel Broek <mbroek@mbse.eu>
parents:
526
diff
changeset
|
65 | html += '<tr><td>Online</td><td>' + oline + '</td></tr>'; |
526 | 66 | html += '<tr><td>Type</td><td>' + record.group_id + '</td></tr>'; |
67 | html += '<tr><td>Eerst gezien</td><td>' + record.firstseen + '</td></tr>'; | |
68 | html += '<tr><td>Laatst gezien</td><td>' + record.lastseen + '</td></tr>'; | |
69 | html += '<tr><td>Hardware maker</td><td>' + record.hardwaremake + '</td></tr>'; | |
70 | html += '<tr><td>Hardware model</td><td>' + record.hardwaremodel + '</td></tr>'; | |
71 | html += '<tr><td>OS</td><td>' + record.os + ' versie: ' + record.os_version + '</td></tr>'; | |
72 | html += '<tr><td>Firmware</td><td>' + record.firmware + '</td></tr>'; | |
73 | if (record.online) { | |
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:
573
diff
changeset
|
74 | if (record.temperature > 0) { |
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:
573
diff
changeset
|
75 | html += '<tr><td>Temperatuur</td><td>' + record.temperature.toFixed(1) + '°C</td></tr>'; |
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:
573
diff
changeset
|
76 | } |
526 | 77 | if (record.humidity > 0) { |
78 | html += '<tr><td>Vochtigheid</td><td>' + record.humidity.toFixed(1) + '%</td></tr>'; | |
79 | } | |
80 | if (record.barometer > 0) { | |
81 | html += '<tr><td>Luchtdruk</td><td>' + record.barometer.toFixed(0) + '</td></tr>'; | |
82 | } | |
83 | if ((record.gps_latitude != 0) && (record.gps_longitude != 0)) { | |
84 | html += '<tr><td>GPS</td><td>' + record.gps_latitude + ' ' + record.gps_longitude + ' ' + record.gps_altitude + '</td></tr>'; | |
85 | } | |
86 | html += '<tr><td>Netwerk</td><td>' + record.net_ifname + ' ' + record.net_address + '</td></tr>'; | |
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:
573
diff
changeset
|
87 | if (record.net_rssi < 0) { |
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:
573
diff
changeset
|
88 | html += '<tr><td>WiFi signaal</td><td>' + record.net_rssi + '</td></tr>'; |
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:
573
diff
changeset
|
89 | } |
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:
573
diff
changeset
|
90 | html += '<tr><td>Update interval</td><td>' + record.up_interval + ' sec.</td></tr>'; |
526 | 91 | } |
92 | html += '</<table>'; | |
93 | html += '</div>'; | |
94 | $('#ContentPanel').html(html); | |
95 | } | |
96 | }); | |
181
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | |
526 | 98 | // Get the data immediatly and then at regular intervals to refresh. |
99 | dataAdapter.dataBind(); | |
100 | setInterval(function() { | |
101 | dataAdapter.dataBind(); | |
102 | }, 30000); | |
181
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | }); |
db4e62482d0b
Moved javascript out of mon_node.php
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 |