Alarm Clock (Schedule) on Control Page

Posted on
Mon Mar 04, 2013 1:06 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Alarm Clock (Schedule) on Control Page

Hopefully this is useful for others.

First I created a Schedule Action "Alarm Clock" to do all the junk I want my system to do first thing in the morning to get me out of bed.

Variables created in indigo:
WakeUpHH (2-digit hour of 24 hour clock) 2 buttons (Increase/decrease variable by 1)
WakeUpMM (2-digit minute of 24 hour clock) 12 buttons to set value (5 minute increments) & 2 buttons to (increase/decrease variable by 1)
WakeUpTime (displays current trigger time for "alarm clock" schedule)
WakeUpTUpdate (a toggle variable to use as a control page button to trigger script below)
WakeUpSnooze (a toggle variable to use as a control page button to trigger a snooze script)

Created a Trigger "WakeUpTimeUpdate"
Trigger: variable WakeUpTUpdate changes
Condition: Always
Action: Execute Script Embedded AppleScript:

Code: Select all
set value of variable "WakeUpTime" to (value of variable "WakeUpHH" & value of variable "WakeUpMM")
set WakeUpSeconds to ((value of variable "WakeUpHH") * 3600) + ((value of variable "WakeUpMM") * 60)
set today to current date
set time of today to 0
set newAlarmTime to today + WakeUpSeconds
set absolute trigger time of time date action "Alarm Clock" to newAlarmTime


The snooze trigger is much simpler...
Created a Trigger "WakeUpSnooze"
Trigger: variable WakeUpSnooze changes
Condition: Always
Action: Execute Script Embedded AppleScript:

Code: Select all
set newAlarmTime to (current date) + 300 --5 minutes
set absolute trigger time of time date action "Alarm Clock" to newAlarmTime

Bill
My Plugin: My People

Posted on
Tue Mar 05, 2013 9:09 am
axlbundy offline
Posts: 22
Joined: Jul 27, 2012

Re: Alarm Clock (Schedule) on Control Page

Thank you for posting this. I've been thinking about attempting to setup some kind of alarm that would wake me up earlier/later based on weather/traffic conditions but ran into a severe lack of knowledge on my part. I like what you've done here and I may just use this with the snooze option for now.

Can you post a picture of your control page? I'd love to see your formatting.


Thanks for posting.

Posted on
Tue Mar 05, 2013 11:12 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Alarm Clock (Schedule) on Control Page

So my alarm page (still under construction) right now doesn't even have a link back to the home page.
The power button in the upper right (I'll swap out later with an alarm clock icon button) toggles a variable that the alarm schedule looks for in conditions
The alarm time in green on the left is adjustable with "+" or "-" or via popup UI control.
The update button toggles an update variable that runs a script to change the time
The snooze button toggles the variable that runs the action script to stop the alarm and add five minutes to the current time before triggering again.

Part of the home page (Still under construction) The large alarm icon is a button that toggles a variable in the alarm schedule conditions.
The small icon in the upper right is on all the pages. White bell if alarm is on, transparent if alarm is off.
Clicking on the alarm set time takes you to the alarm setting page.

Anyway, I'm sure this will all look different by the end of the week, but it's what I have at the moment.
Attachments
alarm page.png
alarm page.png (149.42 KiB) Viewed 6829 times
HomePageSnipit.png
HomePageSnipit.png (190.79 KiB) Viewed 6829 times

Bill
My Plugin: My People

Posted on
Tue Mar 05, 2013 11:38 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Alarm Clock (Schedule) on Control Page

For the "Next Alarm Time" I added some more code to both of my trigger scripts.

Code: Select all
set timeStr to time string of newAlarmTime
set value of variable "WakeUpNext" to timeStr


So, whatever the time updates to, it is quickly reflected in the variable "WakeUpNext" in a format that looks better than just combining HH&MM.

Side note... the script variable newAlarmTime returns with the current date and the time for the alarm. (Because when you set it, it goes to midnight of the day you hit the button, then adds in (in seconds) the time you choose. On my "Alarm" schedule, this doesn't effect the date of the next alarm, only the next time it will occur.

Right now, hitting snooze (with the alarm off), will trigger the alarm to go off in 5 minutes. I haven't decided if I care enough to script around this with conditions or anything.

Originally, I was just going to hardwire an alarm clock speaker to an insteon IO device to trigger my alarm... but I couldn't figure out how to turn the indigo response to the alarm off or how to snooze it.... so I'm still playing with all the above.

Bill
My Plugin: My People

Posted on
Thu Apr 18, 2013 11:34 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Alarm Clock (Schedule) on Control Page

Finally got around to doing something similar for an iPod alarm clock page.
I was going to get really crazy with it and have the background sunrise image, shot from
our deck here, change according to whatever the alarm time was set to but decided to
just have it reflect an am or pm wake up.

You can select what audio you'd like to wake to with the buttons on the bottom.

Carl
Attachments
image.jpg
image.jpg (334.94 KiB) Viewed 6721 times

Posted on
Thu May 23, 2013 2:16 pm
stoffergoffer offline
Posts: 37
Joined: Apr 16, 2013

Re: Alarm Clock (Schedule) on Control Page

ckeyes888 wrote:
Finally got around to doing something similar for an iPod alarm clock page.
I was going to get really crazy with it and have the background sunrise image, shot from
our deck here, change according to whatever the alarm time was set to but decided to
just have it reflect an am or pm wake up.

You can select what audio you'd like to wake to with the buttons on the bottom.

Carl


Hey carl,
would you mind to elaborate how you made the audio buttons work? And also it looks like you got rid of the update alarm button, or did you just exchange it with set alarm?

Posted on
Thu May 23, 2013 4:19 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Alarm Clock (Schedule) on Control Page

The audio buttons just set a variable, that is checked as a condition when the alarm
time is reached, to execute an action that turns on a nightstand radio to whatever
music is desired.

Yes, pressing the alarm set button activates the alarm.
Not much time now, I'll try to be more specific later.

Carl

Posted on
Sat Jan 04, 2014 8:53 am
evansgo offline
Posts: 223
Joined: Nov 29, 2013

Re: Alarm Clock (Schedule) on Control Page

Sorry I'm new to this. I have 90% of it up and running, but I'm not sure how you set up the 12 buttons for time adjust ( and then the two for 1 min adjust), does it have to jump to a duplicate screen or is there a more elegant way of doing it?

whmoorejr wrote:
Hopefully this is useful for others.

First I created a Schedule Action "Alarm Clock" to do all the junk I want my system to do first thing in the morning to get me out of bed.

Variables created in indigo:
WakeUpHH (2-digit hour of 24 hour clock) 2 buttons (Increase/decrease variable by 1)
WakeUpMM (2-digit minute of 24 hour clock) 12 buttons to set value (5 minute increments) & 2 buttons to (increase/decrease variable by 1)
WakeUpTime (displays current trigger time for "alarm clock" schedule)
WakeUpTUpdate (a toggle variable to use as a control page button to trigger script below)
WakeUpSnooze (a toggle variable to use as a control page button to trigger a snooze script)

Created a Trigger "WakeUpTimeUpdate"
Trigger: variable WakeUpTUpdate changes
Condition: Always
Action: Execute Script Embedded AppleScript:

Code: Select all
set value of variable "WakeUpTime" to (value of variable "WakeUpHH" & value of variable "WakeUpMM")
set WakeUpSeconds to ((value of variable "WakeUpHH") * 3600) + ((value of variable "WakeUpMM") * 60)
set today to current date
set time of today to 0
set newAlarmTime to today + WakeUpSeconds
set absolute trigger time of time date action "Alarm Clock" to newAlarmTime


The snooze trigger is much simpler...
Created a Trigger "WakeUpSnooze"
Trigger: variable WakeUpSnooze changes
Condition: Always
Action: Execute Script Embedded AppleScript:

Code: Select all
set newAlarmTime to (current date) + 300 --5 minutes
set absolute trigger time of time date action "Alarm Clock" to newAlarmTime

Posted on
Mon Oct 05, 2015 1:50 pm
andarv offline
Posts: 126
Joined: Jun 28, 2015
Location: Stockholm, Sweden

Re: Alarm Clock (Schedule) on Control Page

Hi,

I'm restarting this thread because I need some assistance... Basically I'm want to create a timer out of a Wallplug.
Primarily my wife will use this for setting table lamps and such?
I will use it to start and stop the motor heater for the car before I can get something more advanced in to place. If someone have any ideas about controlling a motor heater depending on temp I'm interested..

I have 4 variables
varTimer1StartHH and varTimer1StartMM
varTimer1StopHH and varTimer1StopMM

Then I created a Schedule running every 5min (or so) with this code, maybe not the fines but it does the job?

Code: Select all
set theTime to (hours of (current date)) & (minutes of (current date)) as string
set varStart to (value of variable "varTimer1StartHH") & (value of variable "varTimer1StartMM")
set varStop to (value of variable "varTimer1StopHH") & (value of variable "varTimer1StopMM")

if ((theTime ≥ varStart) and (theTime < varStop)) then
   turn on "Timer - Wall Plug Relay (FGWP101)"
   
else
   turn off "Timer - Wall Plug Relay (FGWP101)"
   
end if


Now to the problem, how can I set the variables in the CP?
Increments and decrements by 1 is cumbersome setting minutes, 5, 10 or 15 would be much better. And how do you do to keep the counter in time format, 24h and 60 min?
Attachments
Skärmavbild 2015-10-05 kl. 21.18.05.png
Skärmavbild 2015-10-05 kl. 21.18.05.png (331.9 KiB) Viewed 5232 times

Posted on
Tue Oct 06, 2015 10:37 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alarm Clock (Schedule) on Control Page

Can you describe the use case in more detail? I think we're missing some key information about exactly what you're trying to do.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Oct 06, 2015 2:29 pm
andarv offline
Posts: 126
Joined: Jun 28, 2015
Location: Stockholm, Sweden

Re: Alarm Clock (Schedule) on Control Page

Seamed clearer in my head...
What I want to do is to set a time for when a Wall plug turns on and when to turn off. Reason for doing this on a CP is mainly for ease.

From the control page I'm trying to set the four variables. For example varTimer1StartHH. But in that variable I only want to store value of 0-23. And in varTimer1StartMM 0-59.

I looked at the CP above and you got the impression that it was possible to fix the possible values to inc or dec, for example 5,10 or 15.
Right now the white arrows up/down inc/dec the variables with 1.

On the iPad it's easier because the pop-up works, but still it's possible to do wrong and set a digit to much or to little.

And also to "reset" the counter when inc from 23 to 0 or 59 to 0.
To keep it in time format, the reason for this is in the applescript I'm using above.

It might be that there is an easier way?




Skickat från min HTC One_M8 via Tapatalk

Posted on
Tue Oct 06, 2015 5:22 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alarm Clock (Schedule) on Control Page

What I want to do is to set a time for when a Wall plug turns on and when to turn off. Reason for doing this on a CP is mainly for ease.


That's more of a "how" than a "why". For the moment, ignore what you've already done. Describe the actual use case in as much detail as possible without regard to how it might be addressed. If you get your mind set too much on a "how" rather than examining the "why" fully, you may be overlooking better solutions that take an entirely different approach.

For instance, if you have, say, 3 different typical start times, and they have 3 typical durations, then the better solution might be to just create schedules for each and enable/disable them based on some buttons on a control page. The point is to make sure that you really understand the requirement before you start building solutions or you may end up over complicating something that might be significantly easier.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Oct 08, 2015 1:18 pm
andarv offline
Posts: 126
Joined: Jun 28, 2015
Location: Stockholm, Sweden

Re: Alarm Clock (Schedule) on Control Page

How and Why :mrgreen:
Of course, I was a bit focused on the how.

Short version:
I want to set user defined times into applescript or python and then compare current time with the defined time. with python its possible to set time on a schedule but not between (On/Off)?
As I understand it Pop-up isn't possible from CP on domopad. That left me with arrows (or pos/neg) and inc/dec of an variable?

Long version:
What I'm trying to do is to recreate the old fashioned timer that you plugged in to your wall socket to set lightings to go on/off at specific times.
Why? Not really sure to be honest, we have a lot of the old ones lying around and I'm trying to motivate a bulk purchase of wall plugs.

So what I tried to do was to create a control page containing a lot of timers for wall plugs that my wife could move around and set on/off times at here own will without using our mac. This is only for amusement, our lighting is controlled by, sunset, motion, sleepstate and homemode.

This was also a bit of an experiment, in the end i want to create a timer for our motor heaters:
From CP set departure time (it differs from time to time) - this is the main reason for asking how to set time on a control page
Enable/disable the function
Then Indigo uses outside temp to decide how long before departure it has to start the heaters. It differs a lot if its 0 degree C or -25.

BTW tanks for your homegrown security tutorial, our home is built around it. A lot of moving parts, have to keep a chart to remember what does what.

Posted on
Sat Feb 27, 2016 6:52 am
Gysbert offline
User avatar
Posts: 11
Joined: Jan 04, 2015

Re: Alarm Clock (Schedule) on Control Page

Thanks for posting whmoorejr. This was exactly what I was looking for! Had no clue how to create a schedule and change the schedule start time with a script.

I added an action group "WakeUpMM +5 minutes" that increments the variable WakeUpMM with +1 five times and attached that action group to the + button for minutes. That solves the problem of endlessly pressing +. Also did that for -5 minutes of course.

I haven't figured out how to avoid setting an unlogical time, like 46:78 o'clock. I guess I will have to rely on the last bit of available common sense late in the evening when I set my alarm...

Thanks!

15x dimmer, 6x switch, 12 sets of outdoor blinds with switches, 17x electric curtain rails with switches, 2x electric roof lights with switches, 1x multisensor, 2x door sensors, Aeotec Siren, Geohopper, WUnderground plug-in, TOON smart thermostat

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 12 guests

cron