--- a/www/js/set_global.js Thu May 02 15:49:16 2024 +0200 +++ b/www/js/set_global.js Fri May 03 14:14:01 2024 +0200 @@ -23,7 +23,7 @@ $(document).ready(function() { var global = {}, - url = 'getglobal.php', + url = 'dbglobal.php', globalSource = { datatype: 'json', cache: false, @@ -38,13 +38,12 @@ { name: 'server_port', type: 'int' }, { name: 'websocket_port', type: 'int' }, { name: 'nextunit', type: 'int' }, - { name: 'thb_temp_uuid', map: 'THB>temperature>uuid' }, { name: 'temp_uuid', map: 'THB>temperature>uuid' }, { name: 'temp_state', map: 'THB>temperature>state' }, - { name: 'temp_value', map: 'THB>temperature>value', type: 'int' }, + { name: 'temp_value', map: 'THB>temperature>value', type: 'float' }, { name: 'hum_uuid', map: 'THB>humidity>uuid' }, { name: 'hum_state', map: 'THB>humidity>state' }, - { name: 'hum_value', map: 'THB>humidity>value', type: 'int' }, + { name: 'hum_value', map: 'THB>humidity>value', type: 'float' }, { name: 'temp_hum_idx', map: 'THB>index', type: 'int' }, { name: 'lcd_address', map: 'LCD>address' }, { name: 'lcd_cols', map: 'LCD>cols', type: 'int' }, @@ -70,10 +69,10 @@ $('#nextunit').val(global.nextunit); $('#temp_uuid').val(global.temp_uuid); $('#temp_state').val(global.temp_state); - $('#temp_value').val(global.temp_value / 1000.0); + $('#temp_value').val(global.temp_value); $('#hum_uuid').val(global.hum_uuid); $('#hum_state').val(global.hum_state); - $('#hum_value').val(global.hum_value / 1000.0); + $('#hum_value').val(global.hum_value); $('#temp_hum_idx').val(global.temp_hum_idx); $('#lcd_address').val(global.lcd_address); $('#lcd_cols').val(global.lcd_cols); @@ -161,8 +160,7 @@ console.log('update: success'); } }, - error: function(jqXHR, textStatus, errorThrown) { - } + error: function(jqXHR, textStatus, errorThrown) {} }); }); @@ -173,10 +171,5 @@ if (obj.ping) { websocket.send('{"pong":' + obj.ping + '}'); } - - if (obj.type == 'global') { - // Use the message to trigger update. -// $('#jqxgrid').jqxGrid('updatebounddata'); - } } });