# HG changeset patch # User Michiel Broek # Date 1714747980 -7200 # Node ID a9c278202b5911c7d76a6b4687942e043cb9ed03 # Parent 39a68509b138efc259355527e1fe5bc939d8538b Last changes to fermenter.js (maybe). Simulator custom labels for the door switch. Some extra columns in the simulators grid. diff -r 39a68509b138 -r a9c278202b59 www/js/fermenter.js --- a/www/js/fermenter.js Fri May 03 15:12:25 2024 +0200 +++ b/www/js/fermenter.js Fri May 03 16:53:00 2024 +0200 @@ -452,8 +452,6 @@ var msg = evt.data; var obj = JSON.parse(msg); - // console.log('ws got ' + msg); - if (obj.ping) { websocket.send('{"pong":' + obj.ping + '}'); } @@ -508,28 +506,38 @@ if (obj.metric.door) { record.door_address = obj.metric.door.address; record.door_state = obj.metric.door.state; + } else { + record.door_address = ''; } - if (obj.metric.light) - record.light_state = obj.metric.light.state; - if (obj.metric.psu) - record.psu_state = obj.metric.psu.state; + if (obj.metric.light) { + record.light_address = obj.metric.light.address; + record.light_state = obj.metric.light.state; + } else { + record.light_address = ''; + } + if (obj.metric.psu) { + record.psu_address = obj.metric.psu.address; + record.psu_state = obj.metric.psu.state; + } else { + record.psu_address = ''; + } record.mode = obj.metric.mode; record.stage = obj.metric.stage; record.alarm = obj.metric.alarm; record.setpoint_low = obj.metric.setpoint.low; record.setpoint_high = obj.metric.setpoint.high; if (obj.metric.profile) { - record.profile_uuid = obj.metric.profile.uuid; - record.profile_name = obj.metric.profile.name; - record.profile_state = obj.metric.profile.state; - record.profile_percent = obj.metric.profile.percent; - record.profile_inittemp_high = obj.metric.profile.inittemp.high; - record.profile_inittemp_low = obj.metric.profile.inittemp.low; + record.profile_uuid = obj.metric.profile.uuid; + record.profile_name = obj.metric.profile.name; + record.profile_state = obj.metric.profile.state; + record.profile_percent = obj.metric.profile.percent; + record.profile_inittemp_high = obj.metric.profile.inittemp.high; + record.profile_inittemp_low = obj.metric.profile.inittemp.low; } else { - record.profile_uuid = ''; - record.profile_name = ''; - record.profile_state = ''; - record.profile_percent = 0; + record.profile_uuid = ''; + record.profile_name = ''; + record.profile_state = ''; + record.profile_percent = 0; } updateScreen(); } diff -r 39a68509b138 -r a9c278202b59 www/js/set_simulators.js --- a/www/js/set_simulators.js Fri May 03 15:12:25 2024 +0200 +++ b/www/js/set_simulators.js Fri May 03 16:53:00 2024 +0200 @@ -150,8 +150,8 @@ $('#cooler_temp,#heater_temp').jqxNumberInput(Spin1dec); $('#cooler_time,#heater_time').jqxNumberInput(PosInt); $('#cooler_size,#heater_size').jqxNumberInput(Spin4dec); - $('#door_value').jqxSwitchButton({ height: 23, width: 100, theme: theme }); - $('#psu_value').jqxSwitchButton({ height: 23, width: 100, theme: theme }); + $('#door_value').jqxSwitchButton({ height: 23, width: 120, theme: theme, onLabel:'Closed', offLabel: 'Open' }); + $('#psu_value').jqxSwitchButton({ height: 23, width: 120, theme: theme }); // initialize jqxGrid $('#jqxgrid').jqxGrid({ @@ -200,12 +200,16 @@ }, columns: [ { text: 'Name', datafield: 'name' }, - { text: 'No.', datafield: 'simno', width: 80 }, - { text: 'Air temp', datafield: 'air_temperature', width: 100 }, - { text: 'Beer temp', datafield: 'beer_temperature', width: 100 }, + { text: 'No.', datafield: 'simno', width: 60 }, + { text: 'Air temp', datafield: 'air_temperature', width: 100, cellsformat: 'f3' }, + { text: 'Beer temp', datafield: 'beer_temperature', width: 100, cellsformat: 'f3' }, + { text: 'Chiller', datafield: 'chiller_temperature', width: 100, cellsformat: 'f3' }, { text: 'Heater', datafield: 'heater_power', width: 80 }, { text: 'Cooler', datafield: 'cooler_power', width: 80 }, { text: 'Fan', datafield: 'fan_power', width: 80 }, + { text: 'Light', datafield: 'light_power', width: 80 }, + { text: 'Door', datafield: 'door_value', width: 60 }, + { text: 'PSU', datafield: 'psu_value', width: 60 }, { text: 'Last change', datafield: 'timestamp', width: 190, cellsrenderer: function(index, datafield, value, defaultvalue, column, rowdata) { var date = new Date((value * 1000) - tzoffset).toISOString().slice(0, 19).replace("T", " ");