The following is a way to have Tasker make TTS announcements for specific SmartThings (ST) notifications you might have, on your Android phone. For example you can have it say “Movement in back yard” when ST sends your phone a notification of that.
It looks for specific text in the notification, in which case it plays whatever TTS you tell it to in Tasker. So it can key in on completely specific ST notifications (however you have defined them to be output from ST).
If any newbies are reading this that don’t know how to send custom phone notifications out of ST, see the end of this post.
Also, this is not the “official” Text To Speech capability of SmartThings. Sadly, this only seems to be for dedicated (and expensive!) speakers bought solely for the purpose of ST TTS. (And no, you can’t directly use Alexa. But you can indirectly use it - thanks @MEarly!)
I sure wish ST just let its phone app talk!!
So this is one very specific little instance of something that can be done. I am writing it up because it was very important to me, but I flailed around for months to figure it out, although it’s super simple in hindsight.
Without further ado,
I assume you know the basics of how to get around the Android ST app, and also that you have installed Tasker (from Google Play Store).
In Tasker main window, first make the Profile (the trigger):
- Hit the big + in bottom center to start a new Profile,
- Suggest giving it a specific name, like “Movement in back”.
- Tap Event / UI / Notification
- Put into the Text field, the specific notification text output from ST that you want it to watch for, like “Movement on porch”. When Tasker sees that particular text in a notification, it will trigger the action (below).
A few notes:
- The Tasker Profile Text must EXACTLY match what’s in the ST notification or it won’t work
- You don’t need to tell it that the owner application is SmartThings (you can, but don’t have to). Not unless other apps send notifications with exactly the same notification text. No, this field is more suited when you want Tasker to perform an action for any/every notification from some app. But that’s not what we’re trying to do here.
- I’m not sure any other fields matter here; I haven’t bothered with anything else. Maybe Priority can matter. But it seems to work fine at Normal, shrug.
Now, a word on Tasker: It uses Profiles (trigger conditions) and Tasks (actions to do). Strictly speaking, these are separate and you can mix and match Profiles and Tasks all you want (once you have a lot). We just made the all-important Profile. Next comes the Task for it, which will also be easy.
Tasker is kind of odd in that there is no “Ok” or “Save” button for when you are done with a screen. Just hit the omnipresent Android Back key (little triangle in lower left) when done. When you exit, it will ask you to pair with an Action:
- Hit New Task
- I recommend giving the Task (it’s separate from the Profile) the same name as the TTS (the text the Task will say). Otherwise it can be confusing down the road if you have a lot of TTS Task Actions but their Name doesn’t always match their TTS.
- Click the big + at bottom of screen to add a new Action
- Select Alert / Say
- Put your text to speech (TTS) in the Text field. It does not have to match the ST notification text; it can be anything you want.
- The Stream field here might be important. Notice that these selections match the types of phone volumes available in Android Sound Volume settings. To cut to the chase, typically you would have your Stream set to Notification so it matches the general volume level of your SmartThings notification sound. Use Alarm if you want it to sound even when Do Not Disturb is on (but your usual ST chime won’t sound! for typical DND settings).
- Engine:Voice is a way to change the TTS accent to an Aussie woman if you want, laugh. Not sure what else good it’s for.
- Playing with pitch and speed can make for a sense of urgency or hilarity.
I’ve heard someone say Network matters, but I’m not sure how. I don’t think anything else here really matters, although you can play with the other fields and variables all you want.
When you are finished making the Task and Back out, you will be left at a little screen with what looks like a Play arrow in lower left. Hit this to play your Task and hear/test your TTS already (without needing to trigger Profile). Good for testing.
All you did was make:
- A Profile that looks for specific text in the body of a notification, and link it to
- A Task that says particular TTS.
A few important notes:
You must always hit the checkmark in the upper right of Tasker to “save” changes and have them become operational. Otherwise you are working on a draft that will NOT cause anything to happen. Remember this when Tasker ignores everything you do.
You may not want your phone saying things like “movement in back yard”. It can be weird in a meeting or at a party, laugh. So I have more cryptic things like “Back” or “F” or “dor” that really only mean anything to me. If people casually hear something very short, they are not even sure what it was. But you will know.
You have to give Tasker permission to see notifications. I can’t remember exactly when or where; maybe it will ask first time you try.
Tasker is odd for letting you change names of Profiles and Tasks. Hold your finger on the Profile or Task and it will turn blue. Now you will see along the top of the screen an A to change name, and other options like deleting it.
Tasker has a few general settings (“Preferences”).
Under Monitor / General / Run In Foreground is not ordinarily needed. It will also make an annoying permanent Notification.
Android Settings / Battery / (More) / Battery Optimization / change “Not Optimized” to “All apps” - You should not have Tasker OR SmartThings OR other apps like LiftMaster or whatever that you want reporting near real time, to necessarily be battery optimized. Sometimes “optimized” equals “completely turned off”. I have not completely figured it out, and you might drain your battery doing this, but anyway, be aware of this if you see seriously laggy reporting sometimes. I have seen instances where I saw nothing a few hours, then a rush of a lot of delayed reporting! And other weirdness.
If your device is inconvenient to trigger, you can test for text in anything else that generates a notification, while testing. Like sending yourself an email (from an anonymous Chrome window if necessary).
New 1/31/17, Insert a Wait: You may find that your ST notification sound and your TTS arrive at the same time, which can make it hard to understand the TTS. If you space them out, you also get a little mental primer that your TTS is coming.
To insert a Wait command into your Task,
- View the Task with your TTS action
- Hit the big +
- Select Task / Wait. Tip: If you can’t remember which category an action is hiding under (like me), use the Filter at the bottom of the category chooser to search for, e.g., Wait.
- Select a time and Back out.
- If you made this action after you made your TTS action, your new Wait will now be the second action. The Tasker interface doesn’t tell you how to re-arrange them. To move it first, hold your finger on its zap symbol (to the right) and slide it up.
I have a very short ST notification sound (one xylophone tap) and only have a 400 ms wait. YMMV. The TTS actually starts slightly later than the ST sound already, which makes sense.
New 11/29/17, How to handle Do Not Disturb (DND) with Android Tasker
If you don’t want every single notification going off in the middle of the night (or any time you’ve turned on DND), here’s how to handle it:
- Use the conditional IF found in every Tasker Action.
- For DND, see Global Built-In Variable %INTERRUPT whose values can be none, priority, all or alarms
- For testing its value, use Alert / Popup and text like “INTERRUPT = %INTERRUPT”
- This shows it works backward from what I would’ve thought; instead of DND = “none” when DND is Off, %Interrupt actually equals “all” most of the time (i.e., allow all) and what I would normally have thought of as DND is “priority” (i.e., only allow Priority messages). It is case sensitive - it can’t be All or ALL. Look at the examples provided in the Help.
- Summary: To have an Action not be performed if there is any form of DND whatsoever, then your IF line should read:
If %INTERRUPT EQ all
where the EQ condition operator means “Equals”.
Okay, that’s all for the Tasker app. Only newbies need read past here -
If anyone doesn’t know how to get SmartThings to send you a specific text notfication for an event, here’s how to do it. There may be other ways, but this is what I do:
- Go to home screen (Dashboard) of Android ST app
- Hit settings gear in upper right
- Select Custom monitor. (This is what works for me.)
- Select New Monitoring Rule (at the bottom if you have a lot already)
- Select Kind Of Device. If you are unsure the capabilities of your devices, go to the web API at graph.api.smartthings.com (make account if you don’t have one - there’s tons here), go to My Devices, and click on device in question. You will see the Current State of each capability it has.
- Next, select which one(s) of those types of devices. IF YOU SELECT MORE THAN ONE HERE, you cannot make device-specifiic notifications. Sadly YOU HAVE TO MAKE A SEPARATE NOTICE FOR EVERY SINGLE device, to get a device-specific text. Hopefully one of these years they’ll let you drop in variables for device and sensor names so you can change the rules for all 20 motion detectors at once. sigh. okay end of rant.
- Change if you want only once per day, number of minutes, etc. on this screen. Hit Next.
- Here’s the crux of the matter. Under “Text & Push Notifications”,
- Click “Send push notifications” and
- Tap to set a Custom Message. This is the message notification text ST is sending your phone, which must exactly match the text that Tasker is looking for in the Profile to trigger the TTS Task action (above).
- Hit Done then Next. Change name if you want (doesn’t matter for Tasker). Hit Done.
- When you see the green popup that you successfully added the rule, you’re done. Go test it to make sure it works correctly as a notification, before making your Tasker Profile for it.
Hope this helps. Questions or discussion welcome.
Edit 1/28/17: Added “Insert A Wait” info
Edit 1/31/17: Added Stream Volume info
Edit 2/19/17: Added Use Alarm sound to cut through DND
Edit 11/29/17: Added notes on how to work with Do Not Disturb at a more general level