SmartThings Community

[RELEASE] Alexa Helper

echo
smartapp_voice
(eddie) #43

Michael, thanks so much for the code. even being a newbie it was simple following you directions.:beers:

(Micheal ) #44

Excellent to hear…I realized this ‘virtual dimmer’ could be used for a bit better control on Sonos as well. Right now you can turn on or off the sonos from Alexa…but not change the volume…Could actually add that. Anyone see value in that?

2 Likes
#45

Hell yes! I do… :smiley: Any control above play/pause is very welcome.

1 Like
(Micheal ) #46

For those that are following this thread, Alexa Helper now has connected speaker control (i.e. Sonos). Similar to the temperature control, you will control the speaker volume using a virtual dimmer. In addition, you can define virtual momentary tiles to control next and previous tracks.

The GitHub has been updated and the links above will take you to the proper place, so here are the consolidate instructions:

  • In your IDE, create a new device type by copying/pasting this dimmer code and publishing it. Then, in the ‘My Devices’ section of the IDE, create a virtual switch. Maybe call it “Speaker”

  • Find the Alexa Helper-Parent Code. Copy/Paste it into the IDE and SAVE and PUBLISH

  • Find the Alexa Helper-Scenario Code. Copy/Paste it into the IDE. SAVE but DO NOT publish

Now, create a couple momentary switch tile devices in the IDE for next and previous track buttons. While you may have the impulse to simply call them Next Track or Previous Track, those are Alexa key words. I used “SpeakerNextTrack” and “SpeakerPreviousTrack”.

Find the speaker area of the main app and associate the appropriate devices. If you have previously ‘Discovered’ your speaker through Alexa you can ‘forget it’ in the Alexa app…this should give you the same functionality.

I did put a safety mechanism in here that if you start the speaker through the Alexa you have the option to set the initial volume. This will prevent a previous 50% level from blowing your ears out when you first turn the speaker back on.

To turn on or off the speaker simply say: ‘Alexa, turn “on”, “off” the speaker’ (where speaker is the name of your virtual dimmer.)

To change the volume, say ‘Alexa, set speaker to ####’. If you have limits set up, the speaker will only work between those limits.

To change tracks, say “Alexa, turn on SpeakerNextTrack” or “SpeakerPreviousTrack”.

Here are some possible limitations:

If you turn on the speaker with “Alexa, set speaker to ####” and your initial volume is set in the app, it will go to the initial volume first. You will need to issue the volume command again.

Sometimes Alexa requires a percentage to set a dimmer…so the command might be “Alexa, set speaker to #### percent”

Just remember, these are little ‘hacks’ to get Alexa to control more complex devices. There is only so much that could be done with controlling an external speaker, but this is more than just Play/Stop.

Please play with the code and see if there is anything I missed or you have an issues with it.

5 Likes
#47

This works really well. Thank you so much!

I will be installing an Ecobee 3 tonight, so I can try that with these apps/Device as well.

#48

Question about virtual dimmers.

I created 1 in IDE and named it virtual dimmer.

Can this 1 virtual dimmer be used for both my Sonos and my thermostat(ecobee 3) in ST and Alexa?

(Micheal ) #49

Technically, yes, you could, but realistically you wouldn’t want to. The way this works is it looks for a change in the dimmer and then send the corresponding commands to either the thermostat or speaker. If you use the same device as the control, when you set your speaker to 20 you would set your thermostat to 20 as well. Conversely, if you set the temperature to 76, you will blow out your ears with the speaker being 76% volume…

I recommend separate devices for each speaker and thermostat.

#50

Lol… I wouldn’t want to blow my ears off! Thanks for answering so quickly!

So I could name the dimmers:

Virtual Sonos dimmer
and
Virtual Thermostat dimmer

(Micheal ) #51

Correct…Or anything else Alexa will recognize…

#52

Well in IDE I named them

Virtual Sonos dimmer
and
Virtual Thermostat dimmer

But in Alexa I created my groups named

Speaker
and
Thermostat

(Micheal ) #53

Same way I have mine and it works great!

1 Like
#54

So if I turn on the “auto mode” switch that means that in winter it will only turn heater on and in summer only turn the a/c on? I’m not quite getting how that works.

Is there a way to use Alexa to switch the mode and say something like “Alexa, turn heater on to 68 degrees”?

Also, is there a way to ask Alexa what the current temp is?

(Micheal ) #55

When setting the temperature via SmartThings, most thermostats can accept 2 settins, the Heating setpoint and the Cooling setpoint. At first, I had the app check which mode you were in and set the proper setpoint. However, there is an ‘auto’ mode that allows both settings to be active…So if you have an empty house for a year, it would cool in the summer (anything above a certain set point) and heat in the winter. Unfortunately, the way the logic worked in the app is that if you were in auto mode it wouldn’t send anything to the thermostat as it wasn’t technically set to heating or cool. So, I did some modifications and now what happens is that it sets both the upper and lower thresholds to the same number when in auto mode. This probably has some issues if you are in the winter, but the temp in the house (somehow) gets above the setpoint. In theory, it could set off the A/C unit. I recommend you NOT set auto on your thermostat unless there is an over arching need for it, and then I say be careful.

To answer your other question, yes…in theory you could have a virtual switch that is called ‘heating’ or ‘cooling’. You would then say “Alexa, turn on heating”. Similarly to the setting for the speakers you could then set a default temperature to set the thermostat to when you issue this command. If you wanted another temperature, you would have to issue the other command “Alexa set temperature to 68” (degrees probably wouldn’t work…alexa thinks this is just a dimmer switch). My app doesn’t have the ability currently to set the different thermostat modes, but that isn’t a bad idea…would you use it if it were in there?

Finally, if you are asking if Alexa can tell you the temperature of the house, the answer is no…outside of building your own Amazon app, there is no feedback TO the Alexa…i.e. SmartThings can’t make Alexa say anything. This is a limitation of the way the device works.

Does that help?

(Darc Ranger) #56

I have apps that I posted that can control various functions of the thermostat. One controls the mode and fan and the other deals with setpoints. As for modes and since I have four seasons where I live, I use cooling for summer and heating for winter. Auto is usually during spring and fall when the temperature swings during the day may require switching between heating and cooling.

As for the same temperature setting for both setpoints, I would avoid as well, you could always code so they both cannot be the same. Although I would thing the once the thermostat temperature reach the setpoint it would turn off whichever unit was running.

(Micheal ) #57

I will probably add these revisions (set heating, cooling, auto) in the next version of Alexa Helper.

#58

I would definitely use it in my household. The main reason is I have a wife who would think “I need heat” in her head and have the tendency to say something like “set heater to xx” or “turn heater on”. The reason it would be nice to know what it is set at currently is the fact that if she just wants the heater on, it would be nice to know what the current temp is so she could then change the thermostat a couple of clicks up to make it turn on. However, I understand the limitations…

Thanks for all of this great work!

(Micheal ) #59

Ok…here is the next revision to test, 3.3.0 of the parent app (no need to load any others if you already have them working).

I separated the sections out for better GUI usage. In the temperature area you can now choose virtual switches (momentary tiles are recommended) to activate heating, cooling and auto modes. In addition, you have the ability to have a set point sent to the thermostat when turning from one mode to another. For example, if you have a momentary tile called “Heating Mode”, and a heating set point to 67, all you would say is “Alexa, turn on Heating Mode”. If your thermostat is in HOME mode, the thermostat would set to HEATING and then set the thermostat to 67 degrees…If you have set up the virtual dimmer and feel 67 is now too cool, you could then say “Alexa, set thermostat to 70” assuming your virtual dimmer is set to ‘thermostat’

I just realized as writing this that there is no command to turn off the modes. I will work on that, but these are the use cases that are covered now.

Thanks for the suggestions to make this app better and better.

To load, simply copy/paste this code into your IDE and save and PUBLISH it:

2 Likes
#60

@MichaelS I just want to say thank you for such brilliant work! I am a UK ST and Echo user and this makes it pretty seamless to control my Routines via IFTTT.
I feel like I am living on the set of Star Trek now :smiley:

1 Like
(Micheal ) #61

That was the goal…More enhancements to come!

(Derrek Krasnicki ) #62

Sorry guys but I missed the train and am late, had the original Alexa Helper, awesome! Have filled 5 out of 6 slots so I installed the new helper, child unpublished and dimmer device, hey have nest and sonos why not right! Now what do I do when I run out of slots? Install another version of helper? Also when I click on version if still says 2.0.2 even though I deleted and put in new code, I’m not seeing the new options of thermostat etc