[RELEASE] Alexa Helper

Would it be prudent, perhaps, to put a set of high/low threshold values for a device being used as a thermostat? As in, accept whatever values might be sent, but truncate them so they’re within the pre-configured acceptable range. That way even if you said “set thermostat to 10” it would only drop as far as, say, 65F.

Anyone able to get this to work? ST app crashing every time I click on “Create New Alexa Scenario”.

That is technically what the app does if you set the min/max. If you accidently say 10 to Alexa and the lower limit is set to 55, it will only set to 55. Same with the high limit…if you say 100 and the maximum is 85, then it will only set itself to 85. Is that what you mean?

1 Like

You will need to ensure the following:

The ‘parent’ app is saved AND published
The ‘child’ app is saved BUT NOT published
The virtual dimmer saved and published as a Device Type.

What you are describing sounds like you don’t have the child app installed (https://github.com/MichaelStruck/SmartThings/blob/master/Other-SmartApps/AlexaHelper/Alexa%20Helper-Scenario.groovy)

Yes, I have yet to read through the code. I just happened to notice the warning and figured thresholds would be one way to avoid it.

There’s a lot to thermostat control that can cause problems, not just unusual temperature ranges. Some of the biggest problems come from accidentally cycling the systems on/off too quickly. AC compressors do not take well to being started/stopped in ways that would not come from normal temperature swings. So you’re right to warn people.

Thresholds are also useful for lighting dimmers, especially with LED and CFL elements. While the user might think they’re requesting 1%, the elements themselves might only be capable of much higher numbers. So having thresholds there help too. As in, sure, let the user request 1% dimming, but truncate that to the minimum level instead. User is happy, getting what they think they want, but not running into problems like LED drivers failing or the lights flashing.

Indeed…the reason for this is when I was testing the virtual dimmer I noticed Alexa misunderstood me a couple times…nothing major, but enough to get me to worry that someone would blame me for Alexa having NO feedback except ‘ok’ that she heard the correct number. Again, I recommend folks set a tight range, or even forgo using this functionality and put a hard coded temperature into a ST routine and then just use one of the switch actions to trigger the temperature that way.

You’re correct. I pasted the wrong version :(… I wish there is some way to not publish the app even if you accidentally pushed the button. That way you guys can set that within the app and the IDE won’t publish it. No need to worry about which app to publish or not as an end user.

Thanks for this BTW…

Hehe…had that same issue…had to blow away the app and then repaste my own code when I accidently published it :frowning:
Oh well…hope it is working for you!

Can someone recommend this to the people who make these kind of tweaks? I’m sure you two aren’t the only ones to have done this by accident.

That is an inherent piece of the IDE. The parent/child apps are rather new and the IDE hasn’t quite caught up with this paradigm of ‘not’ publishing the child apps.

I did put this app in for consideration to be included in the main ST app. That would eliminate the need to copy/paste any code. Keep your fingers crossed.

1 Like

Updated the child app. For clarification, here are the latest versions:

Parent app: 3.3.1
Child app: 1.1.1
Virtual Dimmer: 1.0.0


Hey Michael, thanks for all your work. This is great! I tried to use it though and everything worked well, except the thermostat. I keep mine in “auto” mode, so Alexa’s dim number was not being updated. I sent you a minor change that takes care of that. See if you like it. It works well for me and you don’t have to check for the mode.

When you say you made a minor change, did you submit it through GitHub? Let me know…what thermostat do you have? If I am following I know that I did set the temperature based on the heat or cool setting without any regard to auto…

Good call on this…

Thx…Yes. Let me know if you don’t see the proposed changes on GitHub. As for tstat, I have the Honeywell z-wave.

I don’t see it…can you put the code lines here…Might as well share. And, of course, I will give you credit in the code :wink:

Here is the change…The advantage of not checking the mode, is that if you are on heat but is too hot, you can turn the ac and if it’s colder, you can turn on the heat…

//Thermostat Handler
def thermoHandler(evt){
// Get settings between limits
def tstatLevel = vDimmer.currentValue(“level”) as int
def currentTemp = tstat.currentValue(“temperature”) as int

if (tstatLevel > upLimit){
	tstatLevel = upLimit
		//log.debug "Setting tstat to ${tstatLevel}"    

if (tstatLevel < lowLimit){
	tstatLevel = lowLimit
    	//log.debug "Setting tstat to ${tstatLevel}"   

//Turn thermostat to proper level depending on mode

if (currentTemp < tstatLevel) {
       log.info "Setting Heating to ${tstatLevel}"
if (currentTemp > tstatLevel) {
        log.info "Setting Cooling to ${tstatLevel}"


Ok…so really nothing you are doing here with thermostat, but you appear to only be taking action if the temperature is above or below a certain temperature.

I think the issue with that is where you will have a non ‘auto’ setting. Let me play with this a bit more. I do like these changes but need to ensure that it will work in various scenarios.

You know what, you’re right, I adjusted it for “auto”. Maybe you can add changing the mode accordingly, to match the temperature change. I think that’s even better that staying with same mode.


if (currentTemp < tstatLevel) {
log.info “Setting Heating to ${tstatLevel}”

Looking at that now as it is definable as a variable to key off of like heat and cool…I instead would do it this way:

If thermostat is in heat mode or auto and temp is lower than setting, set the temperature setpoint
If thermostat is in cool mode or auto and temp is higher than setting, set the temperature setpoint

Will play around with this and publish new code based on my findings…I appreciate you bringing this to my attention.

Thinking through the logic of this I am actually questioning how auto really works. Consider the following use case: Let’s say you are going to bed and it is 72 in the house (during winter). You tell Alexa to set the temperature to 65 (to save power). If you are in auto and see this temperature, your A/C may go on…which may not be the desired state. What happens with your equipment if you set it to a lower temperature than the current one? Technically, you would want the ‘heat set point’ to be set to 65 and NOT the cooling set point. The solution to this might just be a change in documenting how the app works and not the code…

1 Like