Plugin;VSwitch creates 2 status vars, after luup.set there are 3 status vars

I just installed Plugin 1408::Virtual ON/OFF Switches

When i look at the advanced settings there are 2 status vars.
In a scene i tried to update the status var and nothings happened.
I looked at the advanced settings to see what (didn’t) happen and instead of 1 of the status vars where changed, it created another status var.

So the device now has 3 status vars and isn’t switching.

Now my question is;

  • How could it be that the plugin creates 2 status vars on a clean install?
  • how could i force luup to use/update the status var, and prevent luup to create a third status var?

It looks as though you are using the wrong service ID in your luup.variable_set(…) call. It should be:

luup.variable_set("urn:upnp-org:serviceId:VSwitch1","Status",<newStatus>,<deviceNumber>)

You should really be using an action to change the switch rather than directly changing the State Variable:

luup.call_action("urn:upnp-org:serviceId:VSwitch1","SetTarget",{newTargetValue=1},<deviceNumber>)

i use this “codeline” to set the var;

luup.variable_set("urn:schemas-upnp-org:device:VSwitch:1","Status", 1 , 104)
and now see what i was doing wrong.

Besides this problem, it doesn’t solve the 2 status vars on creation of the plugin.

[quote=“freemann, post:3, topic:181089”]i use this “codeline” to set the var;

luup.variable_set("urn:schemas-upnp-org:device:VSwitch:1","Status", 1 , 104)
and now see what i was doing wrong.

Besides this problem, it doesn’t solve the 2 status vars on creation of the plugin.[/quote]

That is not the correct service ID and it is why you gained a stray variable. It will not do any harm. If you want to lose it, you will have to create a new VirtualSwitch and then delete the old one.

The main “problem” is that when i install the plugin it creates an device in “devices”.
This main/new device has from scratch 2 status vars.

So before i run any code or set/change any value with luup of in device->advanced, there are already 2 status vars.

It works with the 2 status vars, but i think its strange that the plugin creates an devices with 2 the same vars.

This main/new device has from scratch 2 status vars.

Did you create the new device before deleting the old one? If not, the stray variable that you added is getting retained.

If you hover your cursor over the variable on the Advanced tab, it will show you the service ID under which it was created.

It happened when i installed the plugin for the first time and the plugin created the main/new device for the first time.

In the mean while i un-installed the plugin several times and re-installed it. Each time the plugin creates the main device with 2 status vars.

Each time the plugin creates the main device with 2 status vars.

What are the two service IDs?

I’ve done that with a plugin I wrote too. I did it because I wanted the device to not only have its own internal Status variable but I wanted it to also appear to control points as a binary light switch too, which has its own Status variable, in a different namespace (service ID). (Tip: Hover the mouse pointer over the variable name to see the namespace.)

It wouldn’t surprise me to learn that the plugin prefers that you avoid setting the Status variable yourself with luup.variable_set, and that you call an action on the plugin with luup.call_action. That way the plugin can ensure that its variables are always internally consistent.

I have VirtualSwitch V1.32 installed. It creates a single Status variable with the service ID urn:upnp-org:serviceId:VSwitch1.

ok, i’m on 1.34 and here is a chrome debug from the source with the title tag.
It looks like there are 2 serviceId’s, is that by design? an bug? or… ?

Rex, I don’t know how many times you can repeat yourself :wink:

Don’t know who’s the developer of this plugin, but it would be very helpful when this behavior of the plugin with the vars is documented.

Don't know who's the developer of this plugin

That would be @chixxi.

VirtualSwitch is a very useful and popular plugin. If the author has added a second service ID, it was probably to improve support by remote Apps. I don’t see why it would cause you any problems.

I gave a plausible reason for “by design” two posts above yours.

We are at a bit of a loss to understand why this matters to you so much. What are we missing?

I gave a plausible reason for “by design” two posts above yours.[/quote]
I’ve seen that…“cross” post?

We are at a bit of a loss to understand why this matters to you so much. What are we missing?
What do you mean? what is happening to much? i don't know what your are missing.