X10 Community Forum

🖥️ActiveHome Pro => Smart Macros => Plug-ins => User-Designed Working Macros => Topic started by: glacier991 on April 26, 2010, 01:22:12 PM

Title: Voice Controlled Wakeup Macro
Post by: glacier991 on April 26, 2010, 01:22:12 PM
I have a fairly robust X-10 based HA system, running AHP 3.236 with all the plug ins, and including Bill's BVC voice control (which is still in its infancy insofar as implementation is concerned - another story though). I have set up my voice control to actually "interact" with me in a semi conversational setting in some instances. One day I was postulating a "discussion" about going to bed and having my "AI Butler", Mike, turn off the lights for me. I thought it would be cool if I could also have him ask if I wanted to be awakened in the am, and if I replied affirmatively, then ask what time, and follow that command the next morning. It seemed a little far fetched and I dropped it.

Like so many things, it just would not go away and I started thinking about how, using macros, conditions and possibly flags or timers, I might make it happen. I discussed my ideas with Dave X-10 and Bill Johns (creator of BVC) and they gave ideas and encouragement. The result is that I can ask "Mike" to wake me at either 6 AM, 7am or 7:30 am and he will do so.

Before I post the macro, let me describe how I get awakened under this scheme, and the general components of the programming that make it work.

CONCEPT

My bed has a "lightbar" between two drawer/armoire units on either side of the head of the bed. I use it to read and for general illumination, and X-10 controls it. I also have an X-10 chime in my bedroom. These form the "alarm".

If I want to awaken at 7 (for example) the following occurs: at 6:40, the lightbar comes on and dims to 50% and the chime sounds. At 6:50 the lightbar goes up to 75% and the chime sounds. Then at 7am, the lights come on full and the chime sounds twice, and Mike speaks to me telling me good morning, and that it is time to get up, and the jetson's theme song (well an abbreviated version) plays.

IMPLEMENTATION SCHEME

To make this work by voice control, I had to set up 3 things.

First I set up 3 phantom modules - using on/off switches. I assigned each a monitored address - in my case A8 for 6AM, A12 for 7AM and A14 for 7:30AM. These I control using BVC to turn them on. (If BVC "hears" me say "Wake me at Seven Thirty", for example, A14 switch goes to the "ON" position - and similarly for 6 am and 7 am setting the appropriate switch to "ON"). [I add that is you don't have BVC you COULD just manually turn these on using a remote or within AHP, just less "gee whiz" - try BVC, you'll love it.]

Next I created a long macro to accomplish the sequence of turning ON the lightbar and sounding the chime.. this was pretty basic, and used delays to do the sequencing. It had enough events though that the 1st  Macro (at address E1) has to call E2 at the end to pick up the work and in turn E2 calls E3 to finish. These series are specific to my situation, and anyone doing their own would need to create one to do what they wanted it to do to wake them. At the end, E3 turns off ALL wake up switches, resetting the wake up for another cycle the next day. The call for E-3 is also the BVC listener trigger to have "Mike" wish me good morning.

Finally, I set up 3 conditional Macros that run off a timer. One starts at 5:40, one at 6:40 and one at 7:10. Each looks to see if it's "alarm switch" (the 6am, 7 am or 7:30 am Voice controlled phantom switch) is on. If it is, it starts the E1 wake up macro. If not, it does nothing. Presumably, only one wake up switch has been set, and that is the one that will run, and because the timed conditional macro started the wake up sequence at the "right" time, all works as planned.

MACRO AND DESIGN SPECIFICS

In a room I have called Wake Up, I have installed 3 appliance switches, labeled 6 am wakeup, 7 am wakeup and 7:30 am wakeup.

I have a series of 3 macros called Wakeup macro 1, wakeup macro 2 and wakeup macro 3. They are addressed E1, E2 and E3 respectively.

Wakeup Macro 1 (address E1) contents:

Trigger E1 ON

Bed lightbridge A2 ON 50%
Delay 5 seconds
Bedroom Chime
Delay 10 minutes
Bedroom lightbridge A2 70%
Delay 2 seconds
Bedroom Chime
Module Control E2 ON

Wakeup macro 2 contents

Trigger  E2 ON

Delay 10 minutes
Bedroom lightbridge on 100%
Delay 2 seconds
Bedroom chime
Delay 10 seconds
Bedroom Chime
Module Control E3 on

Wakeup Macro 3 contents

Trigger E3 ON  (the BVC voice of Mike saying "good morning" triggers off this command using a listener)

6 am wakeup module (A8) Off
Delay 1 second
7am wakeup module OFF
Delay 1 second
7:30 wakeup module OFF
Delay 10 seconds
Issue X10 command E10 (triggers a listener in BVC to play Jetson's theme song)

Conditional macros

6am wakeup

Trigger E6
Timer set to turn on macro at 5:40 AM
Delay 2 seonds
Module Control E1 On

Conditions 

E6 on (by timer as above)
and
Module status of A8=ON

7AM wakeup identical except for looks to se if Module A12 is on, 7:30 wakeup looks for A14 to see if it is on.

All macros can be either run from computer or interface.

That's it.  Have fun!
Title: Re: Voice Controlled Wakeup Macro
Post by: HA Dave on April 26, 2010, 04:17:51 PM
Awesome!

This is the type of human-computer interaction that every geek, or nerd [or otherwise overtly intelligent young man] has dreamed of. This is certainly what I would call a S.A.R.A. (http://davesdomainonline.com/sara/sara.htm) approved macro. I think we are still just at the beginning of what can be done with X10, the CM15A, AHP, and BVC (http://davesdomainonline.com/bvc/bvc.htm). Thank you for inspiring us all.

Now... maybe a macro that detects that you are preparing for bed... and can remind you to set a wake-up call.
Title: Re: Voice Controlled Wakeup Macro
Post by: glacier991 on April 26, 2010, 05:26:23 PM
"Now... maybe a macro that detects that you are preparing for bed... and can remind you to set a wake-up call."

No, before that is the one that will visit the bathroom for me in the middle of the night, leaving me to sleep. -:)

[Actually a motion detector and a conditional macro timed for the bedtime hour could easily accomplish what you seek]
Title: Re: Voice Controlled Wakeup Macro
Post by: Knightrider on April 26, 2010, 07:58:14 PM
Genius!

+1 from me
Title: Re: Voice Controlled Wakeup Macro
Post by: -Bill- (of wgjohns.com) on April 27, 2010, 02:51:37 AM
So, that's what all those questions were about!   ;)

A wonderful example of how to "think outside the box" and get around the "limits" of AHP, BVC and X10 to do something that most would expect was "impossible".   8)   :)%

A "helpful" from me, as well! #:)

 >!
Title: Re: Voice Controlled Wakeup Macro
Post by: IPS on July 13, 2010, 07:53:54 PM
That is a good one.