Alarm Clock Examples
eriklhayes
Posts: 5
I am looking for creative alarm clock functions using a touchpanel in order to set the alarm time, different alarm methods (TP beeps, ties to other systems), along with ways to acknowledge the alarm.
Thanks,
E.
Thanks,
E.
0
Comments
Make some buttons to change the beep, and set a time and you are done
Can you elaborate? I'm looking for to do same ting in MVP8400, new firmware of..... do you mean?
The feature lets the client select either a beep-beeop from the panel or will turn on soemthing in the whole house audio or their room TV.
Only one thing, I don't have panel on hand, I have only a MVP8400 on hand,(I thing as it has new firmware) You told as the feature is accessible for customer, how the customer can access this page? By panel control? Module avaible?
It's a part of the program. It's not something native to the panel itself.
I tried to wrote an alarm clock but i'm unable to do work it. The code to adjust time seem works fine ( except I don't get the ) in minute section ex: 01 min I get 1) but the rest of the code dosen't works. I goet no error from compiler.
Some body can help me?
ps DHawthorne if your module works fine and if is it avaible, where I can get it?
The first is TimeStr does not equal anything. So when you do your TIME_TO_HOUR (TimeStr)
nothing is returned.
If it were me I would use TIME_TO_HOUR (TIME) and not worry about TimeStr
Second, your code is in main line so. once you get the TIME_TO_HOUR function to work right your call is going to happen a bunch of times.
IF ((nAAHH == nAHH)&&(nAAMM == nAMM))
{
CALL 'CURTAINS_CLOSED'
}
during the minute that nAAMM == nAMM the 'curtain closed' call will be called as many times as main line can run in a 60 second period.
One thing I like to do is setup a repeating timeline that runs once a minute. In the time line I would put the code that you have written
Hope this helps.
Seriously, [@CODE]DEFINE_PROGRAM wait 1 CALL 'foo'[/@CODE]
(remove @s)
Concerning my problem, I change the variable to by more comprehensive, I tried Time line suggest by Dan
When I put this code in main line,I get an error from compiler
"ERROR: F:\AMX Program files Rev 2.1\Brosseau Demo,Rev 2.axs(1827): C10201: Syntax error; Illegal or Invalid syntax in code
F:\AMX Program files Rev 2.1\Brosseau Demo,Rev 2.axs - 1 error(s), 0 warning(s) "
When I put in Define Event section the compiler don't return error but dosen't work.
nT for Time nA for Allarm
This is a COMM version of a module but there is no real AMX device to control.
This is the main code that can be changed to a UI Module. You can use whatever you want to make HH:MM. I prefer using the Keypad. Let me know what you think.
of course to trigger any event you want just add:
I have pasted the alarm code below, somehow i am not able to store the time value in the string variable. When i run the code, i get the following in diagnostics . Obviously i am not doing the data conversions properly. I have attached the touch panel layout, so you will know the channel nos . Please guide.
Line 1 (20:29:41):: GetString - Error 1 Tk=0x0001
Line 2 (20:29:41):: CopyString (Reference) - Error 1 S=0x0000 D=0x1011
Line 3 (20:29:50):: GetString - Error 1 Tk=0x0001
Line 4 (20:29:50):: CopyString (Reference) - Error 1 S=0x0000 D=0x1011
Line 5 (20:34:34):: GetString - Error 1 Tk=0x0001
Line 6 (20:34:34):: CopyString (Reference) - Error 1 S=0x0000 D=0x1011
Line 7 (20:34:42):: GetString - Error 1 Tk=0x0001
Line 8 (20:34:42):: CopyString (Reference) - Error 1 S=0x0000 D=0x1011
PROGRAM_NAME='incAlarm'
DEFINE_DEVICE
dvTPBedRoom1Alarm = 10006:58:2
define_constant
MinuteTimeline = 1
INTEGER nTP_COUNT=3
integer nHoursMax=12
integer nHoursMin=1
integer nMinutesMax=59
integer nMinutesMin=0
// TIMELINE IDS
LONG lPanelRING_TIMEOUT1 = 200 // TIMEOUT FOR TOUCH PANEL RING
DEFINE_VARIABLE
VOLATILE LONG lRING1[] = {2000}
long MinuteTimelineTime[] = {60000} //1 minute
volatile integer nPanel1AlarmHour= 7
volatile integer nPanel1AlarmMinute=0
volatile char sPanel1AlarmPeriod='AM'
Volatile char sPanel1Alarm []= '7:00 AM'
Volatile integer nPanel1ShutterEvent=0
Volatile integer nPanel1LightsEvent=0
Volatile integer nPanel1AudioEvent=0
Volatile integer nPanel1CurtainsEvent=0
Volatile integer nOtherEvent2=0
Volatile integer nPanel1AlarmSet=0
Volatile integer nPanel1SnoozeSet=0
integer nAlarmbtns[]=
{
1, //Lights Events
2, //Shutter events
3, //Audio Events
4, //His Table
5, //Her Table
6, //Hour up
7, //Hour down
8, //Minutes up
9, //Minutes down
10, //Period Up
11, //Period Down
12, //Period State
13, //Alarm On/Off
14, //Snooze On/Off
15, //Alarm time State
16, //Hour state
17, //Minutes
18, //Alarm Off
19, //Snooze On
20
}
DEFINE_function char Alarm (integer nAlarmHour,integer nAlarmMinute,char sAlarmPeriod,dev Panel)
{
stack_var integer nAlarmPMHour
stack_var integer sAlarm
if (nAlarmMinute>=10)
{
IF (sAlarmPeriod=='PM')
{
nAlarmPMHour=nAlarmHour+12
send_command Panel,"'^TXT-15,0,',ITOA(nAlarmHour),':',ITOA(nAlarmMinute),' PM'" //Temp display
}else
{
nAlarmPMHour=nAlarmHour
send_command Panel,"'^TXT-15,0,',ITOA(nAlarmHour),':',ITOA(nAlarmMinute),' AM'"
}
sAlarm="ITOA(nAlarmPMHour),':',ITOA(nAlarmMinute),':00'"
}else
{
IF (sAlarmPeriod=='PM')
{
nAlarmPMHour=nAlarmHour+12
send_command Panel,"'^TXT-15,0,',ITOA(nAlarmHour),':0',ITOA(nAlarmMinute),' PM'" //Temp display
}else
{
nAlarmPMHour=nAlarmHour
send_command Panel,"'^TXT-15,0,',ITOA(nAlarmHour),':0',ITOA(nAlarmMinute),' AM'"
}
sAlarm="ITOA(nAlarmPMHour),':0',ITOA(nAlarmMinute),':00'"
}
REturn sAlarm
}
DEFINE_Call 'Alarm Time' (char sAlarm,integer nAlarmSet,integer nShutterEvent,integer nLightsEvent,integer nCurtainsEvent,integer nAudioEvent,dev Panel,integer nSnoozeSet)
{
IF (TIME = sAlarm)
{
send_String 0,"'Alarm Time =', sAlarm,' and Time =',Time"
if (nAlarmSet==1)
{
IF (nShutterEvent=1)//Shutter
{
do_push(dvTPLutronDiwaniya52,91)
}
IF (nLightsEvent=1)//Lights
{
do_push(dvTPLutronDiwaniya52,71)
}
IF (nCurtainsEvent=1)//Curtains
{
do_push(dvTPLutronDiwaniya52,72)
}
IF (nAudioEvent=1)//Audio
{
do_push(dvTP_AMFMARRAY[5],21)
wait 10
do_push(dvTP_AMFMARRAY[5],18)
// wait 30
//do_push(virtualTPMBRTangoVolume,292)
}
if (Panel==dvTPBedRoom1Alarm)
{
IF (TIMELINE_ACTIVE(lPanelRING_TIMEOUT1))
{
TIMELINE_KILL(lPanelRING_TIMEOUT1)
}
TIMELINE_CREATE(lPanelRING_TIMEOUT1, lRING1, 1, TIMELINE_RELATIVE, TIMELINE_REPEAT)
nPanel1AlarmSet=0
}
IF (nSnoozeSet=1)//Snooze
{
SEND_COMMAND Panel,"'^SHO-19,1'"
}else
{
SEND_COMMAND Panel,"'^SHO-19,0'"
}
send_command Panel, "'PAGE-[Home]Main Page'"
send_command Panel, "'@PPN-Alarm Popup'"
}
}
}
define_start
timeline_create(MinuteTimeline,MinuteTimelineTime,1,timeline_absolute,timeline_repeat)
DEFINE_EVENT
DATA_EVENT [dvTPBedRoom1Alarm]// contains real and virtual TP devices
{
ONLINE:
{
if ([dvTPBedRoom1Alarm,13]==1)
{
SEND_COMMAND dvTPBedRoom1Alarm,"'^ENA-1.11&14,0'"
}
else{
SEND_COMMAND dvTPBedRoom1Alarm,"'^ENA-1.11&14,1'"
}
}
}
BUTTON_EVENT[dvTPBedRoom1Alarm,nAlarmbtns]
{
PUSH:
{
SWITCH(GET_LAST(nAlarmbtns))
{
case 1:// Shutter Event
{
if ([dvTPBedRoom1Alarm,1]==1)
{
[dvTPBedRoom1Alarm,1]=0
nPanel1ShutterEvent=0
}
else{
[dvTPBedRoom1Alarm,1]=1
nPanel1ShutterEvent=1
}
}
case 2://Lights Event
{
if ([dvTPBedRoom1Alarm,2]==1)
{
[dvTPBedRoom1Alarm,2]=0
nPanel1LightsEvent=0
}
else{
[dvTPBedRoom1Alarm,2]=1
nPanel1LightsEvent=1
}
}
case 3://Audio Events
{
if ([dvTPBedRoom1Alarm,3]==1)
{
[dvTPBedRoom1Alarm,3]=0
nPanel1AudioEvent=0
}
else{
[dvTPBedRoom1Alarm,3]=1
nPanel1AudioEvent=1
}
}
case 4://Curtains Events
{
if ([dvTPBedRoom1Alarm,4]==1)
{
[dvTPBedRoom1Alarm,4]=0
nPanel1CurtainsEvent=0
}
else{
[dvTPBedRoom1Alarm,4]=1
nPanel1CurtainsEvent=1
}
}
case 5: //
{
if ([dvTPBedRoom1Alarm,5]==1)
{
[dvTPBedRoom1Alarm,5]=0
nOtherEvent2=0
}
else{
[dvTPBedRoom1Alarm,5]=1
nOtherEvent2=1
}
}
case 6://Hours up
{
if (nPanel1AlarmHour<nHoursMax)
{
nPanel1AlarmHour=nPanel1AlarmHour+1
}
send_command dvTPBedRoom1Alarm,"'^TXT-16,0,',ITOA(nPanel1AlarmHour)" //Temp display
}
case 7: //Hour down
{
if (nPanel1AlarmHour>nHoursMin)
{
nPanel1AlarmHour=nPanel1AlarmHour-1
}else if (nPanel1AlarmHour=nHoursMin)
{
nPanel1AlarmHour=nHoursMin
}
send_command dvTPBedRoom1Alarm,"'^TXT-16,0,',ITOA(nPanel1AlarmHour)" //Temp display
}
case 8:// Minutes up
{
if (nPanel1AlarmMinute<nMinutesMax)
{
nPanel1AlarmMinute=nPanel1AlarmMinute+1
}
if (nPanel1AlarmMinute>=10)
{
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,',ITOA(nPanel1AlarmMinute)" //Temp display
}else
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,0',ITOA(nPanel1AlarmMinute)" //Temp display
}
case 9:// Minutes down
{
if (nPanel1AlarmMinute>nMinutesMin)
{
nPanel1AlarmMinute=nPanel1AlarmMinute-1
}else if (nPanel1AlarmMinute=nMinutesMin)
{
nPanel1AlarmMinute=nMinutesMin
}
if (nPanel1AlarmMinute>=10)
{
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,',ITOA(nPanel1AlarmMinute)" //Temp display
}else
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,0',ITOA(nPanel1AlarmMinute)" //Temp display
}
case 10://Period up
{
off[dvTPBedRoom1Alarm,12]
sPanel1AlarmPeriod='AM'
}
case 11://Period down
{
on[dvTPBedRoom1Alarm,12]
sPanel1AlarmPeriod='PM'
}
case 13: //Alarm on/off
{
if (nPanel1AlarmSet==1)
{
[dvTPBedRoom1Alarm,13]=0
SEND_COMMAND dvTPBedRoom1Alarm,"'^ENA-1.11&14,1'"
}
else{
[dvTPBedRoom1Alarm,13]=1
SEND_COMMAND dvTPBedRoom1Alarm,"'^ENA-1.11&14,0'"
}
nPanel1AlarmSet=[dvTPBedRoom1Alarm,13]
sPanel1Alarm=''
sPanel1Alarm= Alarm (nPanel1AlarmHour,nPanel1AlarmMinute,sPanel1AlarmPeriod,dvTPBedRoom1Alarm)
}
case 14://Snooze on/off
{
if ([dvTPBedRoom1Alarm,14]==1)
{
[dvTPBedRoom1Alarm,14]=0
}
else{
[dvTPBedRoom1Alarm,14]=1
}
nPanel1SnoozeSet=[dvTPBedRoom1Alarm,14]
}
case 18: //Alarm off
{
IF (TIMELINE_ACTIVE(lPanelRING_TIMEOUT1))
{
TIMELINE_KILL(lPanelRING_TIMEOUT1)
}
[dvTPBedRoom1Alarm,13]=0
}
case 19://Snooze on
{
IF (TIMELINE_ACTIVE(lPanelRING_TIMEOUT1))
{
TIMELINE_KILL(lPanelRING_TIMEOUT1)
}
wait 6000 'Panel1Snooze'
{
IF (TIMELINE_ACTIVE(lPanelRING_TIMEOUT1))
{
TIMELINE_KILL(lPanelRING_TIMEOUT1)
}
TIMELINE_CREATE(lPanelRING_TIMEOUT1, lRING1, 1, TIMELINE_RELATIVE, TIMELINE_REPEAT)
send_command dvTPBedRoom1Alarm, "'PAGE-[Home]Main Page'"
send_command dvTPBedRoom1Alarm, "'@PPN-Alarm Popup'"
}
}
}
}
Hold [3,REPEAT]:
{
SWITCH(GET_LAST(nAlarmbtns))
{
case 6://Hours up
{
if (nPanel1AlarmHour<nHoursMax)
{
nPanel1AlarmHour=nPanel1AlarmHour+1
}
send_command dvTPBedRoom1Alarm,"'^TXT-16,0,',ITOA(nPanel1AlarmHour)" //Temp display
}
case 7: //Hour down
{
if (nPanel1AlarmHour>nHoursMin)
{
nPanel1AlarmHour=nPanel1AlarmHour-1
}else if (nPanel1AlarmHour=nHoursMin)
{
nPanel1AlarmHour=nHoursMin
}
send_command dvTPBedRoom1Alarm,"'^TXT-16,0,',ITOA(nPanel1AlarmHour)" //Temp display
}
case 8:// Minutes up
{
if (nPanel1AlarmMinute<nMinutesMax)
{
nPanel1AlarmMinute=nPanel1AlarmMinute+1
}
if (nPanel1AlarmMinute>=10)
{
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,',ITOA(nPanel1AlarmMinute)" //Temp display
}else
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,0',ITOA(nPanel1AlarmMinute)" //Temp display
}
case 9:// Minutes down
{
if (nPanel1AlarmMinute>nMinutesMin)
{
nPanel1AlarmMinute=nPanel1AlarmMinute-1
}else if (nPanel1AlarmMinute=nMinutesMin)
{
nPanel1AlarmMinute=nMinutesMin
}
if (nPanel1AlarmMinute>=10)
{
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,',ITOA(nPanel1AlarmMinute)" //Temp display
}else
send_command dvTPBedRoom1Alarm,"'^TXT-17,0,0',ITOA(nPanel1AlarmMinute)" //Temp display
}
}
}
}
TIMELINE_EVENT[lPanelRING_TIMEOUT1]
{
SEND_COMMAND dvTPBedRoom1Alarm,"'@SOU-doorbell6.wav'"
}
timeline_event[MinuteTimeline]
{
call 'Alarm Time'(sPanel1Alarm,nPanel1AlarmSet,nPanel1ShutterEvent,nPanel1LightsEvent,nPanel1CurtainsEvent,nPanel1AudioEvent,dvTPBedRoom1Alarm,nPanel1SnoozeSet)
}