define device type

i wrote a plugin which “simulates” a binary switch … everything works perfect
BUTthe device is not populated as a BinaryLight
it uses the name of my plugin instead.

can someone maybe hint me how i can hard-set this so the rest of the world wil regornice it as a Switch and not as a “other device”

Hi nullx8,

You will need to do the following :

  • add “1” in your plugin device file;
  • create the “virtual” binary light like this :
luup.chdev.append(DEVICE_ID, APPEND_POINTER, ALT_ID, DEVICE_NAME, "urn:schemas-upnp-org:device:BinaryLight:1", "D_BinaryLight1.xml", nil, <nil or any variable you want to set>, false)
  • into implementation file define the following action :
<action>
	<serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
	<name>SetTarget</name>
		<job>
			-- add your custom implementation here or define a function that do it like this : setTarget( lul_settings.newTargetValue, lul_device ) 
		</job>
</action>
  • handle “Status” variable in order to display the state for your device;

Similar, you can create and use all our default devices.

Here you can find information regarding the actions, variables and services for the default devices :

http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions

All the Bests,

  • Andrei -

i do have the action set as described
here the original:

	<action>
        <serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
		<name>SetTarget</name>
		<job>
			local newTarget = lul_settings.newTargetValue or ""
			if (newTarget == '1') and (newActivityID ~= '') then 
				FlipOn()
			else 
				FlipOff()
			end
			return 4,nil
		</job>
    </action>

but handleChildren is at 0 in the Device file

where is the “luup.chdev.append” supposed to go, since the plugin itself does create a “switch” already … or is the append action creating something invisible ?