Navigation

    Discussion Forum to share and further the development of home control and automation, independent of platforms.

    SmartHome Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Unsolved
    (Last Updated: June 28, 2020)
    • Openluup control of Alexa

      CatmanV2

      Very happy getting Alexa to control Openluup devices. I'm wondering if there's any way to get Openluup to control Alexa only devices (such as wifi enabled light bulbs?

      TIA

      C

      openLuup
    • openLuup: MQTT server

      akbooer

      Feedback / issues with openLuup's built-in MQTT server

      openLuup
    • openLuup won't upgrade from 2020.05.22

      R

      Hello,
      Having issues updating to latest version. Is there documentation on it anywhere?

      openLuup
    • Restoring OpenLuup

      A

      I thought I would test and migrate my OpenLuup installation from my current old i3 Ubuntu server to a new Raspberry Pi 4.

      I have set up the new Pi with a fresh install of openLuup and it works as it should.

      As I have understood it I should install all the plugins I have on my old installation and then restore a backup file from my old installation onto the new server. Is this correct or should I do some more steps before migrating? When I see that everything is working the plan is to swap the IP, but initially the new server will have another IP.

      When I tried to test the resore procedure on the new server from a backup file of the new server I got an error and the restore script hangs.
      After reboot OpenLuup is back.

      What I did was type:
      ./openLuup_reload backup/backup.openLuup-88800000-2021-04-12.lzap
      in the Terminal from inside cmh-ludl ( I found this procedure in an old thread).

      When doing this I get the following error message:
      rm: can not remove '/www/altui/altui*': The file of catalogue does not exist (free-hand translated from Swedish)

      @akbooer am I missing something here?

      openLuup
    • OpenLuup unavailable

      A

      The last three mornings OpenLuup for some reason has been unavailable. In other words it has not been responding when trying to connect via AltUI or Console.

      I have been trying to investigate a bit around what this could be but not got it pinned down.

      I run OpenLuup with one Zway bridge and two Vera bridges. The Zway and Veras have all been available every time, so that should not be the problem.
      When the problems started I had updated OpenLuup with Mqtt and added a few Mqtt devices. At the same time I also updated AltUI to the latest version. At the same time I also removed some devices from Room 101.
      The Mqtt devices are normally reporting data as they should.

      In Lua startup I have added the following entries related to Mqtt:

      luup.attr_set ("openLuup.MQTT.Port", 1883) luup.attr_set ("openLuup.MQTT.Username", "luup") luup.attr_set ("openLuup.MQTT.Password", "openluup") luup.attr_set ("openLuup.MQTT.PublishDeviceStatus", "0") -- ================================== Mqtt functions below: local json = require "openLuup.json" function MyMQTThandler (topic, message) local info = json.decode (message) local t = info.AM2301.Temperature local h = info.AM2301.Humidity luup.variable_set ("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", t, 216) luup.variable_set ("urn:micasaverde-com:serviceId:HumiditySensor1", "CurrentLevel", h, 228) end luup.register_handler ("MyMQTThandler", "mqtt:tele/tasmota_test/SENSOR") function TasmotaCO2Axel (topic, message) local info = json.decode (message) local t = info.BME280.Temperature local h = info.BME280.Humidity local p = info.BME280.Pressure local c = info.MHZ19B.CarbonDioxide luup.variable_set ("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", t, 229) -- set temp to device luup.variable_set ("urn:micasaverde-com:serviceId:HumiditySensor1", "CurrentLevel", h, 230) -- set humidity to device luup.variable_set ("urn:micasaverde-com:serviceId:GenericSensor1", "CurrentLevel", p, 232) -- set air pressure to device luup.variable_set ("urn:micasaverde-com:serviceId:GenericSensor1", "CurrentLevel", c, 231) -- set CO2 to device end luup.register_handler ("TasmotaCO2Axel", "mqtt:tele/TasmotaCO2Ax/SENSOR") function TasmotaCO2Anton (topic, message) local info = json.decode (message) local t = info.BME280.Temperature local h = info.BME280.Humidity local p = info.BME280.Pressure local c = info.MHZ19B.CarbonDioxide luup.variable_set ("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", t, 233) -- set temp to device luup.variable_set ("urn:micasaverde-com:serviceId:HumiditySensor1", "CurrentLevel", h, 234) -- set humidity to device luup.variable_set ("urn:micasaverde-com:serviceId:GenericSensor1", "CurrentLevel", p, 235) -- set air pressure to device luup.variable_set ("urn:micasaverde-com:serviceId:GenericSensor1", "CurrentLevel", c, 236) -- set CO2 to device end luup.register_handler ("TasmotaCO2Anton", "mqtt:tele/TasmotaCO2An/SENSOR") -- =======================================================================

      This morning it seems as if OpenLuup stopped working at 06:24, I kept MqttExporer up and running over night and it the data reporting had stopped at that time. (The image shows the last reported data and then it shows that it commences again after I restarted OpenLuup at 07:19.
      20210318MqttExplorer.png

      Before restarting I grabbed all the log files, the last few entries in the log are:

      2021-03-18 06:24:09.712 luup.variable_set:: 149.urn:upnp-org:serviceId:TemperatureSensor1.CurrentTemperature was: -10.6 now: -10.5 #hooks:0 2021-03-18 06:24:09.712 openLuup.server:: request completed (2 bytes, 1 chunks, 4 ms) tcp{client}: 0x55ca8d503438 2021-03-18 06:24:09.721 luup.variable_set:: 229.urn:upnp-org:serviceId:TemperatureSensor1.CurrentTemperature was: 20.4 now: 20.4 #hooks:0 2021-03-18 06:24:09.721 luup.variable_set:: 230.urn:micasaverde-com:serviceId:HumiditySensor1.CurrentLevel was: 46.7 now: 46.7 #hooks:0 2021-03-18 06:24:09.721 luup.variable_set:: 232.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 1016.5 now: 1016.5 #hooks:0 2021-03-18 06:24:09.721 luup.variable_set:: 231.urn:micasaverde-com:serviceId:GenericSensor1.CurrentLevel was: 2010 now: 2020 #hooks:0 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8cb5cf68 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8c855e68 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8d2daa08 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8c7c3218 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8ca87948 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8d312d98 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8c7e95f8 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8c74a218 2021-03-18 06:24:09.754 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8bfefea8 2021-03-18 06:24:09.755 openLuup.io.server:: HTTP:3480 connection closed openLuup.server.receive closed tcp{client}: 0x55ca8c6ebce8 2021-03-18 06:24:09.756 openLuup.io.server:: MQTT:1883 connection closed tcp{client}: 0x55ca8c4dfe48 2021-03-18 06:24:09.756 openLuup.mqtt:: closed tcp{client}: 0x55ca8c4dfe48 2021-03-18 06:24:09.756 openLuup.mqtt:: TasmotaCO2Ax UNSUBSCRIBE from cmnd/TasmotaCO2Ax/# tcp{client}: 0x55ca8c4dfe48 2021-03-18 06:24:09.756 openLuup.mqtt:: TasmotaCO2Ax UNSUBSCRIBE from cmnd/tasmotas/# tcp{client}: 0x55ca8c4dfe48 2021-03-18 06:24:09.756 openLuup.mqtt:: TasmotaCO2Ax UNSUBSCRIBE from cmnd/TasmotaCO2Ax_fb/# tcp{client}: 0x55ca8c4dfe48 2021-03-18 06:24:09.756 openLuup.mqtt:: ERROR publishing application message for mqtt:cmnd/TasmotaCO2Ax/POWER : closed

      The last rows are a bit strange to me, them seem to indicate that something goes wrong with the Mqtt for that device?

      @akbooer I assume that it could be more of interest in the logs, I can of course email them if needed. Also let me know if any more information is missing.

      openLuup
    • My newbie questions

      Crille

      Creating my own topic for newbie questions about openLuup and AltUi 🙂

      Trying to create a scene with a timer to turn on device 1 at given time IF device 2 is Off.
      Wrote Lua to return false if device 2 is On.
      Log states "scene prevented from running by local scene Lua" but action is performed anyway, device 1 is turned On.
      Suggestions?

      openLuup
    • openLuup: Version Log

      akbooer

      A long while ago (May, 2015) I wrote my 2000-th post on another forum: openLuup - running unmodified plugins on any machine. Here’s the gist of it:

      ...I want to work in a more open and stable [Vera] environment...

      ...All would be solved if Luup was open source and could be run on the plethora of cheap and reliable hardware available today. But it’s not. But we could get something like that effect if we engineered a sufficient subset of Luup to run on such a platform. Could it be done? What would we need?

      1. UI
      2. scheduler
      3. web server
      4. Luup compatible API
      5. Device and Implementation xml file reader
      6. Zwave bridge to Vera
      7. runs most plugins without modification

      What we wouldn’t need is UPnP.

      What have we (nearly) got already?

      We have, courtesy of @amg0, the most excellent AltUI: Alternate UI to UI7, and that, I think, is probably the hardest one to do in the above list. Items 2 - 5, and 7, I’ve prototyped, in pure Lua, and posted elsewhere: DataYours on Raspberry Pi, running selected plugins unmodified, including: DataYours, EventWatcher, Netatmo, RBLuaTest, altUI. See screenshot attached.

      Is it worth the effort? Probably not. Will I pursue this quest? Yes.

      openLuup was the result.

      DE2056BF-E548-4611-972B-40276F00BFEB.jpeg

      openLuup
    • AltUI and Console gui

      A

      I found some really minor gui issues in AltUI and in the Console.

      Once more it is not that much of a problem for me as I use them only for admin purposes. I thought I'd post them anyway so that they are known for future releases, depending on priorities of course. 🙂

      The first is related to the rounding of humidity devices in AltUI. It seems as if these numbers are always rounded down:

      AltUI:
      cae85b7d-8f20-440a-9ca2-8d568b63f00c-bild.png

      Console:
      8100685e-9389-4f5f-b1e7-96a25fbabe84-bild.png

      The second issue is that the value for generic sensors seems not to be visible in the Console:

      AltUI:
      7909f921-2a09-4687-9550-331640e32244-bild.png

      Console:
      d090457b-5357-4bbd-9073-8f1e830c893f-bild.png

      Variables:
      6a9ec1a0-37e7-479e-94f0-4321f7aeac93-bild.png

      openLuup
    • New to openLuup, issues with scenes

      Crille

      I got tired on waiting for a stable release of Vera FW so finally took the leap to installing openLuup.

      Unfortunately I haven't even got a simple scene to work.
      Trigger - If device 1 is turned on
      Action - Delay 2 seconds and turn device 2 on.

      I see the call to turn device 1 on in log but nothing else related after that.
      What am I doing wrong?

      openLuup
    • Luup reload required after server reboot

      A

      I noticed this morning something that have seen in the past but forgotten about.

      When I restart the OpenLuup server (in my case an Ubuntu PC) the Vera and Z-way bridges do not get in contact with the corresponding servers, i.e. are shown in red in AltUI. The solution for me is to make a "Relaod Luup engine" and then they are ok. I do not know if it is a general issue or only for my setup.

      To be honest it is not much of a problem since OpenLuup is so stable. If and when you restart the server the hazzle of reloading is not that big. In fact I had forgotten about it since it was so long ago I had to restart anything...

      The one use case I can think of is that the server gets restarted due to a power outage or something and if you are not at home the system does not fully recover without manual interaction. I my case I have the server on an UPS, but still a thought.

      Is this a known issue and is it something that can be addressed somehow? As I said low priority, at least for me. 🙂

      openLuup
    • Wrong dimmer value in gui

      A

      I installed a new dimmer a few days ago, a Sunrichter "knob smart dimmer" (SR-ZV2835RACS).

      It included without problems into Z-way and shows up in AluUI and in the Console as usual.
      However the dimmer value in AltUI/Console does not change when you adjust it manually on the dimmer. I have checked the variables and it seems as if AltUI displays LoadLevelTarget and when checking on the dimmer variables the LoadLevelTarget value is not updated in OpenLuup when the dim level is changed on the dimmer. In other words LoadLevelStatus and LoadLevelTarget differs and LoadLevelStatus shows the correct dim level set manually on the dimmer.
      If you change the dim level in OpenLuup then both values are updated.
      On/off state is however always updated.

      In Z-way the dim level is updated as it should, so it works there as it should from what I can see.

      Running OpenLuup 20.12.19 and AltUI 2.53b.2552.

      @akbooer any idea if this is something that can be fixed?

      openLuup
    • Vera Decoupled from the cloud services

      therealdb

      so, @rigpapa did it: https://github.com/toggledbits/Vera-Decouple

      It's completely decoupling Vera from the cloud. Very cool stuff. /cc @rafale77 @akbooer

      openLuup
    • openLuup Icons

      rafale77

      This is a set of openLuup icons to replace the ones which you normally would transfer over from the vera. The only thing for the dimmable lights is that one needs to use a new json file to replace the original light bulb with an vector graphics type which I am also sharing.

      icons.zip
      D_DimmableLight1.json.zip

      This is a sample of the icons on ALTUI:

      Screen Shot 2021-03-01 at 16.06.18.png

      openLuup
    • Custom device for dimmer

      DesT

      @akbooer

      What's the effort/work to have a custom device "view" ?

      Remember when I talked about a dimmer with low/med/high/off instead of the slider from 0 to 100 ...

      What I would need to do to have that ?

      Right now, I have a fan in the living room that use the fireplace heat to send it on the 2nd floor!

      For the moment, I put it manually at 30%, 60% and 100% to handle the low/med/high, but will be more useful on the interface to have only 3 buttons...

      openLuup
    • Odd console display for triggers

      rafale77

      Screen Shot 2021-02-23 at 07.14.43.png

      @akbooer , I just noticed these last 3 watches which have a serviceID appended behind them in the console. It is only the last 3 and I can't figure out why. Any idea?

      openLuup
    • websocket

      rafale77

      A brainfart or maybe wishful thinking here but besides MQTT, it would be a really nice addition for openLuup to provide a websocket server which would "lock" the messages tighter than MQTT and then give allow MSR to connect to it through this protocol rather than the vera style http API.
      This came to me as I was observing MSR connection to openLuup through polling adding 0.3-0.4% of CPU load while not doing much of anything to Home-assistant. Just putting it out there. z-way-server also provides a websocket server through an app which could be used instead of the current fixed interval polling of the z-way bridge. MQTT would provide the same benefit but likely require a lot more user intervention to setup the MQTT topics and messages though it would lose the distributed clients/servers aspect.

      openLuup
    • Security Sensor LastTrip behavior

      rafale77

      I am not sure if this is the behavior inherited from the vera but I was looking at the codes and got annoyed that the LastTrip variable updates even when the variable set is to "untrip" the sensor. A bit of a pet peeve but I ended changing this behavior in the openLuup code to only update the LastTrip when it is a trip action. This is particularly annoying because of timed lighting or other sensors which are sending API calls to openLuup on a regular interval defeating the purpose (at least the one I think it is meant to have) of the variable.

      I just moved this line

      set ("LastTrip", tostring(os.time()))

      down to the armedtripped part of the code in the luup.lua file.

      @akbooer was there a reason for that behavior?

      openLuup
    • luaJIT

      rafale77

      @akbooer,

      Have you ever considered running openLuup under LuaJIT instead of Lua5.1 interpreter?

      The LuaJIT Project

      For kicks, I switched my installation to the latest LuaJIT2.1 beta3 dating from 2017 and being a lua5.1 interpreter it is a drop in replacement. I had to move the lfs library from one folder to another likely because of an include path difference but I am seeing a further speed/efficiency improvement vs. lua5.1.
      My CPU load has dropped another 25% to now hover around 2.2% down from 2.8%. I have yet to make sure that everything else works but so far everything appears to be the same.
      The luajit site claims up to 5x speed increase through the interpreter and 120x improvement through the compiler vs the standard lua5.1.

      Screen Shot 2020-07-05 at 23.10.02.png

      My initial interest was from being able to access some ffi libraries to handle video streams...

      PS: Wow it is pretty impressive under load... browsing through ALTUI which used to cause spikes of CPU utilization from 2.8% to 4.8% now only go from 2.3% to 2.6%. It almost looks like noise. I am running it on a pretty fast x64 thread so it may not be that significant but this could make a big difference on ARM.

      Screen Shot 2020-07-05 at 23.11.47.png

      openLuup
    • Missing App store contents in openLuup

      A

      A little while back the contents of the App Store in openLuup show that there are no plugins in the store and the date is shown as"

      Alt App Store (as of 1970-01-01 10:00:00)

      In the log I see this:

      2021-02-07 11:34:06.509 openLuup.wsapi.cgi:: /console : loading app database... 2021-02-07 11:34:06.550 openLuup.client:: WGET error status: -1, request: https://raw.githubusercontent.com/akbooer/AltAppStore/data/J_AltAppStore.json 2021-02-07 11:34:06.550 openLuup.wsapi.cgi:: /console : JSON decode error @[5 of 107, line: 1] unexpected data after valid JSON string 'tlsv <<<HERE>>> 1 alert protocol vers' 2021-02-07 11:34:06.569 openLuup.server:: request completed (8645 bytes, 0 chunks, 61 ms) tcp{client}: 0x34e2f68

      In AltUI, the store shows OK but I don't see a call to GitHub so it may be getting its info from a cached value or an xml file?

      openLuup
    • Generic support for external plug-ins in different languages

      therealdb

      I was toying with the idea to write a simple openLuup plug-in to execute any external plug-in (ie written in nodejs, puthon or even bash or .NET) via an openLuup plug-in, with access to luup's variables and/or the ability to execute actions against an external executable.

      The general idea is to get an existing library (ie: the one controlling LG TV, or SwitchBot) that's written in another language and write a simple (and generic) bridge to represent a device, getting variables from a command line bash script (or nodejs app or whatever) and leverage someone else's work, instead of playing catch-up and try to port it over to LUA.

      I did it by myself in my own fork of the MQTT2Luup bridge I released and it's working very well for me. I was able to implement support for Alexa, busylights, lgtv, netgear routers, switchbot and much more, all using established or official node packages, with a simple library to send command to the node lib (simulating a console in) and getting response from them (reading the console out). So my logic is still in the luup/openLuup engine and I could mix and match (ie: getting my TV volume to know if I want to raise up/down the thermostat temperature based on occupancy, or treat switchbots as normal light switch - and control them via Alexa and so on).

      So, instead of doing it all by myself, I'm wondering it this could interesting as a generic openLuup capability, or as a general and "standardized" effort. I know it sounds like MultiSystem Reactor, but it's not, since the primary purpose is to be specific to openLuup devices and leave the logic to the user (this could be of course Reactor, the upcoming MSReactor or whatever you want). Am I the only one mixing things together and with such a need?

      openLuup
    For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used

    openLuup: Suggestion

    openLuup
    5
    20
    202
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DesT
      DesT last edited by

      As @akbooer said in another thread...

      I suppose I should also be setting out a roadmap. At the risk of it becoming a commitment, let's just say that, for the moment, it's just a list of incremental development ideas and some blue sky thinking:

      ZWay plugin integrated in openLuup distribution (as are AltAppStore and VeraBridge)* native scene triggers – not the same as Vera, not the same as AltUI variable watches, but definable in the openLuup console.
      utilities for managing Data Historian archives
      better task & job messages

      and then...

      fully asynchronous I/O
      enhanced HTTP server with data compression (perhaps using third-party web server?)
      Ajax calls for asynchronous updates of some console pages (Devices, Scenes, ...)
      ...

      Ideas always welcomed!

      1 Reply Last reply Reply Quote 1
      • DesT
        DesT last edited by

        @akbooer
        if you need help, I can help with the 3rd party web server like nginx or apache!

        In this case I will prefer nginx for sure!

        We can use nginx for all "static" files and pass_proxy the other part to openLuup!

        1 Reply Last reply Reply Quote 1
        • akbooer
          akbooer last edited by akbooer

          I had been thinking of apache, but it looked cumbersome. Lighttpd, of course, was another Vera-inspired option (openWRT.). I must look up more about nginx.

          How easy is this to install on any system? Does it support WSAPI CGIs?

          —————————

          Edit: after a little homework, I think that the answer is yes, for WSAPI. Not that I know how I’ll use it, just that some of openLuup is implemented like that.

          1 Reply Last reply Reply Quote 0
          • DesT
            DesT last edited by

            nginx is awesome for "reverse proxy" too. Like on this forum. We can use nginx to serve all files for example in /img or /static/ and send the other part to the reverse proxy config to openLuup directly!

            1 Reply Last reply Reply Quote 0
            • rafale77
              rafale77 last edited by

              Yup, I at one point at one such proxy running to force going through login before being able to openLuup by blocking the port 3480 to any access except for nginx from my firewall. This has always been an odd thing missing from the vera which deems blocking the local access and forcing going through their server being their secure mode. Nginx reverse proxy could then act as the local authentication server.

              1 Reply Last reply Reply Quote 0
              • akbooer
                akbooer last edited by akbooer

                An idea: (prompted by @CatmanV2 ’s mammoth code development in Lua Test windows) ...

                ...there could be a version of the require() statement which includes code from one of the other openLuup Lua Test windows (currently a total of three, but could be more) to aid in modularity when testing.

                akbooer CatmanV2 2 Replies Last reply Reply Quote 0
                • akbooer
                  akbooer @akbooer last edited by

                  @akbooer said in openLuup: Suggestion:

                  An idea: (prompted by @CatmanV2 ’s mammoth code development in Lua Test windows) ...

                  Well, it turns out that this is already easy to do!

                  If the Lua Test Code window #3 contains, for example:

                  local function foo ()
                      return "this function is in Lua Test Code #3"
                  end
                  
                  return {foo = foo}
                  

                  (in other words, a standard module declaration) and then in another test window you write:

                  local T3 = loadstring (luup.attr_get "LuaTestCode3") ()
                  
                  print (T3.foo())
                  
                  

                  then you will get the expected result:

                  ––– 1 line ––– 0.5 ms –––

                  this function is in Lua Test Code #3

                  Job done!!

                  1 Reply Last reply Reply Quote 1
                  • A
                    a-lurker last edited by

                    Not sure if this is the "Official" openLuup suggestion thread but: in the Lua test code windows in the console. It would be good if they were cleared when you hit the code Submit button. That way you see all your old print statement outputs disappear and affirms you have actually clicked the button.

                    akbooer 1 Reply Last reply Reply Quote 0
                    • akbooer
                      akbooer @a-lurker last edited by

                      @a-lurker said in openLuup: Suggestion:

                      Not sure if this is the "Official" openLuup suggestion thread

                      Yes, it is.

                      @a-lurker said in openLuup: Suggestion:

                      It would be good if they were cleared when you hit the code Submit button.

                      Not sure I’m understanding this. You press the button, the code is run, the results are in the output window. It usually happens quite quickly... I did think of adding a time stamp to the header to show when it was run.

                      1 Reply Last reply Reply Quote 0
                      • A
                        a-lurker last edited by

                        I was recently playing around with some AES ECB encoding/decoding and I'm looking at changes amongst a myriad of same other info that's coming in over a link over a period of time. On thinking about this further: I don't see anything printed at all, until the program is finished (that's the actual problem). Whereas the log can spit out debug info as the code proceeds. If the code takes time to run (lots of seconds) decoding incoming data; then I'm unsure if it is executing till it finishes or has indeed crashed.

                        Doesn't need a time stamp. Just a blank output screen when the Submit button is operated; ready for new the output to be shown immediately the program finishes..

                        akbooer 1 Reply Last reply Reply Quote 0
                        • CatmanV2
                          CatmanV2 @akbooer last edited by

                          @akbooer said in openLuup: Suggestion:

                          An idea: (prompted by @CatmanV2 ’s mammoth code development in Lua Test windows) ...

                          That seems somehow unlikely! 😄

                          C

                          1 Reply Last reply Reply Quote 1
                          • akbooer
                            akbooer @a-lurker last edited by

                            @a-lurker said in openLuup: Suggestion:

                            I don't see anything printed at all, until the program is finished

                            Slippery slope, this. Next you’d be wanting to interact with a running program...

                            Ajax requests are the answer to this – and for real time updates of the devices page – so it’s on the list (actually I must write the list down, sometime) and the basic infrastructure is there.

                            I’ll see what can be done sooner re. clearing the output window.

                            1 Reply Last reply Reply Quote 1
                            • akbooer
                              akbooer last edited by akbooer

                              I had a quick go at this... and failed.

                              My motto (for openLuup engine and console) is "no JavaScript". Actually, there is a teeny tiny bit, in order to be able to hook into the indispensible Ace editor.

                              I was willing to break the rule if it solved a problem, but the obvious bit of JS to clear the output window before submit does not work since it is, in fact, an iframe, not a div. I'm no expert in this, and don't really want to be one, believing that server-side pages are inifinitely preferable. (the speed of the openLuup console, cf., say, AltUI, or, God forbid, UI7, is testament to this mantra.)

                              It will be solved in due course, but the quick fix approach will not do it. I am a bit busy with a different, exciting, project (that, one day, may surface as an openLuup plugin as one of its guises.)

                              Sorry. Tried. Failed. 😞

                              AK

                              1 Reply Last reply Reply Quote 1
                              • A
                                a-lurker last edited by

                                AK - thanks for your efforts. I think I will survive without it. What with three test windows and UI output with pretty() versus watching the log file go past: I think I'm doing pretty well (pun intended).

                                Here is another possible suggestion/query. As you may have noted I've been disappearing down and reappearing up at various rabbit holes re: luup.call_delay(). I fully appreciate that the openLuup code is busy doing stuff and a requested delay may blossom into something longer than requested. You mentioned AltUI may hit the system a bit hard but I didn't note any difference with it running or not - that's one rabbit hole of many. So is it possible to somehow profile openLuup to see what is really holding it up. It could possibly be the Vera connection; another rabbit hole or indeed all my own plugins. I'm unsure how this would be done. May be an auxiliary test program that could be run for ten minutes or so? Lua has some debug library built in that may be useful. Anyway may be in the too hard basket as profiling can be a can of worms.

                                Another query - the openLuup console has System-->All_Gobals, which is great for finding vars that should have been declared as local. So question - is there some code that you can write that you execute with your other test code in the Lua test window, that will list globals in the code running in the Lua test window, so errant vars can be found and made local, as needed? Could also apply to functions.

                                akbooer 1 Reply Last reply Reply Quote 0
                                • akbooer
                                  akbooer @a-lurker last edited by

                                  @a-lurker said in openLuup: Suggestion:

                                  So is it possible to somehow profile openLuup to see what is really holding it up.

                                  How strange... for the other project I am currently working on, I’ve started using the Lua debug library to profile the code. As warned in the docs, the library can be slow, so timing is not really possible at the Lua level. Counting procedure calls, however, is faster, but I’m not sure it will give you what you need. On the plus side, it’s trivial to add the profiler to any running code with no changes required. I’ve not tried this on openLuup, yet...

                                  @a-lurker said in openLuup: Suggestion:

                                  is there some code that you can write that you execute with your other test code in the Lua test window, that will list globals in the code running in the Lua test window

                                  Well, yes, of course! Ah, you want to know what that is... I just need to try this on my development system, and not an iPad. Perhaps after breakfast...

                                  A 1 Reply Last reply Reply Quote 0
                                  • akbooer
                                    akbooer last edited by akbooer

                                    @a-lurker said in openLuup: Suggestion:

                                    is there some code [...] that will list globals in the code running in the Lua test window

                                    So here's a little function that shows you all the globals in the Lua Test Code area (shared with scenes / Startup Lua / Shutdown Lua.)

                                    local function globals ()
                                      local G = {}
                                      local name_type = "([^/]+)/(.+)"
                                      local gnames = "%-20s %s"
                                      for g, x in pairs (_G) do
                                        G[#G+1] = g .. '/' .. type(x)
                                      end
                                      table.sort (G)
                                      for _, g in ipairs(G) do
                                        print (gnames: format (g: match (name_type)))
                                      end
                                    end
                                    
                                    globals()
                                    

                                    Running that in one of my test windows shows:

                                      ––– 58 lines ––– 0.2 ms –––
                                    
                                    ALTUI                table
                                    ALTUI_LuaRunHandler  function
                                    LuaTestCode3         function
                                    _G                   table
                                    _KEY                 function
                                    _NAME                string
                                    _VERSION             string
                                    assert               function
                                    bit                  table
                                    collectgarbage       function
                                    coroutine            table
                                    debug                table
                                    dofile               function
                                    error                function
                                    gcinfo               function
                                    getfenv              function
                                    getmetatable         function
                                    io                   table
                                    ipairs               function
                                    jit                  table
                                    json                 table
                                    lfs                  table
                                    load                 function
                                    loadfile             function
                                    loadstring           function
                                    luup                 table
                                    math                 table
                                    module               function
                                    newproxy             function
                                    next                 function
                                    os                   table
                                    package              table
                                    pairs                function
                                    pcall                function
                                    pretty               function
                                    pretty_old           function
                                    print                function
                                    rawequal             function
                                    rawget               function
                                    rawlen               function
                                    rawset               function
                                    require              function
                                    scene_1              function
                                    scene_10001          function
                                    scene_10002          function
                                    scene_2              function
                                    scene_3              function
                                    scene_4              function
                                    select               function
                                    setfenv              function
                                    setmetatable         function
                                    string               table
                                    table                table
                                    tonumber             function
                                    tostring             function
                                    type                 function
                                    unpack               function
                                    xpcall               function
                                    

                                    Notice that, unlike the openLuup console's System > All Globals menu, this simple code does not winnow out the standard Lua globals.

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      a-lurker @akbooer last edited by a-lurker

                                      @akbooer said in openLuup: Suggestion:

                                      Perhaps after breakfast...

                                      What's for breakfast - bangers & mash?

                                      That's helpful. Quickly identified four vars that were global, when they shouldn't have been, in the test code. It's amazing how they can slip through a manual visual check of the code.

                                      1 Reply Last reply Reply Quote 0
                                      • akbooer
                                        akbooer last edited by akbooer

                                        Glad that did the trick...

                                        ...I’ve just thought of an easier way – I could just add the Lua Test Code environment to the System > All Globals page!

                                        (Breakfast was, in fact, crumpets and maple syrup.)

                                        A 1 Reply Last reply Reply Quote 0
                                        • A
                                          a-lurker @akbooer last edited by

                                          @akbooer said in openLuup: Suggestion:

                                          just add the Lua Test Code environment

                                          If possible that would be good.

                                          akbooer 1 Reply Last reply Reply Quote 0
                                          • akbooer
                                            akbooer @a-lurker last edited by

                                            @a-lurker said in openLuup: Suggestion:

                                            If possible that would be good.

                                            Done!

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Welcome. If you’d like to participate in the discussion, rather than just read, then you can join the forum. As a member, you can interact with others here to share your experience and ask the questions you need answered.

                                            Powered by NodeBB | Contributors
                                            Hosted freely by PointPub Media Communications Inc. | Contact us