![]() |
Updating and activating App from Lua Script - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2) +--- Thread: Updating and activating App from Lua Script (/showthread.php?tid=1934) |
Updating and activating App from Lua Script - Stevo - 26.02.2019 Hi, I have made some changes to the database that we are using. With the database changes made using lua scripts the results don't appear in the Objects Web page until I perform a Browser refresh (F5). Even after this the objects don't reflect their live status until the hardware is rebooted. I realise this is 2 issues but am hoping to deal with them both using the lua scripting. Can anyone please suggest what I need to do here. It's not SQL based rather refreshing the GUI and re-loading the database. Are there finctions in a library somewhere perhaps? I hope this isn't a silly question and thank you to anyone who can spare the time. Stevo RE: Updating and activating App from Lua Script - Erwin van der Zwart - 26.02.2019 Hi, I have a custom JS that you can use to refresh the browser by a knx object (write to this object from LUA script), after adding that you need to refresh the browser once to load it. I will post it later today. For the database issue you are facing we need some info what you are doing as a browser refresh should and does always result in a actual object state, never seen other values then actual db values. I think you do something strange that causes that.. BR, Erwin RE: Updating and activating App from Lua Script - admin - 26.02.2019 Check if browser error console (opens by pressing F12) has any errors. RE: Updating and activating App from Lua Script - JMM - 27.02.2019 Hi Erwin, I’m very interested in your custom JS for refresh the browser ![]() BR Jean-Marc RE: Updating and activating App from Lua Script - Erwin van der Zwart - 28.02.2019 Hi, Here is the custom JS to refresh the browser by KNX command: Code: $(function(){ BR, Erwin RE: Updating and activating App from Lua Script - JMM - 28.02.2019 Hi, thanks Erwin This is the code I use and sometimes reloading from the server is not done even with "location.reload(true)" BR Jean-Marc. RE: Updating and activating App from Lua Script - Erwin van der Zwart - 28.02.2019 Hi, Have you checked with console that the function is called? Also in this sample is at the end of the grp.listen a extra parameter ‘true’, this makes the action executed by the same object value, if it is not in your version you might send only true and then it won’t be triggered, so try this version first as i never heared it doesn’t work. BR, Erwin RE: Updating and activating App from Lua Script - JMM - 02.03.2019 Hi, I didn’t say that it doesn’t work, I said that sometimes "location.reload(true)" is done on the cache and not on the server. I did some research on it but I couldn’t find anything. Br Jean-Marc. RE: Updating and activating App from Lua Script - Erwin van der Zwart - 02.03.2019 Hi, Custom JS is never executed on the server side, it’s just a piece of JS that is injected into the HTML that is loaded by the client(s) and executed by the browser. So it runs always client side. Once loaded by the browser it should always execute and cache has nothing to do with that, check the HTML source code if it’s inserted correctly, then it should work every time it’s triggered. Only reason that might not trigger it after being loaded is a interupted websocket but that would also stop all other object updates. BR, Erwin RE: Updating and activating App from Lua Script - JMM - 03.03.2019 Hi, I think we do not understand each other ... Just look https://www.w3schools.com/jsref/met_loc_reload.asp BR Jean-Marc RE: Updating and activating App from Lua Script - Erwin van der Zwart - 03.03.2019 Hi, Aah, Okay, the difference in the ‘true’ parameter is that the browser loads the page default from cache and not everything from the server, so it will use images and other source files like css from the cache to avoid unneeded load. In both cases the function should always be triggered, when you have added for example new images with the exact same name or other updated files with exact same names it will not be replaced by a reload as the browser asumes the files it already has are latest. In that case you need to add the parameter true to force the browser to download all files anyhow. In either scenario the browser should reload and you should notice a blink of the refresh, thats why i say to use the console to check it. BR, Erwin |