Display Custom Home Screen for Different Users - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Display Custom Home Screen for Different Users (/showthread.php?tid=4171) |
Display Custom Home Screen for Different Users - jamesng - 02.08.2022 Hi We have a number of iPads connected to the same LogicMachine UI. What's the best way to identify the iPad so that I can use a custom javascript attached to the a home button to display a custom screen for that location. IE: If the device was in the Kitchen it would display the Kitchen home screen, if it was in the Master Bedroom then it would display the home screen for that location every time the user tapped the home button. I would ideally like the user to nominate their device's preferred home screen / location - Is there a device identifier which we can access to store against their preferred location to create a lookup table in storage. And how would I access this identifier to store the value with a lua script, and then read back that value using a javascript linked to a button. Many thanks in advance Kind Regards James RE: Display Custom Home Screen for Different Users - admin - 03.08.2022 Create ip.lp file and upload to user directory using FTP with apps login: Code: <?=ngx.var.remote_addr?> Add to Custom JS and modify plans object as needed (Client IP -> Plan ID mapping). Code: $(function() { For this to work correctly either set each client device to a static IP address or create static DHCP entries on your router. RE: Display Custom Home Screen for Different Users - jamesng - 03.08.2022 I'm on the Schneider SHAC version of LogicMachine which seems to have FTP access disabled on the latest firmware update. Is there another way to get the IP address? RE: Display Custom Home Screen for Different Users - admin - 03.08.2022 Via a script: Code: io.writefile('/www/user/ip.lp', '<?=ngx.var.remote_addr?>') RE: Display Custom Home Screen for Different Users - jamesng - 03.08.2022 Thank you, have just implemented the script and this is working really well! Kind Regards James RE: Display Custom Home Screen for Different Users - admin - 04.08.2022 Another option is to use mac address instead of IP. This will only work for local clients (not external via port forward). Run script once: Code: io.writefile('/www/user/mac.lp', [[<? Add to Custom JS (replace IP check script): Code: $(function() { |