[ANSWERED]: Making a action group toggle on/off...

Posted on
Wed Dec 09, 2015 12:35 am
P15-D24 offline
User avatar
Posts: 108
Joined: Jun 25, 2005
Location: Santa Barbara, CA

[ANSWERED]: Making a action group toggle on/off...

Have an Insteon scene defined and attached to an action group. In my custom control page I attach the action group to my control (button) with a server action "send scene 1 (Test Scene) on". In browser preview the control will turn it on but how do I make it act like a on/off toggle?

Running OS X 12.2.1 on 2018 Mac Mini, Indigo 2022.2
http://www.p15-d24.com

Posted on
Wed Dec 09, 2015 12:45 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Making a action group toggle on/off in a control page...

There's no GUI-only way of achieving this at present.

You need two action groups to start with - one that sends scene 1 on, like you have, and another that sends scene 1 off.

Then depending if/how you want to track state and if/ how you want to call the scenes, you can create a third action with embedded code that says "if on then run the 'off' action, otherwise run the 'on' action".

Or, you can use a virtual on/off device that maintains the state in a variable, but has on/off/toggle ability - the on and off just call your existing actions, and the toggle calls your toggle action.

I'm hoping Indigo 7 will allow the virtual device to call it's own on/off actions upon toggle, rather than needing a third toggle action.


Sent from my iPhone using Tapatalk

Posted on
Thu Dec 10, 2015 9:58 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Making a action group toggle on/off in a control page...

howartp wrote:
I'm hoping Indigo 7 will allow the virtual device to call it's own on/off actions upon toggle, rather than needing a third toggle action.


I'll add that to the request list (I didn't find it and I don't recall anyone requesting it before).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Dec 10, 2015 10:34 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: [ANSWERED]: Making a action group toggle on/off...

I've never used it in that way, but there's been three threads in the last month where it would have answered the question.


Sent from my iPhone using Tapatalk

Posted on
Tue Dec 15, 2015 11:13 am
rycardo offline
Posts: 53
Joined: Jul 10, 2015

Re: [ANSWERED]: Making a action group toggle on/off...

Have an Insteon scene defined and attached to an action group. In my custom control page I attach the action group to my control (button) with a server action "send scene 1 (Test Scene) on". In browser preview the control will turn it on but how do I make it act like a on/off toggle?


Could creating a virtual device solve what you are wanting to do? Turning on/off the virtual device would execute your action group(s).

Posted on
Tue Dec 15, 2015 12:03 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: [ANSWERED]: Making a action group toggle on/off...

That's exactly what's been suggested through this thread...

Toggle won't work though.


Sent from my iPhone using Tapatalk

Posted on
Tue Dec 15, 2015 2:49 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]: Making a action group toggle on/off...

Toggle will work in a Virtual On/Off device, if you use a variable to hold the state of the device. Then, you set the variable to "on" in the ON action group and "off" in the OFF action group. Then create a toggle group that toggles based on the variable value. It's a bit more work, bit it's doable.

For completeness, configure your Virtual On/Off device with a variable that will hold it's status, then create an action group with the following Python script:

Code: Select all
device = indigo.devices[YOURVIRTUALDEVICEIDHERE] # the ID of your Virtual On/Off Device
variable = indigo.variables[int(device.globalProps['com.perceptiveautomation.indigoplugin.devicecollection']['statusVariable'])]
if not variable.getValue(bool):
    indigo.actionGroup.execute(int(device.globalProps['com.perceptiveautomation.indigoplugin.devicecollection']['onActionGroup']))
else:
    indigo.actionGroup.execute(int(device.globalProps['com.perceptiveautomation.indigoplugin.devicecollection']['offActionGroup']))


This will get the variable, on and off action group IDs from the device - then it looks at the variable and determines if it needs to execute the on action group or the off action group. Set this action group to the Virtual On/Off device's Toggle Action Group and you're good.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Dec 15, 2015 5:18 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: [ANSWERED]: Making a action group toggle on/off...

Cool, thanks Jay.


Sent from my iPhone using Tapatalk

Posted on
Sat Jan 02, 2016 3:11 pm
cdeggz offline
Posts: 33
Joined: Nov 30, 2014

Re: [ANSWERED]: Making a action group toggle on/off...

This is the solution, although if indigo knows my on group, off group, and variable, I don't see why a toggle group is needed. Hopefully in the future you can toggle a virtual device directly without the script.

Posted on
Sat Feb 13, 2016 7:48 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: [ANSWERED]: Making a action group toggle on/off...

Seconding (or thirding?) the request. I actually found this thread because of this issue. The python code provided up thread works, but as the others stated, seems unnecessary given that "on" and "off" are already defined and a variable is used to track status ( in my case, I have a sensor on a theater screen and want to toggle it up/down).

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests