Getting started with plugin development

Hi guys

First, I’d like to apologize if I’ve overlooked a tutorial, forum post or wiki article, but I haven’t quite found what I need yet (I think). FWIW I’m a postgrad-student in comp.sci/EE.

My problem:

I’ve read most of the wiki-articles regarding LuuP and plugins, but they all reference XML-files I can’t find anywhere. Examples are usually I_TestIR.xml and I_GC100.xml.
The front page of the wiki says:

Note: The Wiki documentation is for the Vera 1 units.
.. and I'm sitting with the Vera 2 units, so maybe that's part of the reason? :)

If anyone could point me in the direction of some Implementation-files I could use for reference and/or learning, that would be very valuable. Alternatively, if someone has a link to a forum-post that could help me, or something completely different, I’m all ears :slight_smile:

My project idea:

My first idea for a learning-project, would be to implement a dummy BinarySwitch myself, and just make it write to the log instead of doing anything useful. I’ve written the Device-spec and the Service-spec, but I’m kinda stuck with the Implementation.

If it is of interest, here are my attempts so far:

D_BinaryDummyDevice.xml
S_SwitchPower1.xml

… but I’m not sure about the implementation. It seems there are two ways to do it:

  1. A -tag and a bunch of functions with somewhat similar argument list
  2. An -tag and a bunch of 's

The wiki says:

There are several different nodes you can put within the "action" node.

Is there a Schema/DTD I can read, that documents the structure?

All help is appreciated :slight_smile:
Enjoy your weekends
Regards

Mikkel J

In UI4 go to “MIOS Developer” and the “Luup files” tab. Here you will find all XML files

It’s probably going to be easier to start if you look at the coded plugins that are hosted on
http://code.mios.com

There are a number of fully working Plugins there and each has illustrations of the general techniques (like tags, function declarations, blocks for IO etc)

Start with understanding something like the Weather Plugin, since it has no Physical-device dependency, then read through the others.

There is/was a Somfy blinds tutorial on the wiki but it’s somewhat dated now and is harder to read than rel code (or even just the I_xxxx.XML files from Vera itself)

Wow, you guys are quick! :smiley:

Well, I’m working on a more or less custom version of Vera2, so I only have two implementation XMLs (I_xxxx) available, and seemingly, they’re too simple to make anything out of. I should have told in my first post. Thanks for the suggestion anyway :slight_smile:

[quote=“guessed, post:3, topic:167359”]It’s probably going to be easier to start if you look at the coded plugins that are hosted on
Http://code.mios.com

There are a number of fully working Plugin there and each has illustrations of the general techniques (like tags, function declarations, blocks for IO etc)

Start with understanding something like the Weather Plugin, since it has no Physical-device dependency, then read through the others.

There is/was a Somfy blinds tutorial on the wiki but it’s somehow fated now and is harder to read than rel code (or even just the I_xxxx.XML files from Vera itself)[/quote]

Thanks a lot, I hadn’t thought of that! I’ll check it out right away :slight_smile:

It’s quite difficult for beginners to get the pieces together because there is no consistent and complete documentation for the development of custom Luup plugins.

http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand might be of interest.

IMHO, what is missing most (and difficult - and time consuming - to reverse engineer) is a formal specification of the json files, which define the GUI representation of a Luup device.

One inquiring mind would like to know what a “more or less custom version of Vera2” is :stuck_out_tongue:

To be honest, I’m not entirely sure myself. I started working with a company just recent, that sells home automation, and they’re using Vera with a custom localized UI. I’ve only just begun to work with it, so I’m still pretty much in the dark.

I am dreading the json files already, but oh well, I’m paid by the hour :wink:

I’ve stumbled upon a few other questions :slight_smile:

I want to build a tool to automate the process of uploading XML files and I find the web interface a bit cumbersome for quick changes. I want to make a quick script to do all the steps that the user-interface does, and I was kinda hoping for a more elegant solution, than a script that utilizes the UI :wink:

So to sum up, when I upload an XML file (or several) through the web-UI, what are the steps? As far as I can tell, it’s something like this:

  • convert file encoding to UTF8
  • LZO compress file(s)
  • place file(s) in /etc/cmh-ludl/

… am I missing anything ?

Assuming I’m not, which command line arguments should I pass to lzop? I’m thinking of compression ratio (1-9) etc. Does this matter at all?

I believe it would be easier to use WinSCP and put the files in /etc/cmh-ludl/ directly. It doesn’t matter if they are compressed or not

In the script that the web interface uses at /www/cgi-bin/cmh/upload_upnp_file.sh:

/usr/bin/pluto-lzo c "$FORM_upnp_file_1" /etc/cmh-ludl/"$FORM_upnp_file_1_name".lzo

Seems that’s all it does. So it should be doable with a bit of scp-ing and ssh-ing.

(Actually, if you have turned on the “restart Luup after upload” checkbox then it also runs the save_lu_reload() function from /www/cmh/js/ui3/cpanel_data.js which you can see is just an Ajax call.)

I am using scp already - I just didn’t realize that compression was optional :slight_smile:

[quote=“futzle, post:10, topic:167359”]In the script that the web interface uses at /www/cgi-bin/cmh/upload_upnp_file.sh:

/usr/bin/pluto-lzo c "$FORM_upnp_file_1" /etc/cmh-ludl/"$FORM_upnp_file_1_name".lzo

Seems that’s all it does. So it should be doable with a bit of scp-ing and ssh-ing.

(Actually, if you have turned on the “restart Luup after upload” checkbox then it also runs the save_lu_reload() function from /www/cmh/js/ui3/cpanel_data.js which you can see is just an Ajax call.)[/quote]

This is invaluable information - thanks a lot both of you :slight_smile:

Okay, now I’ve built a custom virtual device that manipulates som string and numbers and displays them in UI4. Now I need to get my hands on the ZWave part of this thing, so I can make plugins for non-virtual devices :wink:

Where to start? I’ve read the most obvious MCV wiki-articles and I know the basics about ZWave.

The ZWave module is mapped to /dev/tts/1 on my Vera box, so I guess it works like a serial/character device. So for debugging purposes, I can send input to the ZWave chip, by piping stdin > /dev/tts/1 - right? What about the other way around?

And is there any clever way, that I can see what’s going in and out of the ZWave chip?

tail -f /var/log/cmh/LuaUPnP.log | grep ‘^4’ will give you all of the serial communication to/from the z-wave chip.

[url=http://wiki.micasaverde.com/index.php/Luup_Debugging]http://wiki.micasaverde.com/index.php/Luup_Debugging[/url] for more detail.

… and don’t forget to enable verbose logging (‘Advanced’ → ‘Logs’).