Plugin: LuaView

Sebby,

Download this version of JS file (right-click the link, choose Save Link As…, etc.), and then upload it to your Vera. Then, do a full cache flush/browser refresh. Let’s see what happens.

J_LuaView1_UI7.js

no love, still only showing just the scene names. Though the console reports no errors now.

OK. The that’s a browser thing. Either use one of the browsers that works, or do the following to fall back to no-ACE mode:

Go into the LuaView device, to Advanced, New Service… enter the service ID (copy-paste if you can, must be exact) [tt]urn:toggledbits-com:serviceId:LuaView1[/tt], variable name [tt]LoadACE[/tt] and value 0. Then hit the “Add” button, followed by the “Reload Engine” button. Browser flush/reload just to be safe. It should then load without ACE (standard textarea fields as before).

no worries, i’ll just use another browser. Thanks!

sebby, if you’re into chasing this down a little more, the stable branch version of J_LuaView1_UI7.js now supports an ACEURL state variable so you can control where LuaView gets ACE and what version it uses (when not using AltUI). You would need to upload the file to your Vera, then create the ACEURL variable manually (LuaView device control panel Advanced tab, New Service subtab, service [tt]urn:toggledbits-com:serviceId:LuaView1[/tt]) and reload Luup.

Default value (currently): blank, which will load https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.2/ace.js

I believe AltUI currently uses 1.3.0 (https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.0/ace.js), and since Mac/Chrome users don’t seem to be having issue with AltUI, that may be a good place to start.

sorry it took me this long to get to this, i’ve been traveling for work. so i added the variable and tested with both versions of the ACEURL. They still don’t display the lua code and neither produced errors in the console. Very strange. works just peachy on Windows, but not on Mac. if you want me to try anything else, please let me know.

OK. Thanks for checking. I think I’ve now got enough knobs and switches in there that it can at least not be permanently dead on Chrome/Mac. I’ll dig around more in the ACE world and see what I can learn. If 1.3.0 didn’t work for you, though, I’m surprised, because that’s what ALTUI uses, and I’d bet there are a lot of Mac users on ALTUI (possibly even amg0 himself). Eventually, the answer will present itself, as long as I keep digging…

Bit of a late-comer to this thread.
Is there a minium UI version requirements for the plugin?

[quote=“UKsub, post:48, topic:199700”]Bit of a late-comer to this thread.
Is there a minium UI version requirements for the plugin?[/quote]

UI7, certainly (no UI5/6). I’m not sure how far back on UI7, though. The oldest I currently build and test with is 7.0.22.

Version 1.5 is now available on all platforms.

In response to recent discussions about the fact that Luup encapsulates startup Lua and all scene Lua into a single large block that is “pre-compiled” at startup, and thus an error in startup Lua or any scene Lua block causes all startup and scene Lua to fail, I’ve added a compilation check when you exit a code field–it will test-compile the code and give you feedback if there are any errors. Although the ACE editor flags lines with errors as well, this check gives a specific error message, not just a red box on the line; and where ACE is not used or supported, feedback will be given where there was none previously.

Note that this will not detect runtime errors in your code (e.g. using a variable that you haven’t initialized), or logic errors, but generally those types of errors are not detected and flagged at compilation-time, and thus would not prevent that and the other code fragments from being compiled together.

Fantastic work, I love this Plugin.
This helped me recently to identity a bug I had in a scene (calling a global variable that got renamed) and that only work during winter. Very hard to spot with the built in ui. Thanks again for your work!

Patrick,
not sure what changed, but now ACE is working on chrome on my Mac. :wink:

[quote=“sebby, post:52, topic:199700”]Patrick,
not sure what changed, but now ACE is working on chrome on my Mac. ;)[/quote]

I was going to ask you to test that, so awesome! All I did was wrap the editor div in another div, as part of another change, but I wondered if that would affect the Mac issue. Happy for that good news!

Another fantastic Plugin! Thanks, rigpapa!!

Now that I’ve converted all my Vera scenes to Reactor, it might be cool for this plugin to also centralize any LUA code used in Reactor devices too (Activities etc). A possible future enhancement perhaps?

Possibly. Here’s the rub: All of the code LuaView shows executes in the same environment, so it makes sense to show them all together–startup Lua and scene Lua execute in the same environment. In contrast, Run Lua action code in a ReactorSensor runs under Reactor’s plugin context, and that’s enforced by Luup as a sandbox–the environment of startup Lua and scenes is not accessible to Run Lua (which is to say, if you create a global variable or function in one environment, it is not visible/accessible in the other). Presenting them all together, I fear, may lead to confusion.

Per the above, would it be possible to add a separate tab for Lua code contained within Reactor sensors. With a growing sensor library 20+, containing quite a bit of Lua stitched into various sensors, I’m starting to lose track of the mods I’ve made…

The Github stable branch for LuaView now contains two updates:

  1. I finally got the time to dig in and figure out how to keep the code, the Vera web UI, and the Vera itself in sync (this doesn’t apply to openLuup). For Startup Lua in particular, the web UI would be unaware that the Lua had changed, so I had to issue an advisory dialog in some cases to remind you to refresh the browser to keep it in sync. I believe we’re now past that.
  2. I’ve added a backup function of a sort–it displays all of your scene and startup Lua in a single page as plain text, with helpful headers, so you can save that file locally. Copy-paste from the file to restore.
  3. I’ve added a “Reload” button to the editor UI so you can reload Luup to see the effect of your changes (changes to Startup and scene Lua only take effect on reload).

Barring any accidents, this will become release 1.6 next week.

To install: go to the Github link above, click “Clone or download”, choose “Download ZIP”, unzip the downloaded file, and drag (as a group) the unzipped files to the uploader at Apps > Develop Apps > Luup Files.

1 Like

Ooh, I haven’t dicovered this plugin before :slight_smile: It would have saved a lot of time before, thanks @rigpapa. When I move soon I will replace all my old plugins with all yours plus the Alt-Hue etc. Today I am worried about that stability of my production unit (7.29) and I dont want to touch it. :grinning:

7.29 was a good release and has been the go-to for a long time. You should be confident doing whatever other work you need to do on it.

1 Like

Version 1.6 now released, with changes previously mentioned here.

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules