[RELEASE] Simulated Alarm Clock DTH and Pistons

Improved version in post 6

I’ve been looking for an Alarm Clock DTH for quite some time now, but I was struggling to set the time in the mobile app until @Gopack2 posted some code on the webCoRE forum which nudged me in the right direction. Trick was to set the alarm time via the device preferences page, not sliders and arrows within the device tiles, and then display in a value tile.

This DTH works well with webCoRE.

To set the alarm time with webCoRE:

To carry out actions at the stated alarm time:


Nice one, Robin! I saw just yesterday someone ask for this and you said you were looking for one too and here we are!

Any examples what you would use this for though? I guess to extend your alarm clock to your whole home, anything else?

To be honest I have little use for it lol… I had to move home and rent out my smart home to tennants… but I did want this before I moved and I’m going to set it up for my tennants.

I wanted to be able to quickly set my alarm clock from my iPhone (via the iOS widgets for regular presets or a ST tile for unusual times). I then wanted to have things happen before the alarm goes off like heating, hot water etc… and slowly ramp up lights (same as gentle wake up but via webCoRE). At alarm time, a siren can be used, or turn on TV/Radio using Harmony.

If I had an Android phone I could link my android alarm to IFTTT to ST, but not with iOS.

The Gentle wake up app is ok, but you can’t set the alarm times or activate / deactivate the alarm with webCoRE… you have to gointo the smartapp. It also gives very limited actions, unless using a simulated switch as a middle man.

If anyone ever brings out a decent, mass market ‘smart’ alarm clock that integrates with ST, then that’ll be the way to go… but for now we have this.

Working on adding days of week now.

Added Monday - Sunday buttons (Git updated above) and integrated into the piston:

Very nice! I’m using Tasker and sharptools to run my morning routine but I’m the only person in the house with an Android. I’ll probably install this to allow everyone else to interact with the house when they want their alarm to go off.


I’ve been working on enhancements for this… it now has:

  • Snooze and wake buttons
  • Time adjustment buttons
  • Snooze duration settings (In preferences page or set via webCoRE)
  • Status indicator
  • Better layout and icons

To make this work you will need these two pistons running (Switch 2 is the alarm device):

Just add your additional commands (lights fade up, boil the kettle, sound siren, tun on radio / TV etc.) next to the various SMS messages, which should be self explanatory.

I’ve left the original code on GitHub as well, as some may prefer the more basic version… here’s the link to the advanced version.


@RobinWinbourne. Can you change the snoozduration from webcore directly with the custom command?

Yes… or it can be done from the preferences page in the ST app.


Here’s an updated piston which adds the ability to start lights fading or other events, a set time before the alarm sounds.

I also enhanced the Mon-Sun button check to streamline the piston a little:

And still needs this piston to make the up/down buttons work:

I am writing a custom device handler, and am almost done with it.

I have a input statement that saves a location Zip code. Looks like this:

input name: “location1Zip”, type: “string”, title: “Enter A Zip Code For Location 1”, description: “Enter a Zipcode For Location 1”, required: false, defaultValue: “10001”

What I need is a custom command to let you change that from webcore. I understand it won’t show in the device section, but will be there in the background. That’s ok.

Some thing like:

Command “ changeLoc1Location”

It’s the def part that I am not so sure of.

Any help on this would be appreciated

You can’t change a preference setting from webCoRE or any other smartapp… instead you have to use a middleman (a value tile)

  • Preference setting updates the value tile
  • webCoRE custom command updates the value tile (but preference page will still show old selection)
  • Device uses the value tile vale for whatever it does.

Here’s a template (untested but I’m sure it’s good lol):

metadata {
 	definition (name: "Zip Code Example", namespace: "SmartThings", author: "Robin Winbourne") {
 	capability "Actuator"
 	capability "Switch"
    attribute "ZipCode","string"
    command "changeZipCode"
 preferences {
     input name: "location1Zip", type: "string", title: "Enter A Zip Code For Location 1", description: "Enter a Zipcode For Location 1", required: false, defaultValue: "10001"
 	tiles {
 		valueTile("ZipCode", "device.ZipCode", width: 3, height: 1, canChangeBackground: true) {
 			state "default", label:'${currentValue}'
def updated() {
     sendEvent("name":"ZipCode", "value":location1Zip)       
 def changeZipCode (param1) {
    sendEvent("name":"ZipCode", "value":param1)
1 Like

I noticed that if you turn a day back on, the switch turns on but the status still says “deactivated”.

Yeah, status indicator is only updated by main on/off, snooze and wake.

Easy fix on the piston though.

sorry if this is a dumb question, I’m a bit new to this, but how do you add the device after you import the DTH?

You need to go to the ide. Create a new device, then in device type, select the new handler you installed, once created it will show up n the smartthings app a a thing

got it… thank you GoPack2

Can this be displayed as a tile in ActionTiles?

I’m looking for a Count Down Timer that can be triggered by a Piston and be displayed in ActionTiles.

If door opens
Then start 5 hr countdown

This would be displayed in ActionTiles or anything that can be displayed on a phone or tablet by itself.

You’d do better using my Value Tiles DTH, which sort of displays in ActionTiles.

The central part of the tile displays as a big ‘?’ but it does allow you to show any text / number in the footer of a tile.

How are you setting up a timer in ST? I could understand a short alarm for a few minutes later but I wouldnt expect something like a kitchen timer to work through ST. It’s a cloud integration. The timing is never going to be that accurate.