We have moved at community.getvera.com

Author Topic: Wrapping it all up with love  (Read 3060 times)

Offline Klunket

  • Sr. Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
Wrapping it all up with love
« on: June 21, 2010, 07:19:25 am »
So, I'm writing a plugin for SABnzbd (http://sabnzbd.org/) so that Vera is aware of the state of the downloads, etc. SABnzbd needs to be hosted on another computer, but Vera will be able to do some interesting things:

* Throttle downloads when I am in the house.
* Unthrottle when I am out or in bed.
Other stuff that will no doubt come to me over time ;)

At present I have the following functions developed and working in Lua:
* Pause / Unpause Downloads
* Return current state (Paused, Unpaused)
* Throttle to <X> k/bs
* Return current download rate
* Return items in the queue
And a few other useful items relevant to controlling downloads with SABnzbd.

I'm now up to wrapping it up as a LuuP plugin.

Questions I have:

1) I would like SABnzbd to appear as a device on the Dashboard - Is there a generic on/off appliance that won't have a lightbulb next to it? Preferably just an on/off switch or similar?

2) I want to have the plugin periodically poll the state of SABnzbd in case the user has paused it with the native SABnzbd web interface. How can I make the Luup plugin call a function regularly and update the state of the device.

3) If I create my device as one of the standard UPNP types (Lightswitch for example), am I still able to have extra functionality hanging off of it - for example, I still want to allow the downloads to be throttled, etc. I assume these will show up in the Advanced section of the plugin when making scenes with it.

Fairly in depth questions I guess, but I would greatly appreciate any pointers or information that people can provide. For now I'll be experimenting with some of the existing plugins.

guest4690

  • Guest
Re: Wrapping it all up with love
« Reply #1 on: June 21, 2010, 10:17:43 am »
2) I want to have the plugin periodically poll the state of SABnzbd in case the user has paused it with the native SABnzbd web interface. How can I make the Luup plugin call a function regularly and update the state of the device.

you use either luup.call_delay() or luup.call_timer() to make Luup call your function after a while. (check http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_call_delay)

3) If I create my device as one of the standard UPNP types (Lightswitch for example), am I still able to have extra functionality hanging off of it - for example, I still want to allow the downloads to be throttled, etc. I assume these will show up in the Advanced section of the plugin when making scenes with it.

in your device specification file (usually D_xxxx.xml) you can specify more than one service definition files (those like S_xxxxx.xml).  usually you choose one or two 'standard' ones, and then one extra to fill the extra functionality.