Jump to content

Example of using Virtual Buttons to add feral smart devices to UD scenes


Go to solution Solved by bwade913,

Recommended Posts

Posted

I have a smart light bulb from a company named Wiz. It doesn't have a dedicated node server that can control it, it's what I refer to as a feral device, but it does have an app that can be used to integrate it as an Alexa controlled device. The Virtual Buttons NS can be used to control any Alexa integrated device using a UD program, but it wasn't obvious at first how to control the feral device through a scene. My solution is to trigger the program with the status of another device in the scene in question.

This program detects the scene turning on due to the light switch "Office Main" turning on to its usual 50% level. It calls the program "Desk Lamp On" which is the feral smart bulb.

image.png.0a32f456e06971d2b66d7b8ddf32e2d0.png

 

The "Desk Lamp On" program uses a virtual button from the NS to trigger an Alexa Routine. The variable $DeskLamp is set just to track status for a separate toggle program.

image.png.cacca147aee71cb22070d57976423285.png

 

The Alexa Routine turns on the light in response to the virtual button.

image.jpeg.ec6260499e61c356cc31e41652b1a19c.jpeg

 

 

There are corresponding programs and a routine for turning off the light.

image.png.ff0ad35a9a2942747e82cf955dfc950f.png

 

image.png.a96197656214094c42f3da6406cd9f31.png

 

image.jpeg.90a33e53f1ab225f728784ecd29e735d.jpeg

 

 

  • Like 1
  • Thanks 1
Posted

@bwade913, You can eliminate the first 2 programs by adding the virtual button 01 to the scene.  When the scene fires the button will be pressed. You still need a 2nd button however to shut it off.

There is another NS call Virtual that allows you to add as many switches as you want.  These can also be added to scenes but act as a toggle not a push button.  When the scene is on the switch is on, when off the switch is off.  The status of this single virtual switch can be passed to Alexa via a variable configured as a motion sensor which can toggle the 2 Alexa routines to control the lamp.  One downside to this approach is that Alexa throttles the change to once every 30 seconds.  No monthly fees.

  • Like 1
  • Thanks 1
Posted

@tmorse Thanks for this. It didn't occur to me to use one virtual button in the scene and a separate one outside the scene to turn it off.

Regarding the Virtual NS, I saw that but couldn't make much sense of it. I can see now that it could be very useful. I'm actually a big fan of toggle solutions, so this is good information for me. I'm also playing around with Flic buttons and Yolink remotes as triggers for toggle programs.

Posted (edited)

@tmorse305I got this working today with the virtual toggle switch. It looks like I didn't really need to create a virtual toggle because I could have changed the variable state based on one of the other actual devices in the scene. The virtual toggle would be needed if I was trying to create a scene with only devices unknown to UD.

For anyone trying to follow along, here are the steps.

1. Create a state variable, that is set/unset by programs when a member of the scene (virtual or actual) is turned on/off.

2.  In the Alexa section of ISY Portal, create an Alexa device based on the variable using the category "motion detector".

3. In the Alexa app, create two routines for turning the targeted device on/off, based on the state of the virtual motion detector.

While this can be done with one variable/virtual motion detector, there is a delay turning off, because the smallest interval for "no motion detected" is one minute. It would be better to use two variables and virtual motion detectors catching on/off states so that the trigger for both states uses "motion detected".

Edited by bwade913
  • Solution
Posted

Looking at this again, I think the best way to implement this is to use a single variable expressed as a contact sensor. You can do On/Off routines triggered by Closed/Open states, without the issue of the motion detector waiting for "no motion detected" to timeout. It's working well for me set up this way, there is about a 1-2 second lag on both on/off for the light controlled by the variable.

Posted
7 hours ago, bwade913 said:

It looks like I didn't really need to create a virtual toggle because I could have changed the variable state based on one of the other actual devices in the scene. The virtual toggle would be needed if I was trying to create a scene with only devices unknown to UD.

The virtual switch added to a scene is the only way to trigger a program based on a scene activating.  Individual items in the scene can be triggered independently of the scene being activated.

 

7 hours ago, bwade913 said:

While this can be done with one variable/virtual motion detector, there is a delay turning off, because the smallest interval for "no motion detected" is one minute.

Actually you can set the delay to 0, so either a contact or motion will work the same way.  I use both depending on what makes more sense for the action that's happening.

Guest
This topic is now closed to further replies.

×
×
  • Create New...