Tuesday, February 19, 2008

New Version of xPL HALi Coming

I've been working on changes to xPL HALi to make it more than just an xPL-HALi bridge. It will now read in a configuration file that specifies VR phrases and associates a number of xPL commands with that phrase. This will give you have the ability to directly issue xPL commands from VR.

A sample line in the config file will be a comma separated list:

turn off bass amp,i have turned off the bass amp,xpl-cmnd,doghouse-scu.xyz,x10.basic,device=BassAmp,command=off

In response to the phrase "turn off bass amp", xPL HALi will issue an xpl-cmnd of schema x10.basic to app doghouse-scu.xyz tellin it turn off the BassAmp. HAL will confirm the phrase by saying "i have turned off the bass amp" via TTS.

Look for it to drop in the next few days after I've had some time to test it.

Monday, February 18, 2008

Cheap 350VA UPS at Staples $19.99 AR

Cheap APC UPS $19.99 AR with free shipping too. Use the Staples Easy Rebate to file it online so there's nothing to mail or photocopy. This is perfect for security cameras, etc.

Saturday, February 16, 2008

Video of xPL Gmail in Action

Here's a video of the xPL Gmail script I hacked together the other day. On the right of the screen is an RDP session to the HA server showing xPL Gmail running in a command prompt and the DCM message viewer below that. To the left is our HA GUI. I just added the capability of displaying osd.basic messages to our GUI.

A test email is sent to the monitored Gmail account. xPL Gmail polls for new mail periodically and when it finds a new message, it issues an osd.basic xPL message which is captured by the DCM logger. xAP Floorplan grabs OSD messages and dumps them into the HA MySQL database which our GUI pulls data from. The message gets displayed in the GUI for a short time before disappearing.

Friday, February 15, 2008

xPL Gmail Notifier

I've taken the Python source for Gmail Notifier and modified it (with code from the Python xPL Toolkit) to issue an xPL osd.basic message when it encounters a new email message. Since it's Python, you can easily modify notifier.py to change the xPL message to whatever you want. I'll leave that as an exercise to you. A few things, before you grab the zip file (comments I left in the code):

# * changes to remove the tray icon as pytrayicon is not
# supported in windows
# * removed the popup that notifies of a new email
# * added xPL support to generate osd.basic messages
# containing sender of new email
# * since there's no tray icon, you cannot reconfigure from the gui
# after you've configured once before. therefore if you need to
# change your settings again, edit .notifier.conf located in
# c:\documents and settings\your_login

You'll need to install a few things first besides Python - PyGTK and GTK. Go here and follow the directions for PyGTK for Microsoft Windows. Finally, here's my zip file.


Wednesday, February 13, 2008

AT&T DSL Pricing Going Up

We have Comcast at our main house and AT&T DSL at our other. The price of DSL is going up $5 per month starting this month! That's a 25% increase over what we're paying for 1.5Mbps service. The service is pretty bad as it is but we don't use it that much. No wonder the US has the worst/priciest Internet experience - pretty sad considering we invented the Internet. That's what happens when there's no competition and you allow all the regional bells to merge together. Funny that AT&T announced "free" hotspot access for many of their broadband customers a few weeks before they announced their raising broadband prices. Free my ass.

If you are staying with AT&T, like we are, because there's no cheaper alternative, then hit this link to lock in your current rate for 1 year before you start financing their "free" wifi hotspots.

More Details on xPL HALi App

You can edit the enclosed XML file (xpl_doghouse-hali.instance0.3.0) to change the name of your xPL HALi instance. In the file, the key newconf is set to "home", but you can change that to anything you want.

To install more than one xPL app on your PC, you'll need an xPL hub. Here's one.

A good thing to have around is the xPL command line sender or the GUI xPL sender.

Another helpful app is DCM. The message logger is a great utility for debugging.

So what can you do with all this? Let's just start with something simple. Send an xPL message to xPL HALi to change a flag using the command line sender. From the command shell type (all on one line with a space after 'home' and before 'control'):

xplsend xpl-cmnd doghouse-hali.home control.basic device=testflag\ntype=flag\ncurrent=1

This issues an xPL command to application doghouse-hali.home (where home is the default name in the XML file mentioned above). The command is a control.basic type that sets the flag named 'testflag' to 1 or TRUE. You can try out the other commands that xPL HALi supports by following the command guide in the previous post. Have fun.

Monday, February 11, 2008

xPL HALi App Available for Download

So I've decided to release my xPL HALi application that I mentioned here. You can get it here. I only implemented portions of HAL I use (no X10, no DMC, no alarm panels, etc.) Just the basics. Don't know what xPL is? Read this and visit the xPL Forums. You'll need to install .NET 2 and .NET 3.5

It issues xpl-trig sensor.basic commands in response to the following events:

  • Listening state changed
    sensor.basic
    {
      device=listen
      type=mic
      current=1
    }
    This message is sent when HAL is listening via microphone. Type will change if VR is via handset.

  • Macro Executed
    sensor.basic
    {
      device=macro
      current=macroname
    }
    Execute 'macroname' macro.

  • New Voice Mail
    sensor.basic
    {
      device=newvmail
      current=1
    }

  • Phone Hook Changed
    cid.meteor
    {
      CallType=outgoing
      CCS=initiated
    }
    Outgoing call started.

  • Phone Ringing
    cid.meteor
    {
      CallType=incoming
      CCS=ring
    }
    Incoming call.

  • Sensor State Changed
    sensor.basic
    {
      device=sensorname
      type=flag
      current=1
    }
    Flag 'sensorname' set to 1. Type can be flag, counter, variable or timer.

  • Speech Notify
    sensor.basic
    {
      device=VR
      current="phrase recognized"
    }
    Recognize the listed phrase via VR.


    The app responds to control.basic xpl-cmnd messages allowing some control of HAL devices:

  • Setting a Flag
    control.basic
    {
      device=sensorname
      type=flag
      current=1
    }
    Set a flag to 1.

  • Setting a Variable
    control.basic
    {
      device=sensorname
      type=variable
      current=1
    }
    Set a variable to 1

  • Setting a Timer
    control.basic
    {
      device=sensorname
      type=timer
      current=60
    }
    Set timer to 60 seconds.

  • Increment a Counter
    control.basic
    {
      device=sensorname
      type=counter
      current=+1
    }

  • Decrement a Counter
    control.basic
    {
      device=sensorname
      type=counter
      current=-1
    }

  • Set a Counter
    control.basic
    {
      device=sensorname
      type=counter
      current=20
    }


  • VOIP VR Video

    Here's another video I made. It shows how we use TeamSpeak voice chat software from remote PCs to talk to HAL.

    The video shows an RDP session to the HA server on the left of the screen and on the right is the TS client running on a laptop. In the RDP client, you'll see the HAL monitor, the xPL HALi app I wrote, starCOMUltra and our web based GUI. HAL, named Sara since the wife likes the show Eureka, responds to her name spoken into the laptop microphone. The TS client blinks as it hears me. The HAL monitor shows the name was recognized and enters listening mode. xPL HALi sends an xPL control.basic message with the listening status. xAP Floorplan (via its xPL bridge) sees the message and sends message.display to all OSD devices (in this case xAP Intranet Launcher) informing them that the system is listening. This is necessary since HAL's audio is not routed back through TS to the laptop and we may not be within earshot of HAL. A couple commands are spoken to turn on & off the kitchen light. You can hear the click of the switch as it toggles, see the commands being issued by starCOMUltra and see the kitchen light go on & off in the GUI.


    Sunday, February 10, 2008

    Home Automation GUI Video

    Here's a video of the HA interface I've been building. It's a few months old now and has been posted on a few HA forums here & there. Since Comcast bumped web page capacity, I decided to leave the video up and link to it from here

    This pretty much represents all systems interacting together - starCOMUltra, xPL, xAP, HAL - and tied together with AJAX, MySQL, PHP and DHTML running on Apache.

    Friday, February 1, 2008

    Farewell kJ :(

    Our beloved kJ passed away yesterday at the age of 13 years, 8 months. kJ has been with me since my interest in home automation began. He witnessed the mad wiring, connecting, soldering and programming, and was also the reason for a few automation tasks (ie: the computer yelling at him in his doghouse when he howled at night). He was always there to tilt his head when asked if he thought this was a safe spot to drill in the wall. When he didn't like something I did, like leave the landscape lighting wires exposed, he would promptly chew them up and make me do it better. Of course, his expert assistance was the reason behind how kJ's Doghouse came to be :) We miss you so much kJ.

    http://www.doghouselabs.com

    Sunday, January 27, 2008

    xPL sCU

    I actually finished this app before xPLHALi. It's an xPL-starCOMUltra bridge. It was extremely easy to build an app to do this since all the events and methods worked as they were supposed to. Since I only have a TimeCommander+, I have not implemented the phone, alarm and tstat features of Stargate. My app generates xPL stat.basic messages for changes to timers, variables, flags, relays, digital and analog inputs and ASCII output. It generates remote.basic for IR generated and x10.basic for X10 commands issued. It accepts control.basic to set variables, flags, relays and user variables, x10.basic to send X10 and remote.basic to have sCU issue IR commands.

    In the screen cap below, you can see in the DCM xPL logger that a command was sent to my app to set a flag. It set the flag in starCOMUltra and generated a status.basic message in response to the set command. There is also another status.basic message for a flag that sCU set on its own. Finally, I issued an IR command through my app and you can see the remote.basic xpl-trig generated in response. You can also see the events issued by sCU in its window.


    Thursday, January 24, 2008

    More HAL Bugs

    Hard to imagine I've been playing with HALi for about a week and I keep finding problems. Why does the SensorStateChanged event fire even though the sensor was set to the same value (it hasn't actually changed)? This brings me to another problem, which uncovered this one.

    I have a simple rule NewVM that should set a flag when I have new voice mail. If a call comes in and the caller leaves a voicemail, this rule fires 3 times! Why?

    NewVM
    IF:
      NewVoice Message in All Mailboxes >= 1 (TE)
    THEN:
      SetFlag NEWVMAIL to TRUE

    On the other hand, if I have no voicemail, I want to clear that flag via this rule:

    NoVM
    IF:
      NewVoice Message in All Mailboxes = 0 (TE)
    THEN:
      SetFlag NEWVMAIL to FALSE

    What's retarded about this is if you playback all the messages and have them automatically changed from NEW to SAVED, this rule doesn't trigger despite there being no more new messages. Also, if you delete all messages from the phone pad app the rule still won't trigger. If you delete new messages one at a time from the phone pad it finally does trigger.

    I came up with these rules so HAL generates events that my xPLHALi app can translate to xPL messages, informing other devices/apps in my system. But HAL can't actually generate a reliable NEWVMAIL flag so it's pretty much useless to me.

    HAL guru posted on the HAL message board that a "new" feature in 4.0 will be ability to check if something actually changed! HALi 4.0 now won't waste extra CPU cycles generating the same events for things that haven't actually changed. Hooray. WinEVM for my TimeCommander+ added that feature in 1997.