Trying to announce motion to other macs using applescript.

Posted on
Thu Feb 21, 2013 4:19 am
storrence offline
Posts: 18
Joined: Jul 07, 2004

Trying to announce motion to other macs using applescript.

I would like my indigo server using applescript or python to announce when someone is at the front entrance. I have several macs and want it to send a SAY command to each of them. I have it working but was wondering if there was a better or more efficient way to do it. I would like to also send a notification to the new right side notification pane in OS X. Is that possible with applescript or python? TIA!

Code: Select all
property ipNumber : "192.168.1.1"
property userName : "x"
property pasword : "x"

set remMachine to "eppc://" & userName & ":" & pasword & "@" & ipNumber
using terms from application "Finder"
   tell application "Finder" of machine remMachine
      say "Someone is at the front entrance"
   end tell
end using terms from

Posted on
Thu Feb 21, 2013 4:12 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trying to announce motion to other macs using applescrip

Not that I know of. Growl used to be able to send network notifications but I haven't really looked into that recently. And I don't know if it'll do text to speech...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Feb 22, 2013 6:08 am
storrence offline
Posts: 18
Joined: Jul 07, 2004

Re: Trying to announce motion to other macs using applescrip

Is there a more efficient way to write that applescript. I was using it as embedded script in indigo but that was causing delays if the machine was not reachable. I understand saving it as an app and calling it that way will eliminate that problem but was curious if optimizing it in other ways would also make it work better. I'm not very familiar with applescript.

Or would python be a better choice?

Posted on
Fri Feb 22, 2013 2:02 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trying to announce motion to other macs using applescrip

That's probably about as good as you can do. Python isn't a good choice really - this is one situation where AppleScript is probably the better/easier way to go.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Feb 22, 2013 3:01 pm
storrence offline
Posts: 18
Joined: Jul 07, 2004

Re: Trying to announce motion to other macs using applescrip

Thanks.

Posted on
Fri Feb 22, 2013 3:46 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trying to announce motion to other macs using applescrip

However, you can save the AppleScript as an external script file (using the Apple Script Editor program) then have the Indigo Action execute the script file instead of having it execute the embedded script. Embedded scripts have to run in Indigo's main thread, which will block the Indigo Server until it finishes. But if it is an external file, then it will run in its own process and not block Indigo.

(I just noticed in your post you are already aware of this option, so ignore the above)

Image

Posted on
Fri Feb 22, 2013 4:24 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Trying to announce motion to other macs using applescrip

storrence wrote:
Is there a more efficient way to write that applescript. I was using it as embedded script in indigo but that was causing delays if the machine was not reachable. I understand saving it as an app and calling it that way will eliminate that problem but was curious if optimizing it in other ways would also make it work better. I'm not very familiar with applescript.

If you want to keep the AppleScript as an embedded script, you might try enclosing the code above inside

with timeout of 5 seconds // ... or however many seconds you're willing to allow Indigo to hang.
end timeout

or

ignoring application responses
end ignoring

statements.

Posted on
Fri Feb 22, 2013 6:38 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: Trying to announce motion to other macs using applescrip

FWIW, my doorbell doesn't sound all over the house, and not at the pool at all. I use AppleScript to tell iTunes to play a doorbell tone -- you could just as easily substitute a spoken phrase -- and then script Airfoil to activate the Airfoil client on each computer so the announcement comes over them. I also activate my whole house audio, which plays the announcement to the pool and other locations.
Last edited by hamw on Sat Feb 23, 2013 8:42 am, edited 1 time in total.

Posted on
Sat Feb 23, 2013 5:42 am
storrence offline
Posts: 18
Joined: Jul 07, 2004

Re: Trying to announce motion to other macs using applescrip

@hamw: great idea but in my case this works better because we have enough laptops around the house to be able to hear it. Maybe I will add some script to pause iTunes if it's playing but otherwise it's working great now as an external script.

@nsheldon: Thanks but doing it as an external script I think it will be more reliable.

Posted on
Sat Feb 23, 2013 5:49 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Trying to announce motion to other macs using applescrip

Going back to what Jay mentioned about Growl, that’s how i’ve got my system setup. Pressing the doorbell activates a trigger which checks who is at home, then forwards a notification to each machine that’s on and also a prowl notification to my iPhone when nobody is home. Also a slight tangent.. How about setting up some extra doorbells around the house and setting some kind of trigger so if the doorbell is pressed indigo then chimes the other doorbells if the door isn’t opened in say 30 seconds? That’s basically how i’ve got my system setup… (plus it also brings up the front door camera on the lounge TV if it’s on so i can see if it’s someone i actually want to answer the door to)

Computer says no.

Posted on
Sat Feb 23, 2013 7:02 am
storrence offline
Posts: 18
Joined: Jul 07, 2004

Re: Trying to announce motion to other macs using applescrip

OK now you have me thinking! :) I would have to reinstall growl because I removed it when apple added there notification manager. Do you know if it now integrates with that? I didn't like having stuff popping up all over the place. The way apple does it is less disturbing.

What doorbell do you use? I'm using z-wave, insteon and W800RF32.

I use security spy so maybe I can bring that app to the front on the remote computers with applescript. We don't have any TVs here.

Do you mind posting your scripts? I'm pretty much a newbie with applescript.

Posted on
Sat Feb 23, 2013 7:37 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Trying to announce motion to other macs using applescrip

For the doorbell and button i’m using a Home Easy HE-306 doorbell with a RFXCom RFXtrx433 to receive the push signal from the doorbell.. but as you’re not likely to be in the UK that probably wouldn’t work for you.. but i believe something like the insteon IO Linc wired to the doorbell button would work as well.. or google for x10 doorbells.. i seem to recall there’s a lot of them out there.

As for the front door camera i use one of these: http://www.ebay.co.uk/itm/Security-Tact ... 2327d23600 The image isn’t great but it is good enough to see who’s at the door.

As for scripts most of it is trigger based with action groups rather than scripts.. so if the doorbell is pressed it’ll immediately trigger the doorbell and set the PiP on my tv to the front door camera (using a Cynical Cache GC-100). It also sets a delayed schedule to re-ring the doorbell after 45 seconds if the front door is not opened. If it’s opened the DSC alarm sees the zone open, and that activates another trigger that removes delayed actions for the doorbell.

Also using SecuritySpy as soon as the door bell is pressed it starts recording an image of whoever’s at the front door and i hope one day to setup some kinda script to take a jpg of that and email it to me if i’m not home.. but i’ve not got that far…. yet :)

Computer says no.

Posted on
Sat Feb 23, 2013 8:32 am
storrence offline
Posts: 18
Joined: Jul 07, 2004

Re: Trying to announce motion to other macs using applescrip

Wow thanks for all the great ideas! I'm going to do something similar as I have a y-cam already near the front entrance. The our house is laid out differently. I have a camera at the front where someone would arrive but our front door is actually on the side. So I will use the motion sensor where someone arrives first and if they didn't know us they wouldn't really go any further than that. Then I will record the video in security spy and email me a short video. Should be easy to do without any scripting.

Posted on
Sat Feb 23, 2013 8:55 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Trying to announce motion to other macs using applescrip

Hope it all works out for you! It’s now prompted me to look into extending my system for use on the backdoor too.. i have a PIR there for motion and a Foscam PTZ camera that i can use already so hopefully soon i’ll have all bases covered.

Computer says no.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 27 guests