trying to get Virtual switch working UI4

I have installed virtual switch in UI5 copied some code and it’s working fine. I can’t for the life of me get one working on UI4 (1.1.1245) I have tried files from several different sources in the forums and wiki, I can create a device with buttons that work and status changes appropriately between 0 and 1 when operated, and I used the same code that is working for me in UI5 but it does not seem that the code is acctually checking the device state since this code;
scene = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,146)
if(scene==“1”)then
return true
else
return false
end
never lets the scene run regardless of switch position, and this code;
scene = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,146)
if(scene==“1”)then
return false
end
always lets it run, again regardles of switch position, anyone know what I’m doing wrong?
steps used to create device (repeated with different device files);
upload D_StateDevice.xml and I_StateDevice.xml>create device by entering first file in "UpnpDevFilename " field and second file in “UpnpImplFilename” field>create device, on dashboard hit save button to restart and get a virtual switch that appears functional, but not able to make it work as above

[quote=“pgrover516, post:1, topic:170423”]I have installed virtual switch in UI5 copied some code and it’s working fine. I can’t for the life of me get one working on UI4 (1.1.1245) I have tried files from several different sources in the forums and wiki, I can create a device with buttons that work and status changes appropriately between 0 and 1 when operated, and I used the same code that is working for me in UI5 but it does not seem that the code is acctually checking the device state since this code;
scene = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,146)
if(scene==“1”)then
return true
else
return false
end
never lets the scene run regardless of switch position, and this code;
scene = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,146)
if(scene==“1”)then
return false
end
always lets it run, again regardles of switch position, anyone know what I’m doing wrong?
steps used to create device (repeated with different device files);
upload D_StateDevice.xml and I_StateDevice.xml>create device by entering first file in "UpnpDevFilename " field and second file in “UpnpImplFilename” field>create device, on dashboard hit save button to restart and get a virtual switch that appears functional, but not able to make it work as above[/quote]

On my virtual switch it would be
scene = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,146)

@CMRancho, Thanks a million that did it! Strangely that syntax (from yours) didn’t work on my V3, thats how I ended up with what I posted which does work on my V3, weird science indeed

This is not “weird science”. You are using two different device files, the one you are using on UI5 is from this plugin http://apps.mios.com/plugin.php?id=1408, the files you are using on UI4 are from somewhere else in this forum. Therefore you have two different serviceID’s.

chixxi: Thanks for all your great contributions to the forums! I was lightheartedly referring to the end user experience where there are a ton of small ways to go wrong (plug and play anyone?) not suggesting there isn’t a perfectly rational explanation for each scenario. Cheers!
Paul 8)