Recommended way of work to develop and test

Hi

What is the recommended way of work when developping a plugin ?
Is it better to work directly on the Veraa using a SSH session and vi editor ?
Is it better to develop files on a PC and then deploy them each time I want to test them ?
Do we have to take care about dos to unix / unix to dos conversion ?

Loading of files using the dashboard: is it only a file transfer ?

When you load files through the dashboard it also compresses them, which you can do after the fact with a script.

Basically the best way I know of developing a plugin is test it as much as possible using a Lua interpreter on a PC, and then upload (via ssh /w compress script or dashboard), and see if it works on Vera.

Once you get the basics of the plugin filled in you probably will only need to upload one file (the .lua file) when you make changes.

Also see these recent threads:

http://forum.micasaverde.com/index.php/topic,9607.0.html

http://forum.micasaverde.com/index.php/topic,9533.0.html

YMMV, but here is my approach:

  1. Setup public key authentication for SSH to Vera (Not absolutely necessary, but makes using SSH in scripts easier)
  2. Edit files on my PC (actually a Mac in this case) using a “Lua aware” editor. I use the Koneki plugin for Eclipse, mainly because I use Eclipse to develop in Java as well.
  3. As soon as I save a file, I have a script that triggers an automatic copy of the files across to my VeraLite, and restarts the LuaUPnP process. (and also downloads the log file - its easier to search through on my PC)

With UI5 (the only version I have experience with), you can just upload all your files uncompressed and MiOS will recognize them. (Actually, with the current UI5 release, there is a bug where it won’t recognize compressed files so you have to leave them uncompressed)

The dashboard appears to just copy files to the appropriate directory on the Vera. The setup of the plugin is done separately.

I haven’t tried it, but I know Linux supports an SSH Fuse module that you could use (if you’re running Linux on your PC) to actually “mount” the Vera filesystem locally. That could be another option.

Hope that helps!

Hugh

I have another approach.
I too depend on simple SSH so I have a host name to represent the Vera IP address and I have public key authentication setup. (Otherwise you get a lot of password prompts)

However I use Emacs (The only good thing that came out of the 1980’s Artificial Intelligence initiatives). It’s an extensible editor … almost a desktop operating environment.
From my PC, in the editor, I can open buffers (windows) to do remote directories, open for read/write files on Vera, even have a shell there to execute commands.
The file and directory names look like: vera:/tmp/log/cmh/LuaUPnP.log (i.e. the
scp file syntax)
I can open the log file and just refresh the buffer to get the latest log.
From the Vera shell buffer I can execute commands.
And of course I have lots of buffers for files I am working on … it is context sensitive for Java, XML, C, C#, perl, python, …

It recognizes compressed Lua file and decompresses them before loading into buffer and compressing when writing. Of course once your are in the buffer, just rename the buffer (file extension) to get the desired behavior.

I have always used Emacs along side of Eclipse and Visual Studio … there are many things I can do quicker in Emacs … and it works nicely in both environments. Each one recognizes when a change has been made outside it’s own environment.

My only complaint is that Vera buffers it’s output to the log file … so you have to wait a little while to see what it wrote there. Often I click on other things just fill up the output buffer.

There are still a few of us old unix zealots that still believe Real Men Only Have emacs in their .login

There is a setting that turns off buffering in the Luup log. I’ll look for it on the forum when I am near a real computer.

Edit: or, chixxi will find it first. Thanks!

ssh on your vera
in the file /etc/cmh/cmh.conf set “ImmediatelyFlushLog = 0” to “ImmediatelyFlushLog = 1”
save
restart lua engine or reboot vera (don’t remember)

[quote=“hugheaves, post:3, topic:170660”]YMMV, but here is my approach:

  1. Setup public key authentication for SSH to Vera (Not absolutely necessary, but makes using SSH in scripts easier)
  2. Edit files on my PC (actually a Mac in this case) using a “Lua aware” editor. I use the Koneki plugin for Eclipse, mainly because I use Eclipse to develop in Java as well.[/quote]

LDT plugin is now installed. Happy to be able using Eclipse…

3. As soon as I save a file, I have a script that triggers an automatic copy of the files across to my VeraLite, and restarts the LuaUPnP process. (and also downloads the log file - its easier to search through on my PC)

Could you share your script (if running on Windows) ?

I just installed WinSCP to upload/download files.

With UI5 (the only version I have experience with), you can just upload all your files uncompressed and MiOS will recognize them. (Actually, with the current UI5 release, there is a bug where it _won't_ recognize compressed files so you have to leave them uncompressed)

Plugins I have already installed using the APP market put files with lzo extension in the /etc/cmh-ludl directory. These files are compressed and recognized by the lua engine. So ?

Hope that helps!

Yes, thank you.

futzle and chixxi, you guys provide a wealth of knowledge to this forum.

Certainly. I’ve attached the script. It’s fairly crude, but it works. :slight_smile:

It should work fine under windows, but you’ll need to install something like Cygwin (http://cygwin.com) so that you can run it.

Yes, I should qualify my statement. The bug only affects Lua files that are loaded at run-time using the “require” mechanism. If your module loads files using the tag in the device definition, then there’s no issue. The issue looks like it’s solved in the current private-beta, so hopefully MCV will make that public soon!

Hugh

And for editing the different XML files, what tool do you recommend ?
A good plugin for Eclipse ?

A XML editor is included (probaby by default) into Eclipse but the problem is that the lua code is displayed on a unique line without carriage returns. I can copy it in Eclipse in the lua editor, the formatting is then ok (multiple lines). After modifying the code, if I copy my lua code and paste it in the XML tag, it looks like only the first line of my lua code is taken into account.
How do you manage easily these transfers between XML eidtor and lua editor ?

For anything more than toy plugins, I recommend that you don’t put your Lua into the I_.xml file. Stick a stub in the implementation file that require()s your real Lua, and put the Lua into its own file, customarily named L_.lua.

Link: http://forum.micasaverde.com/index.php/topic,5966.msg35275.html#msg35275

[quote=“futzle, post:12, topic:170660”]For anything more than toy plugins, I recommend that you don’t put your Lua into the I_.xml file. Stick a stub in the implementation file that require()s your real Lua, and put the Lua into its own file, customarily named L_.lua.

Link: http://forum.micasaverde.com/index.php/topic,5966.msg35275.html#msg35275[/quote]

Ok, I will do it like that, I discovered yesterday an example with the Denon plugin.
Is it still required to adjust the path in the plugin startup with current firmware ?

It’s optional if you are targetting UI5 only. For a plugin that will run on both UI5 and UI4, the linked code is needed.