Alexa Helper - Change mode or phrase with a switch toggle

I released the following update to replace any beta version. I also sumitted this version to SmartThings for publication:

https://github.com/MichaelStruck/SmartThings/blob/master/Other-SmartApps/AlexaHelper/Alexa%20Helper.groovy

2 Likes

wow excellent app, thank you for this!. do you think It would be possible to also toogle a switch for the slots with timers?. This would be great for example, if you have a Harmony hub and want a timer to turn off an activity. Right now, you have to go the the harmony app and select the timer for a specific time. But with this you can create a timer for 30 minutes for example and turn off the activity with that timer

I know that right now you could create a mode and turn off the Switch from there (using the alexa helper app to change the mode with the timer), but it would be better to keep the state of the mode

Thank you!

If I understand what you are asking, you want the scenarios to control other switches instead of just modes or routines? Technically it could be added if that is what you are looking for. Let me know and I may be able to make a special variation with that functionality.

I didn’t ask for it, but yes, that would be great.

@MichaelS, yes, exactly MichaelS. It would be great to also control switches (especially in the slots with time)

Let me see what I can do


Ok all,

Here is the beta version of what you are asking for. The more I think about this there are probably real reasons to control other switches with this even though Alexa can control them through groups
even with out delay timers involved
I did change the whole formatting of app and put groups in of things that can be controlled as I might add locks and such later. If you choose a momentary switch, the whole group of ‘off options’ goes away, which is better for the UI.

One note
there is a small delay from when you trip the original switch to the tripping of the ‘slave’ switches
this is normal as part of SmartThings processing and happens regardless of the delay within the app
it is usually less than 10 seconds from what I have seen


Let me know if you find any issues with this:

https://github.com/MichaelStruck/SmartThings/blob/master/Other-SmartApps/AlexaHelper/Alexa-Helper-Beta.groovy

Thank you so much MichaelS, I’m going to test it to see how it goes. One question, do you think is possible to cancel the "timer’ after its activated?. For example, I you activate the first slot, which turns on a switch or changes to a routine, and the delay is 30 minutes, but later you change your mind a want to cancel that.

Once you set a timer it is set unless you specifically code that it cancels
technically, I probably should have coded in the cancellation of the On sequence when the Off sequence is triggered; however, then you are setting the off timer at that point.

Let me give some thought to this and I will let you know if I come up with something.

edit just looked at the documentation and it doesn’t appear there is a way to ‘unschedule’ a specif timer once it starts without killing all of the scheduled jobs
so in this case there isn’t an easy way to cancel something once you set it.

Just made a revision to the beta
added different delays to the on/off selection
so, you could have a single scenario come on 2 minutes after you tell Alexa to trip the master switch, but then would turn off on a different timer. I also fixed an issue with the slave switch is required in the scenario
made that optional now as it should be


The current revision is 2.2.1

https://github.com/MichaelStruck/SmartThings/blob/master/Other-SmartApps/AlexaHelper/Alexa-Helper-Beta.groovy

Absolutely there is. Control of devices should always remain with the controller, in this case the ST Hub. The Echo is mearly an interface to access those devices. If you control too much within the Echo, you dilute the purpose of the controller and make things more complicated to troubleshoot - which controller do I need to go to again to make the change? Simplicity is always King!

I love this mod and I’m going to make adjustments to my Echo to bring control of the devices where it should belong.

Thanks for your work on this!

Thanks
that being the case I also see situations where items like locks and other deviced could be controlled, but the syntax might be a bit confusing “Alexa turn on the front door lock”, “Alexa, turn on the garage door”


Yep, hopefully they’ll “expand the syntax” for other kinds of devices. Right now we are shoehorning everything into Echo as a switch
which is definitely classified as a kluge. :smile:

Yeah
I am hoping for either a TTS ability or something that allows Alexa to be a bit more interactive instead of just reactive
heck, just a voice or music instead of that tone at alarm time would be great! Right now I kludge it with a Sonos speaker


so it seems like im having this problem where I read this stuff and think I know what I need to do but for whatever reason its just not sticking


I cant have my phone with me at work, so I cant test things out during the day. so by the time I get home, I get maybe an hour or 2 to myself to work on things.

so I have my echo, my hue hub, my harmony hub, and my smartthings v1 hub all working together. individually I pretty much don’t have any issues. but since I added the echo in last week, im having a few quirks. reading JDRoberts posts have been really informative and this one seems to go down the path to help my problem.

im having issues with the virtual momentary switches and the virtual binary switches. for example, I tell alexa to turn the tv on and my tv comes on, I tell it to turn off, and it turns off. but then a little while later, it wont do anything. I tell it to turn on, and nothing, I tell it to turn off and then turn on, and it will work. same with lights. I will tell alexa to turn light groups on and off and they are ok, but then later I will have the same issue as the tv, like it forgets what state its in.

my mind must be starting to slip because I used to be able to think this logic thru


Just refreshing this topic
anyone who has been testing this found any issues? If not I will submit for publication by the end of this week.

I am a very new smart things user (instantly hooked btw) and despite the cons of Hue integration with SmartThings and Echo that I’d found in my research, I opted to try exactly that combination of products. I started with Echo, a Hue starter w/ two LUX bulbs, 2 GE bulbs, a three way GE dimmer, four motion sensors, two open/close sensors, and a few GE smart plugs. It was and is my intention to have Alexa as my primary (trigger) moving forward and thanks to this app, I am well on my way. @MichaelS I just want to thank you for your efforts!
I have read this entire thread (a couple times) and though I may be chiming in a little late, however on the earlier subject of Hue {non-integration} into SmartThings, I seem to have a stable work around for my Hue Hub/Bridge, Lux Bulbs and the GE bulbs which I am using in the stead of more LUX bulbs. Granted, It is cumbersome and a bit tedious on the set up, but it has neglected to fail for three days now. Despite my using all manner of potential set ups of modes, Hello, Home , etc., I have yet to cause a hick-up that isn’t easily resolved. Following the lead of @smart I did the following: Removed the hub and Hue(connect) from ST, Labeled the four (2 GE) bulbs via the HUE with names like “TBL H” and “STV H” for Table Light and Stove Light, Discovered them alone (unlinked with ST) with Alexa and immediately put them into individual groups of one bulb each with the full labels ie “Bedroom Reading Light.” and in a group together as “All HUE.” Next was ST. I created virtual switches for each of my “HUE” bulbs in ST with equally foreign names like “TAB S T” for the Table Lamp. (I think it’s obvious why the abbreviations, but in case not, It’s to avoid confusing Alexa) Now, still with the HUE Bridge not connected to Smart Things, I added the new virtual ST switches, completely unattached and unassociated in any way, to their respective Echo group as well as to one containing all four of them too. Here’s where it get’s a little bubble gum on the flesh wound. LOL!! Using IFTTT I made each virtual switch react to being turned on via Alexa by echoing an on or off command to the HUE. The delay, while usually about 1-2 sec. of the IFTTT push notification is always after Alexa has turned on the lamp already and thereby is “ignored” by the HUE HUB, in some instances I would “loose” connectivity with the HUEs because obviously, they are still literally getting mixed signals. However, I have tried every combination I could think of trying to mix up the switches and leave something tripped open or “held captive” for lack of a better term by ST and three days ago, I went from the occasional glitch (Always in combined and long commands) to zero instances of Alexa responding with “I can’t find a device by that name” or some such by simply adding an extra externally imputed “off” command to the Hue followed by one from within the ST app to the virtual switches at the completion of a function. A sort of preventative maintenance to ensure all plugs point north. the separate groups of four that I’d created had at one time served as a means to work through issues but no more.The Pro: Alexa retains full dimming control of the Hue Bulbs and even if lost for some reason by Alexa, the redundancy will still turn on and off the LUXs via IFTTT. The COn: A waaaaay too delicate setup and as of now, unknowably unstable workaround. Still, a workaround nonetheless and I am blown away at how consistent it is now. Kinda sad to be so happy that the damn thing just works correctly though.
Pardon for the long winded post but I hope it is of some use to somebody. Again THANKS SO MUCH @MichaelS for this great app! I have just loaded the latest variation and I will keep you posted of any issues (unrelated to my workaround of course) :wink:
*ammended

I’m very glad it’s working for you!

It sounds like there may be a bit of confusion about how echo works, however.

Echo does not control any devices directly. It doesn’t matter how they appear to Echo, or which controller you used. All echo does is make a request of the controller on record.

Similarly, IFTTT does not control any devices directly. It just passes along the request to the controller that owns that channel.

The Phillips hue bridge is the one on issuing all the commands to any bulbs that are connected to it, regardless of their brand.

So if you request that echo dim A bulb that it has on record as belonging to the hue bridge, then echo passes that request to the hue bridge which sends the command to the bulb.

If you request that echo in a bulb that it has on record as belonging to the smart things hub, then echo passes that request to the smart things hub, which in turn would pass request to the hue bridge for any bulb connected to that bridge.

I understand that completely. I noted my bad word choice. I simply meant to be able to use Alexa to trigger it all :wink:

Got it. :sunglasses:

SmartThings polls The hue bridge about once every five minutes to get the status of all bulbs. That’s supposed to keep things in sync, but obviously there can be some delay.

If I understand correctly, because you have grouped the bulb which echo has on record as being controlled by the bridge and the virtual switch which echo has on record as being controlled by smartthings (and which IFTTT has on record as The if for a That event which send an on quest to turn on that same bulb through the Phillips hue channel), the hue bridge first gets a request from echo to turn on A bulb, and then gets a request from IFT TT (via smart things) to turn on the exact same bulb.

So that should mean that your virtual switch comes on very quickly, and you don’t have to wait for the five-minute polling lag between smartthings and the hue bridge that you would get if you bypassed smartthings all together.

And since communications to Hue Bridge (not the bulbs) are via Wi-Fi, serial nature of the commands are preserved.

A number of us used a similar virtual method with the Hue bulbs last spring when the SmartThings connection was so unreliable. It’s a good workaround, especially if you want to have some other device follow a hue bulb.

As you mentioned, the only issue is the amount of lag introduced by IFTTT. That varies from person to person, and even from day today, but may be acceptable. :sunglasses: