Problem Toggling Virtual On/Off Device using Action Groups

Posted on
Mon Jul 03, 2023 11:07 am
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Problem Toggling Virtual On/Off Device using Action Groups

The goal is to have my Z-Wave remote toggle a particular device ON and OFF with the press of button 1 (toggle function).

This is how I set it up, but I am having some issues:

I created 2 action groups. One Action Group runs a Python script to turn the device ON, the other action group turns it OFF. These separate scripts work in isolation.

I then created a Virtual On/Off Device, specifying the appropriate Action Group for On Group and Off Group. I did not check Supports Toggling for now.

I then created a trigger that looks for a Z-Wave command of button 1 pressed, and an action that says Toggle On/Off (Light/Appliance Control) for the Virtual On/Off Device above.

So the problem is that the On/Off python script command never makes it to the device.

If I turn on Supports Toggling in the Virtual Device, and select the On Action Group, the device will turn on, but never off.

I read the documentation, but clearly still don't understand how Virtual Devices are supposed to work, or maybe what I am doing is overcomplicating things.

FYI - the devices in question are TP-Link, and I am going back to Python scripts for everything because I have been having issues with the TP-Link plugin. The Python scripts are solid for what I want to do.
Attachments
Screenshot 2023-07-03 at 9.50.35 AM.png
Screenshot 2023-07-03 at 9.50.35 AM.png (340.79 KiB) Viewed 2592 times
Screenshot 2023-07-03 at 9.50.21 AM.png
Screenshot 2023-07-03 at 9.50.21 AM.png (335.15 KiB) Viewed 2592 times
Screenshot 2023-07-03 at 9.49.32 AM.png
Screenshot 2023-07-03 at 9.49.32 AM.png (504.19 KiB) Viewed 2592 times
Screenshot 2023-07-03 at 9.49.15 AM.png
Screenshot 2023-07-03 at 9.49.15 AM.png (492.39 KiB) Viewed 2592 times
Screenshot 2023-07-03 at 9.33.10 AM.png
Screenshot 2023-07-03 at 9.33.10 AM.png (489.48 KiB) Viewed 2592 times

Posted on
Mon Jul 03, 2023 12:01 pm
FlyingDiver offline
User avatar
Posts: 7266
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Problem Toggling Virtual On/Off Device using Action Grou

You can't use the Toggle on/off device command if the device doesn't support toggling. Which your Virtual Device does not. So you need to combine the scripts into one script that can actually toggle the device. If you can't query the device in the script to see the current state then you should use an Indigo variable to keep track of the state.

Actually, you can keep the scripts you have, and just write a simple script that checks an Indigo variable, turns the device on or off, then updates the variable.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Jul 03, 2023 12:07 pm
FlyingDiver offline
User avatar
Posts: 7266
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Problem Toggling Virtual On/Off Device using Action Grou

Or you could do it just in the trigger with no additonal scripts at all.

Put a condition on the trigger to check an indigo variable. If off, then run the on script. Then a second action to change the variable to on.

Then duplicate the trigger with the reversed logic. If on, run the off script. And update the variable to off.

Yes, you now have two triggers, One to turn it on, one to turn it off.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Jul 03, 2023 1:13 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Problem Toggling Virtual On/Off Device using Action Grou

FlyingDiver wrote:
Or you could do it just in the trigger with no additonal scripts at all.

Put a condition on the trigger to check an indigo variable. If off, then run the on script. Then a second action to change the variable to on.

Then duplicate the trigger with the reversed logic. If on, run the off script. And update the variable to off.

Yes, you now have two triggers, One to turn it on, one to turn it off.


This is what I did, and works great, thank you.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests