Talking Alarm Clock

The Unofficial SmartThings Blog
Jump to: navigation, search

Talking Alarm Clock is a Smartapp for the SmartThings home automation system. Talking Alarm Clock allows for multiple alarm schedules to be set up to 'talk' through Sonos connected speakers, or play various sounds or music/internet radio stations.

Summary

Talkingclock@2x.png

Category: My Apps

Author:Michael Struck --MichaelStruck (talk) 11:23, 20 January 2016 (EST)

ST Community handle: https://community.smartthings.com/users/michaels/activity

Latest Version

   Please note that the Talking Alarm Clock was published by SmartThings in 2015 as version 1.4.5 
   The link to the released version is here: [[1]]
   The instructions here are for the upgraded version, which is unpublished at this time.

The latest version of the application is as follows (as of 4/21/16):

   Talking Alarm Clock (Parent): 
   Version: 2.2.5
   https://github.com/MichaelStruck/SmartThingsPublic/blob/master/smartapps/michaelstruck/talking-alarm-clock.src/talking-alarm-clock.groovy
   Talking Alarm Clock - Schedule(Child): 
   Version: 1.5.5
   https://github.com/MichaelStruck/SmartThingsPublic/blob/master/smartapps/michaelstruck/talking-alarm-clock-schedule.src/talking-alarm-clock-schedule.groovy

Open Source License/Trademarks

Licensed under the Apache License, Version 2.0 (the "License"); you may not use the Talking Alarm Clock code except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Requirements

The following are the basic requirements to use Talking Alarm Clock:

  • A mobile device running the SmartThings mobile application.
  • Sonos Speakers connected to your SmartThings account. At this time, Talking Alarm Clock only works with Sonos speakers; the SmartApp may not function with other speaker types.
  • Optional: Devices (Switches, lighting, thermostats, etc) that are operational within the SmartThings environment. The alarm can trigger these items to activate.
  • Optional: Presence sensors to determine voice greeting and when the alarm goes off.

Definitions

  • SmartApp: Add-in to the SmartThings mobile application that allows for functionality outside of what is provided by default. These SmartApps are not stand alone programs, but only operate within the SmartThings mobile application. SmartApps are open source and written in a form of the Java programming language called “groovy”.
  • Parent/Child SmartApp: A code structure within the SmartThings development environment where a single instance of a parent SmartApp can have multiple child SmartApps associated with it, allowing the single SmartApp to have multiple functions. Talking Alarm Clock uses this structure; there can only be one instance of the Talking Alarm Clock Parent SmartApp and each scenario created within the parent SmartApp is actually an instance of the child SmartApp. This structure cuts down on repeated code within a single SmartApp.
  • IDE: Abbreviation for “Integrated Development Environment”. In the context of the SmartThings environment, this is the web site located at http://ide.smartthings.com that allows for advanced functionality within the SmartThings environment. This allows you to set up custom devices and applications that appear within your SmartThings mobile application.
  • GitHub: A web-based repository that allows for distribution revision control and source code management functionality.
  • URL: Uniform Resource Locator, or basically the address of a web site or online resource, such as http://www.smartthings.com

Set up of your Sonos Speakers

The setup of your Sonos Speakers is outside the scope of this document. Please refer to the SmartThings documentation [[2]].

   Notice
   The Sonos integration within SmartThings is currently in listed as a "Labs" 
   release. This means certain functionality is subject to change or may not work as
   expected. For example, you must play a song or station via the normal Sonos application,
   then refresh the Sonos SmartApp within SmartThings to see the song listed in the
   recently played area within Talking Alarm Clock. In addition, sometimes the song/station
   will may not play without re-setting up the saved station. Please consider the Sonos Saved Stations
   function a "Labs" or beta release until SmartThings releases a stable release of Sonos control.

Installation of Talking Alarm Clock SmartApp

There are two components required for Talking Alarm Clock, the Parent and Child(schedule) SmartApps.

If you are an advanced user that integrates your SmartThings IDE with GitHub, you may want to proceed to Talking Alarm Clock#Advanced Installation

Talking Alarm Clock-Parent Code Installation

The code for the main parent app is found on the GitHub site:

  https://github.com/MichaelStruck/SmartThingsPublic/blob/master/smartapps/michaelstruck/talking-alarm-clock.src/talking-alarm-clock.groovy
  • While on the GitHub site, find the Raw button and click it. This will bring up a non-formatted page with just the code present. Select all of the code (typically CTRL+A) and copy It (typically CTRL+C).

GitHub raw.png

Loginscreen.jpg

  • Once you are logged in, find the My SmartApps link on the top of the page. Clicking My SmartApps will allow you to produce a new SmartApp.

MySmartApps.png

  • Find the button on this page labeled +New SmartApp and click it.

+NewSmartApp.png

  • Since you already have the code in your computer’s clipboard, find the tab along the top section called From Code. In the area provided, paste (typically CTRL+V) the code you copied from GitHub. Click Create in the bottom left corner of the page.

NewSmartAppCreate.png

  • This will bring up another page, with the code now formatted within the IDE. If the code was copied correctly, there are no other steps except to save and publish the code. In the upper right corner of the page, find and click Save. Now, click Publish (For Me), and you should receive a confirmation that the code has been published successfully.

SavePublish.png

Talking Alarm Clock-Schedule Child Code Installation

Next, you will need to load up the child (schedule) Smart App. This code is located here:

  https://github.com/MichaelStruck/SmartThingsPublic/blob/master/smartapps/michaelstruck/talking-alarm-clock-schedule.src/talking-alarm-clock-schedule.groovy

The steps for installation are almost exactly the same as Talking_Alarm_Clock#Talking_Alarm_Clock-Parent_Code_Installation with one important exception:

  • Copy the raw code from the GitHub link above
  • Go to the SmartThings IDE page and log in
  • Click the My SmartApps link
  • Click the +New SmartApp link
  • Click the From Code tab
  • Paste the GitHub code in the open area
  • Click Create from the bottom left corner
  • Save the code using the button in the upper right-hand corner of the page
  • DO NOT publish this code. The child apps must not be published, as they should only be accessed via the main (parent) app.

Advanced Installation

For advanced users who have their SmartThings IDE integrated with GitHub, the installation and maintaining of code becomes very simple. This manual will not go into detail about setting up your IDE with GitHub; those instructions can be found on the SmartThings web site [[3]].

Once you have integration, the for pieces of code you might need will be available to you to download and keep in sync with the latest versions.

  • First, find the Settings button at the top of your SmartThings IDE page (this will only appear after you integrate with GitHub)

IdeSettings.jpg

  • Clicking this button will open the GitHub Repository Integration page. To find the Talking Alarm Clock code, enter the information as you see it below:

Owner: MichaelStruck

Name: SmartThingsPublic

GitHubIntegration.jpg

  • Close the GitHub Repository Integration page
  • Next, click the Update from Repo button at the upper-right corner of the IDE
  • On the right-hand column, scroll down to click the apps you want to install. This will typically be:
   Parent app: smartapps/michaelstruck/talking-alarm-clock.src/talking-alarm-clock.groovy
   Schedule (Child app): smartapps/michaelstruck/talking-alarm-clock-schedule.src/talking-alarm-clock-schedule.groovy
  • Click the Execute Update in the bottom-right corner of the screen. When done syncing, the new apps should now appear in your IDE. If they ever change color, that indicates a new version is available.

Set up a new alarm schedule

When you first open the SmartApp, you will be able to create a new alarm schedule. This will also be the location where you will see the name of each alarm that you have created.

TACMainPage.png

Start by tapping <<Create New Alarm Schedule>>. This will open the main configuration page to allow you to set up your alarm.

Alarm Schedule Name

The empty alarm settings page will have a minimal amount of detail on it until you begin entering your information. Start with the <<Alarm Schedule Name>> which is typically your reference for the alarm. Something like "Weekdays" will work. Please note that the name will be used in the Alarm Summaries.

TACSettings1.png

It should also be noted that ALL schedules created will be enabled by default. When you have completed the configuration of the alarm schedule, you will want to return to the main Talking Alarm Clock screen, enter the <<Alarm Summary>> page and ensure your alarms are enabled/disabled to your satisfaction.

Next, in the <<Alarm Settings>> area, choose a connected speaker. Once you do this device, additional options will appear.

Alarm Settings

After choosing the speaker, choose the volume the speaker will be at when the alarm is activated. No entry will leave the speaker the same volume it was when last played, which may not be desirable.

Next, choose the triggers for the alarm. You can choose a specific time, the arrival of a person (and a delay after arrival), or if you have other automation that activates switches (physical or virtual), you may also trigger the alarm using the "on" of a set of switches. If any of these switches come on, the alarm will trigger. You may choose multiple triggers within the same scenario to trigger the alarm.

From here, your next option is the <<Select a primary alarm type...>>. The Talking Alarm Clock has many options to allow you to start off with a wake up sound, a voice greeting, or music/internet radio station at alarm. This is considered the primary alarm. Depending on the selection, you may have the ability to choose a secondary alarm. For example, if you choose a voice greeting, you can then choose to play a track after the voice greeting. Or, if you choose an alarm sound (like a rooster), you can then choose a secondary alarm of music to play or instead, a voice greeting. The options on the page will change based on the selection you choose.

TACSettings2.png

Finally in this section, you can choose the restrictions to evaluate when the alarm time comes up. If the restrictions are set but don't match your criteria, then the alarm will not sound. This can be useful to set up an alarm you don't have to manage nightly if you follow a specific schedule (i.e. just weekdays the alarm goes off).

Alarm Restrictions

When you open this page, you will have multiple options to restrict when the scheduled alarm is active. Please note that empty restrictions are considered "turned off" and will not be considered at alarm time. For example, if you do not list any days of the week as a restriction, it will trigger every day. This goes for the time, mode, presence sensors and on/off switches...no entries and these parameters will not be considered at alarm time.

TACRestrictions.png

If you choose to set up restrictions, choose the days, times, modes, or presence sensors you want to utilize in the decision process at alarm time. Additional restriction options include having the alarm active when certain switches are on or off. This could be a physical switch (like a bathroom light) that, when on, indicates you are already up and that the alarm does not need to go off. You can also have the opposite occur; let's say you have a virtual on/off (simulated) switch that other automation controls that when it is off, it indicates you are asleep, and when on you are awake.

Presence Sensors

If you choose to use presence sensors to determine whether the alarm goes off or not, once you choose the presence sensors to use, an addition option appears.

TACPresence.png

Using this option, you can determine if ALL of the presence sensors need to be present to activate the alarm, or just one of the sensors in the list. The toggle being to the left (off) means any of the presence sensors can be present, the right (on) will require ALL of the presence sensors to be present to trip the alarm.

In addition, the names of these sensor can be used with the %people% variable within the voice greeting (see Talking_Alarm_Clock#Voice_Greetings), so it is recommended you name the sensors the name of the people they represent.

Voice Greetings

In this section, you can set up a verbal message when the alarm is triggered. In addition to the static message you can use, there are variables that can be used to personalize the message.

TACSettings2a.png

   Variables used in voice greeting
   %people% This will give a list of people that are at home at the time of the alarm. The names are defined in the Talking Alarm Clock#Presence Sensors area.
   %time% This will give the time the alarm goes off in 12 hour, AM/PM format
   %day% This will speak the day of the week (Monday, Tuesday, etc)
   %date% This will speak the full date (ex. January 25th, 2016)

More variables are being developed to further customize this area.

If you have chosen a primary or secondary option of having music play, you will be presented with an option to choose a recently played track or internet radio station. If your primary alarm is a sound, you have the ability to choose a pre-defined sound, you choose a custom sound that you may know the URL of. You also have the option of defining how long that sound it played.

Weather Reporting Setting

If you choose to have verbal reporting to wake you up, you have the option on adding a weather report to your greeting. This will allow you to report the current temperature (local and from a local weather station), the local humidity (using a local device), give the weather forecast and speak the sunrise/sunset times.

TACWeatherReport.png

It should be noted that much of the information provided in the verbal reporting is obtained based on your SmartThings location, or the zip code you enter at the bottom of this screen. If you find the weather report is inaccurate or does not produce the results you are looking for, attempt to change the zip code to determine if that makes a difference.

Music track/internet radio options

Please make note of the fact that Sonos integration within SmartThings is considered "Labs". See the notice here: Talking Alarm Clock#Set up of your Sonos Speakers

TACSettings2a.png

Devices to control at alarm time

In addition to verbal or audio alarms, you also have the option to perform other functions at alarm time.

TACSettings3.png

Switches, dimmers and thermostats can be turned on (or the level set with dimmers, and temperatures set) when the alarm goes off. If you have verbal alarms set, you can also confirm that these switches or thermostats were set.

Other actions at alarm time

In addition to devices that can be controlled at alarm time, you can also set the mode or run a routine at alarm time. For example, maybe you have a routine called "Good morning". At alarm time, you can run this routine. In addition, if you have verbal messages turned on, you can have a message spoken at alarm time confirming which mode or routine is set.

TACSettings4.png

To remove the schedule, click the <<Remove>> button at the bottom of the screen. Please note that this ONLY removes the schedule you are currently viewing; to completely remove the entire Talking Alarm Clock application, go to the main page, <<About Talking Alarm Clock>> and find the <<Remove>> button at the bottom of the page.

Alarm Summary

On the Talking Alarm Clock main menu, you will find a section labeled <<View/Configure Alarm Summaries>>. On this page you can get a summary of each alarm schedule that has been created, and easily enable/disable them without going into each individual schedule. In addition, you can configure the SmartApp to give a verbal summary of the alarms (and their status) by pressing the SmartApp "play" button on the main screen or the change of a switch (physical or virtual) to "On"

TACSummary.png

To allow the activation of the verbal summary from the SmartThings SmartApp page, click the <<Enable voice summary from SmartApp page>>. This will reveal the settings to receive your summary, including the speaker to use, the volume, whether to include disabled alarms in the summary, and what modes to allow the summary to play. When you are done with these settings, click <<Done>> in the upper-right corner of the page.

When on the main SmartApps page, you should now see a small "play" button on the Talking Alarm Clock SmartApp icon. If you do not, you may not have chosen a valid speaker or have not turned on the <<Enable voice summary from SmartApp page>> switch.

TACPlay.png

You may also turn on the <<Enable voice summary when switches turned on>> and have the same voice summary options appear. On additional option will appear to choose the switches you will monitor to play the summary. It is recommended to use a virtual switch and some other automation (such as Alexa Helper) to activate a momentary button tile to play the summary on demand.

About Talking Alarm Clock

On this page you can view the version number of the parent and child (if installed) SmartApps, read the licensing agreement, a small set of instructions or remove the application/schedules.

TACAbout.png

Tips and Tricks

  • While there is no 'snooze' button, you can set up multiple alarm schedules to ensure you wake up. For example, one alarm may be set for 7:00am with just a rooster call, with the 7:10am alarm triggering a verbal weather report, and finally a 7:15am alarm with a song at a loud volume.
  • Used with your mode settings, you can have a daily alarm that normally goes off when the house mode is "Asleep", but does not go off when the mode is "Asleep, sleep in". Using something like Alexa Helper or other automation, you can set the mode the night before to ensure the alarm goes off (or doesn't) based on this mode.

Troubleshooting

The following are common troubleshooting steps when working with Talking Alarm Clock:

  • When the application does not operate correctly or as you would expect, please check http://status.smartthings.com/ to ensure the SmartThings environment is working properly. If the SmartApp suddenly stops working, most of the time it is because of an outage or degraded service with SmartThings' cloud environment.
  • While it is expected that you can upgrade to new versions seamlessly, there are situations where internal variables within the code changes or an old scenario conflicts with new code revisions. If you upgrade and find the application no longer performs as expected, it is recommended that you remove the application completely and start from scratch with new code.
  • If an alarm fails to notify, be sure to check the <<Enable>> toggle on the <<Alarm Summary>> page. You may also look to determine if you meet the day, mode, and presence restrictions for the alarm to go off.
  • If the voice announcements are working, but you don't get a weather report, you may want to enter your ZipCode within the <<Weather Reporting Settings>> page.

Roadmap

There are many things that can be added to this application. Be sure the visit the SmartThings community for this app [[4]] to request something be added to the road map. In addition, donations will help speed up development of new features. You can donate via this page: http://michaelstruck.github.io/SmartThings

  • Further develop of variables for the voice greeting (similar to %time or %date)
  • ...