equivalent to "Set Virtual On/Off Device State" via python

Posted on
Fri Feb 12, 2021 6:05 pm
tcherna offline
Posts: 24
Joined: Apr 14, 2018

equivalent to "Set Virtual On/Off Device State" via python

I'm wondering if there is a way to script setting the device state to on or off via a python script (Server Actions->Script and File Actions) vs Device Actions->Virtual Device Controls

Posted on
Sat Feb 13, 2021 1:31 am
neilk offline
Posts: 715
Joined: Jul 13, 2015
Location: Reading, UK

Re: equivalent to "Set Virtual On/Off Device State" via pyth

Take a look at https://wiki.indigodomo.com/doku.php?id=indigo_6_documentation:plugin_scripting_tutorial that should point you in the right direction, with the first example.

Posted on
Sat Feb 13, 2021 12:40 pm
tcherna offline
Posts: 24
Joined: Apr 14, 2018

Re: equivalent to "Set Virtual On/Off Device State" via pyth

Right, but that page talks about how to turn the device on, which I think is different then setting the internal state of the virtual device (otherwise why would there be a special command for it). Specifically, calling the on method would activate the on action group, but setting its internal state does not. This would be the shortcut to setting the variable, if I was using a status variable.
Last edited by tcherna on Sat Feb 13, 2021 1:04 pm, edited 1 time in total.

Posted on
Sat Feb 13, 2021 1:03 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: equivalent to "Set Virtual On/Off Device State" via pyth

You can script the UI action to set a Virtual Device state. And, no, you aren't crazy, I realized that it was missing from the docs to I just added it... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Feb 13, 2021 1:09 pm
tcherna offline
Posts: 24
Joined: Apr 14, 2018

Re: equivalent to "Set Virtual On/Off Device State" via pyth

There is an extra & in the link ;)

Posted on
Sat Feb 13, 2021 1:17 pm
tcherna offline
Posts: 24
Joined: Apr 14, 2018

Re: equivalent to "Set Virtual On/Off Device State" via pyth

Thanks Jay. A follow up question. Is it more efficient to create a virtual device with a named variable, or an implicit one (and use the above scripting to set it)?

Posted on
Sat Feb 13, 2021 1:34 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: equivalent to "Set Virtual On/Off Device State" via pyth

tcherna wrote:
There is an extra & in the link ;)


Fixed, thanks for the heads up.

tcherna wrote:
Thanks Jay. A follow up question. Is it more efficient to create a virtual device with a named variable, or an implicit one (and use the above scripting to set it)?


I suppose using the action (via UI or script) is maybe slightly more efficient since we wouldn't have to process variable changes, but the plugin is already receiving all variable updates anyway so the actual processing is negligible.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests