There seems to be a problem with the virtual dimmer device.
The OFF button does not work for me.
The ON button does work OK and the slider 0% to 100% works OK also.
However when I press the OFF button the device is not turned off.
How to fix ?
This is the original code in the I_DimmableLight1.xml file:
<?xml version="1.0"?>
<implementation>
<functions>
function virtual_dimmable_light_startup (lul_device)
luup.log ("Virtual dimmable light running...")
end
</functions>
<startup>virtual_dimmable_light_startup</startup>
<actionList>
<action>
<serviceId>urn:upnp-org:serviceId:Dimming1</serviceId>
<name>SetLoadLevelTarget</name>
<job>
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", lul_settings.newLoadlevelTarget, lul_device)
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", lul_settings.newLoadlevelTarget, lul_device)
if (tonumber (lul_settings.newLoadlevelTarget, 10) == 0) then
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", "0", lul_device)
else
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", "1", lul_device)
end
return 4, 5
</job>
</action>
</actionList>
</implementation>
UPDATE:
Updated code fixes the OFF button:
<?xml version="1.0"?>
<implementation>
<functions>
function virtual_dimmable_light_startup (lul_device)
luup.log ("Virtual dimmable light running...")
end
</functions>
<startup>virtual_dimmable_light_startup</startup>
<actionList>
<action>
<serviceId>urn:upnp-org:serviceId:Dimming1</serviceId>
<name>SetLoadLevelTarget</name>
<job>
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", lul_settings.newLoadlevelTarget, lul_device)
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", lul_settings.newLoadlevelTarget, lul_device)
if ( tonumber(lul_settings.newLoadlevelTarget or 0) ) == 0 then
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Target", "0", lul_device)
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", "0", lul_device)
else
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Target", "1", lul_device)
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", "1", lul_device)
end
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
<name>SetTarget</name>
<job>
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Target", lul_settings.newTargetValue, lul_device)
luup.variable_set ("urn:upnp-org:serviceId:SwitchPower1", "Status", lul_settings.newTargetValue, lul_device)
if lul_settings.newTargetValue ~= "0" then
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", "100", lul_device)
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", "100", lul_device)
else
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", "0", lul_device)
luup.variable_set ("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", "0", lul_device)
end
return 4, 5
</job>
</action>
</actionList>
</implementation>
Updated I_DimmableLight1.xml file here:
I_DimmableLight1.zip (602 Bytes)