[_CODE_] UGC - UPnP GUI Compiler V0.2

EOL, unsupported.

Preliminary information:
[tt]UGC[/tt] is a Lua script that creates a Luup device ([tt]D_.xml, D_.json, I_.xml, S_.xml[/tt]) for UPnP devices.

Preliminary instructions:

  1. Import your [tt]UPnP[/tt] device via MiOS.
  2. Fix the imported Luup device, see [tt]http://forum.micasaverde.com/index.php/topic,10165.0.html[/tt].
  3. Paste [tt]UGC[/tt] into the ‘Test Luup code (Lua)’ window.
  4. Adjust the user-adjustable settings (‘BEGIN/END user-adjustable setting’) to your needs.
  5. Press ‘Go’.
  6. Create the device: Upnp Device Filename: D_<COMPILED_DEVICE_NAME>.xml
  7. Restart [tt]LuaUPnP[/tt] several times.

Limitations:
GIGO-ware (garbage in, garbage out)
UI5 only
[tt]ControType[/tt]s supported: [tt]button, label, variable[/tt]
Doesn’t overwrite existing files (files must be deleted manually).
Affected by bug [tt]http://bugs.micasaverde.com/view.php?id=2329[/tt].

History:
V0.2: support for ControlType ‘variable’ (polling only)

Justification for polling: :slight_smile:
Excerpt from AVTransport:3 Service SDCP:
Each control point can poll for these values at a rate appropriate for their application, whenever they need
to. For example, a control point can invoke GetPositionInfo() every second when the TransportState is
“PLAYING”, “RECORDING” or “TRANSITIONING”. This is more efficient and flexible than requiring
event notifications to be sent to all subscribing control points, in all cases.

Download:
[tt]https://docs.google.com/open?id=0Bz4omZm4gYcsM0NEVEtQdWhGT1k[/tt]

Of course, [tt]UGC[/tt] isn’t limited to [tt]UPnP[/tt] devices imported via MiOS - all MiOS devices are [tt]UPnP[/tt] devices …

To create a custom dashboard presentation for a dimmer (device number 30), use:

--
-- BEGIN user-adjustable settings
--

local UPnP_device_id       = 30                -- MiOS device id of UPnP device to be controlled
local COMPILED_DEVICE_NAME = 'MyDimmingDevice' -- name for Luup device files to be created

local SID_DIMMING     = 'urn:upnp-org:serviceId:Dimming1'
local SID_SWITCHPOWER = "urn:upnp-org:serviceId:SwitchPower1"
local SID_HADEVICE    = "urn:micasaverde-com:serviceId:HaDevice1"

-- button  : { xpos, ypos }_Dashboard, { xpos, ypos }_DeviceTab, ControlType, label on GUI, service id, action, parameters
-- label   : { xpos, ypos }_Dashboard, { xpos, ypos }_DeviceTab, ControlType, label on GUI

-- not yet implemented:
-- variable: { xpos, ypos }_Dashboard, { xpos, ypos }_DeviceTab, ControlType, service id, variable

local GUI = {
              { { 0, 0 }, {  10,  10 }, 'button'  , 'On'         , SID_SWITCHPOWER, 'SetTarget'         , '{newTargetValue = "1"}'      },
              { { 0, 1 }, {  10, 200 }, 'button'  , 'Off'        , SID_SWITCHPOWER, 'SetTarget'         , '{newTargetValue = "0"}'      },
              { { 1, 0 }, {  40,  10 }, 'button'  , '25%'        , SID_DIMMING    , 'SetLoadLevelTarget', '{newLoadlevelTarget = "25"}' },
              { { 1, 1 }, {  40, 200 }, 'button'  , '75%'        , SID_DIMMING    , 'SetLoadLevelTarget', '{newLoadlevelTarget = "75"}' },
              { { 2, 0 }, {  70,  10 }, 'button'  , 'Toggle'     , SID_HADEVICE   , 'ToggleState'       , '{}'                          },
              { { 2, 1 }, {  70, 200 }, 'button'  , 'Poll'       , SID_HADEVICE   , 'Poll'              , '{}'                          },
              { { 3, 0 }, { 100,  10 }, 'label'   , 'Level:'                                                                            }
--              { { 3, 1 }, { 100, 200 }, 'variable', SID_DIMMING, 'LoadLevelStatus'                                                      }
            }

--
-- END user-adjustable settings
--

@Ap15e, this is terrific. I learn something interesting from almost any code you post, I need to clean up the dashboard presentations for my various plugins and this is very helpful. Thank you!

[tt]UGC 0.2[/tt] adds support for the [tt]ControlType ‘variable’[/tt] (including support for extraction of data from [tt]DIDL-Lite[/tt] messages, see first post).

Hi Ap15e,

your google doc link is dead (Error 404). May I found it elsewhere ?

Thanks

[quote=“Antor, post:5, topic:171156”]Hi Ap15e,

your google doc link is dead (Error 404). May I found it elsewhere ?

Thanks[/quote]

Ap15e is no longer on the forum and has removed all of his work. There is no way of getting the plugins or documentation. And is frowned upon trying to get it from others as you are violating his wishes to not have it distributed.

  • Garrett