X10 + Growl?

Jack Barse jblists at barse.org
Mon Nov 27 16:27:44 PST 2006


Ricky Buchanan <ricky at notdoneliving.net> wrote:

> I would like to set up a script that will notify Growl of all
> incoming and outgoing X10 signals.
>
> Is there a "general" hook in XTension that will catch all signals? It
> seems to be overkill to have to code this into every send/receive
> command on every interface!

Hi, Ricky,

I've been messing around a bit with Growl, too. I cobbled together a  
handler called NotifyGrowl that I saved in the Attachments script. At  
the moment I'm monitoring my exterior door and motion sensors.

I've defined only two types of notifications in the NotifyGrowl  
handler, Motion and Door although the way I'm using them at the  
moment I could get by with just one type.

---------------------
-- Watch formatting/line breaks if pasting from email!!
--
-- use as handler for Growl notificatioin
-- based on Growl sample scripts in distribution
--
on NotifyGrowl(WhichNotif, WhichDesc)
	tell application "GrowlHelperApp"
		-- Make a list of all the notification types
		-- that this script will ever send:
		-- Notif types can control the type of notif display
		set the allNotificationsList to {"Motion", "Door"}
		
		-- Make a list of the notifications
		-- that will be enabled by default.
		-- Those not enabled by default can be enabled later
		-- in the 'Applications' tab of the growl prefpane.
		set the enabledNotificationsList to {"Motion", "Door"}
		
		-- Register our script with growl.
		-- You can optionally (as here) set a default icon
		-- for this script's notifications.
		register as application "XTension" all notifications  
allNotificationsList ¬
			default notifications enabledNotificationsList icon of application  
"XTension 5.3 v454"
		
		-- Send a Notification...
		notify with name WhichNotif title time string of (current date)  
description WhichDesc application name "XTension"
		
	end tell
end NotifyGrowl
---------------------

Each sensor then gets a simple call in its On script (this one's from  
my kitchen door, obviously enough :-)  ):

-- send Growl notif
NotifyGrowl("Door", "Kitchen door opened")


If I wanted to know when a door was closed I'd add a similar entry to  
the Off script for the sensor. This isn't quite as elegant as James's  
solution of making a group, but it's simple enough that even my  
marketing-type brain can grok it. :-)  And I can customize the  
notification for each sensor easily.

BTW, I'm also using the Growl networking to send the notifications  
from the XT machine in the basement to my desktop upstairs. Its a bit  
flaky, but it seems to work most of the time. Based on what I read on  
the Growl boards that flakiness is something the developers are aware  
of. They seem to be waiting until Leopard comes out or is feature  
complete before they address it.

HTH,
Jack




More information about the XTensionlist mailing list