[RELEASE] Simulated Alarm Clock DTH and Pistons

dth_alerts

(Robin) #1

Edit:
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:


Easy wake me up with phone alarm and Hue lights?
Short term activations?
[Looking For] Alarm Clock Device type
(Derek Murphy) #2

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?


(Robin) #3

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.


(Robin) #4

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


[Looking For] Alarm Clock Device type
(Derek Murphy) #5

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.


(Robin) #6

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.


#7

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


(Robin) #8

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


(Robin) #9

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:


#10

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


(Robin) #11

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.

(Robin) #12

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}'
 		}
 		main(["ZipCode"])
 		details(["ZipCode"])
 	}
 }
def updated() {
     sendEvent("name":"ZipCode", "value":location1Zip)       
 }
 def changeZipCode (param1) {
    sendEvent("name":"ZipCode", "value":param1)
}

#13

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


(Robin) #14

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

Easy fix on the piston though.


(Bryan Thompson) #15

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?


#16

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


(Bryan Thompson) #17

got it… thank you GoPack2


(Ron Talley) #18

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.


(Robin) #19

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.


#20

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.