CrashOverride85 / zc95

4 channel EStim box inspired by the mk312bt, with Lua scripting support
GNU General Public License v3.0
39 stars 12 forks source link

MQTT/XToys integration #56

Open RupertB-ES opened 1 year ago

RupertB-ES commented 1 year ago

I believe there is a LUA implementation of MQTT -any plans on this or other routes to integrate with XToys?

CrashOverride85 commented 1 year ago

XToys isn't something I've used before, so not quite sure how it works, and how to go about integrating yet. The Pico-W uses LwIP for IP connectivity, and that does come with an MQTT client, so for MQTT, it's probably going to involve that rather than Lua

RupertB-ES commented 1 year ago

This is what caught my eye https://github.com/xHasKx/luamqtt

CrashOverride85 commented 1 year ago

I think the problem's going to be that it depends on luasocket, which depends on a BSD-style sockets API, which LwIP used by the Pico SDK doesn't really provide. Plus I think trying to run Lua scripts of that size/complexity just isn't going to work well (if at all). I think the way to get mqtt support in Lua would be to add a wrapper around the LwIP MQTT client to expose it in the Lua environment.

Also I need to have a think about how it would work when running Lua script locally, as at present, the box will only connect to WiFi when in remote access mode.

RupertB-ES commented 1 year ago

I guess there are 2 routes - initially could the LUA client just handshake with a python app and let python do the work but in the longer term having the LUA client "phone home" and start the wifi in code would be the better way performance headroom permitting.

CrashOverride85 commented 1 year ago

Yeah, doing something via the python app might be an option too