How to use android app to control LM - 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: How to use android app to control LM (/showthread.php?tid=3324) |
How to use android app to control LM - Alexander - 27.04.2021 Hi, I want to try making my own app in android studio for my smart home. Is there anyway to do this? If it is, can someone guide me where to start in LM? RE: How to use android app to control LM - admin - 28.04.2021 You can use a WebSocket connection to read/write object values. There are built-in JavaScript libraries in LM that can be used in your app if using Cordova (https://cordova.apache.org/) instead of native Android app SDK. See this thread for more info: https://forum.logicmachine.net/showthread.php?tid=525 RE: How to use android app to control LM - Alexander - 28.04.2021 (28.04.2021, 05:31)admin Wrote: You can use a WebSocket connection to read/write object values. There are built-in JavaScript libraries in LM that can be used in your app if using Cordova (https://cordova.apache.org/) instead of native Android app SDK. See this thread for more info: https://forum.logicmachine.net/showthread.php?tid=525 Hi, but I still create my app in android studio or should I use a different program? RE: How to use android app to control LM - admin - 28.04.2021 It's up to you to decide which tools to use. What do you want your app to do? RE: How to use android app to control LM - Alexander - 28.04.2021 (28.04.2021, 10:37)admin Wrote: It's up to you to decide which tools to use. What do you want your app to do? Ok, I want to try to control lights and heating at first. I have KNX with LM installed and I use Mosaic at the moment, but I wanna try making my own if it is possible. RE: How to use android app to control LM - admin - 28.04.2021 That's not something that we can help you with unfortunately. My suggestion to use Cordova still stands because LM libraries can be reused directly. With native app you will have to handle the communication and data decoding yourself. RE: How to use android app to control LM - Alexander - 28.04.2021 (28.04.2021, 12:43)admin Wrote: That's not something that we can help you with unfortunately. My suggestion to use Cordova still stands because LM libraries can be reused directly. With native app you will have to handle the communication and data decoding yourself. Ok, that's fine. One last question then, how can I get the scripting visual in LM? Like if I just use Lua scripting for my "app" not visualization or Mosaic. RE: How to use android app to control LM - admin - 29.04.2021 If you mean that you want to use scripting in your external app then this is not possible. Android apps are written in Java not Lua and LM libraries are not available for external use. RE: How to use android app to control LM - Alexander - 01.05.2021 (29.04.2021, 07:43)admin Wrote: If you mean that you want to use scripting in your external app then this is not possible. Android apps are written in Java not Lua and LM libraries are not available for external use. Hi, I found a way to implement websocket client in android. But how do I implement websocket server in LM? RE: How to use android app to control LM - Alexander - 08.05.2021 (01.05.2021, 08:40)Alexander Wrote:(29.04.2021, 07:43)admin Wrote: If you mean that you want to use scripting in your external app then this is not possible. Android apps are written in Java not Lua and LM libraries are not available for external use. Hi Again, Do I have to create a script in user libraries to activate LM as a websocket server? RE: How to use android app to control LM - Alexander - 11.05.2021 (28.04.2021, 05:31)admin Wrote: You can use a WebSocket connection to read/write object values. There are built-in JavaScript libraries in LM that can be used in your app if using Cordova (https://cordova.apache.org/) instead of native Android app SDK. See this thread for more info: https://forum.logicmachine.net/showthread.php?tid=525 Hi Admin, Let me understand. If I am going to implement a websocket server in LM, I first create a resident script with this script under: Do I have to change anything in this script or add something? Code: local copas = require'copas' RE: How to use android app to control LM - admin - 12.05.2021 You don't need a script because the websocket server is already implemented (ws://LM_IP/apps/localbus.lp). Implementing the client in an Android app won't be a trivial task though. RE: How to use android app to control LM - Alexander - 12.05.2021 (12.05.2021, 05:56)admin Wrote: You don't need a script because the websocket server is already implemented (ws://LM_IP/apps/localbus.lp). Implementing the client in an Android app won't be a trivial task though. Then I understand. No, but I am trying with apache and a websocket plugin, but if it is to much work I'll maybe just use Mosaic for now |