Wrapping it all up with love

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 :wink:

At present I have the following functions developed and working in Lua:

  • Pause / Unpause Downloads
  • Return current state (Paused, Unpaused)
  • Throttle to 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.

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

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