Party Button: PC Setup

The PC is the back end of the party button system. You could say it is the heart and brains of the system or as I like to say it's where the magic happens. Everything is controlled by the PC and it completes a lot of tasks from just a simple push of a button.

This post is the third in a four part series:

  1. Party Button: Overview
  2. Party Button: Button Box
  3. Party Button: PC setup
  4. Party Button: Peripherals

Hardware Parts List

Software List

Zigbee Wireless

The Zigbee wireless transceiver is recognized by the PC as a serial port. My "Auto Hotkey" script simply monitors the com port for incoming data and looks for the start/stop sequence. For simplicity the script uses the same sequence as a start and stop pattern. Although I did not have Party Button system peripherals that used Zigbee wireless I could have controlled them from the PC through the Zigbee wireless transceiver.

You can see an example of a serial communication Auto Hotkey script here.

Zwave Peripherals

I used the Think Essentials software to setup the Zwave network. The Think Essentials software doesn't run on a day to day basis. I use the Zwave Commander service to turn devices on and off.

The following code snippet from my auto hotkey script turns device 6 on for 2 seconds and then turns it off using Zwave commander http commands.

RowText=http://localhost:8084/ZwaveCommand?command=device&id=6&level=100
run, %RowText%
sleep 2000
RowText=http://localhost:8084/ZwaveCommand?command=device&id=6&level=0
run, %RowText%

TV Control

A major obstacle to integrating the TV into the system is that (at the time) no PC video card supported HDMI-CEC. There was no easy way to turn on the TV and set the input to the right source. To solve this problem, I used a USB IR Toy as a remote that the PC controlled. The IR Toy uses WinLIRC to memorize the IR protocol of the TV (by reading the transmissions of the TV remote). Using the saved settings, the "Auto Hotkey" script sends commands to the TV to turn on and to use the HDMI input from the PC.

Below is the "Auto Hotkey" code snippets to turn on a TV

transmit_path = %PATH%\WinLIRC\transmit.exe
transmit(lircremote,lircbutton,lircrepeats)
{
   global transmit_path
   Run % "" transmit_path " " lircremote " " lircbutton " " lircrepeats
}

transmit("remote","power",2)

Text Messages

I setup a script that is executed by "Auto Hotkey" to send myself and others a text message letting them know the party button has been activated. you can see that script here. A code snippet to call the VBS script from the "Auto Hotkey" script is below.

Run %PATH%\email.vbs

Music

The Music is played through Windows Media Player which is launched by the script and set to full screen with visualizations on the TV.

Below are some code snippets that run Windows Media Player and play the song "What is Love" in full screen mode.

Run wmplayer
sleep, 500
PostMessage, 0x111, 57601, 0, , ahk_class WMPlayerApp ; open file
sleep, 500
Clipboard = 01 - What Is Love (Single Mix).mp3
Send, ^v{ENTER}
sleep, 500
PostMessage, 0x111, 16000, 0, , ahk_class WMPlayerApp ;now playing
PostMessage, 0x111, 84344, 0, , ahk_class WMPlayerApp ;Play/Pause
sleep, 500
PostMessage, 0x111, 18782, 0, , ahk_class WMPlayerApp ;fullscreen

Conclusion

The PC setup is the biggest task in getting the party button system operational but much of the effort can be leveraged for other home automation tasks.