Module "urn_schemas-upnp-org_service_Dimming_1"

Standard service; "urn:schemas-upnp-org:service:Dimming:1". When required, it returns a single function which generates a new service table on every call (it takes no parameters). The upnp.devicefactory module takes the device/service tables to build device/service objects.

Requires to implement the following elements;

  • service.serviceStateTable.loadLevelTarget.afterset = function(self, oldval) ... end to process the changed loadLevelTarget value
  • When a containing device stops, is should stop ramping when ramping is in progress

Note: the RampRate variable deviates from the standard because the default value is not 0 but 5. The specified 0 is an illegal value, and is preventing RampUp() and RampDown() from working without first altering RampRate.

Functions

afterset (self, oldval) Implement this handler to add Dimming capability.


Functions

afterset (self, oldval)
Implement this handler to add Dimming capability. The handler should implement the actual dimming behaviour and set the 'LoadLevelStatus' variable to the new value when done.

Parameters:

  • self: statevariable object for the 'LoadLevelTarget' statevariable
  • oldval: the previous value of 'LoadLevelTarget'

Example:

-- Create a new Dimming service
local service = require("upnp.services.urn_schemas-upnp-org_service_Dimming_1")()


-- add implementation
service.serviceStateTable[1].afterset = function(self, oldval)
    -- do something useful here...
    print("Setting the Dimming value to", self:get(), "from", oldval)


    -- When done update value of Status to reflect the change
    self:getstatevariable("status"):set(self:get())
end

Valid XHTML 1.0!