iMessage Notification

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
trixwood

iMessage Notification

Post by trixwood »

iMessage

TRiXWooD Scripts viewtopic.php?f=23&t=12145&p=87422#p87422

Uses: Mac, OSX, Applescript
Screen Shot 2016-05-08 at 07.36.25.jpg
Screen Shot 2016-05-08 at 07.36.25.jpg (56.88 KiB) Viewed 7422 times
I have domoticz running on OSX and I use this for notification iMessage. I suggest you create a new appleid for your osx domoticz server. Login to it with the message app. Now you can use this account to send imessages (you can use your own account but it nicer not to)

notify.sh

Code: Select all

#!/bin/bash
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "[email protected]" "Subject: $1"
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "[email protected]" "$2"
Note that you have to change the path to your install folder. [email protected] is the buddy (not my terminology) or account/telephonenumber you want to send the message to. No idea how to make one message with a return into the message from the command line. But this will due... besides two beeps might be important!
Ofcourse you can always change it into one beep with

Code: Select all

#!/bin/bash
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "+31063356235" "Subject: $1 $2"
imessage.scpt

Code: Select all

on run argv
	tell application "Messages" to send (item 2 of argv) to buddy (item 1 of argv)
	tell application "Messages" to send (item 3 of argv) to buddy (item 1 of argv)
end run
Untitled.jpg
Untitled.jpg (52 KiB) Viewed 7424 times
If you are running on a pi and have an osx server next to it you can remote execute the applescripts :-) Anyway now you have imessage notification.

Signed TRiXWooD

Update

Ofcourse this is maybe better:

notify.sh

Code: Select all

#!/bin/bash
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "$1" "Subject: $2"
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "$1" "$3"
With: script://notify.sh "[email protected]" "#SUBJECT" "#MESSAGE"

For config sake... rum...
Last edited by trixwood on Sunday 29 May 2016 18:19, edited 1 time in total.
HoLeeShiet
Posts: 26
Joined: Tuesday 18 March 2014 21:19
Target OS: -
Domoticz version:
Contact:

Re: iMessage Notification

Post by HoLeeShiet »

Nice! Is it possible to include screenshot of IP camera too?
Using Tapatalk
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: iMessage Notification

Post by mvveelen »

This is great. I only wish I could run everything on 1 device, my Synology NAS :geek:
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: iMessage Notification

Post by Egregius »

There is no API explanation available for iMessage, so won't be so easy to implemented on something else.
But, Telegram is a great tool for text, photo and video notifications and is easy to use.
For high priority message I have a PHP function that sends message to my iPhone using the Find my iPhone service. They always make the sound, even when on silent or do not disturb. Ideal for messages like from smoke detectors.
User avatar
mvveelen
Posts: 678
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: iMessage Notification

Post by mvveelen »

Well, the great advantage of iMessage (for me) is, that you can send a picture from the camera directly to your Apple Watch, so you can see immediately who is standing in front of your door :)
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
User avatar
robpow
Posts: 38
Joined: Friday 19 July 2013 19:28
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta :)
Location: .se
Contact:

Re: iMessage Notification

Post by robpow »

Very cool!

I had to add 'of service...' to the iMessage command though to make it work:

Code: Select all

on run argv
	tell application "Messages" to send (item 2 of argv) to buddy (item 1 of argv) of service "E:<my iCloud email>"
end run
User avatar
robpow
Posts: 38
Joined: Friday 19 July 2013 19:28
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta :)
Location: .se
Contact:

Re: iMessage Notification

Post by robpow »

Here are my scripts to send a snapshot from a Foscam IP camera to my phone and watch:

iMessage.sh

Code: Select all

#!/bin/bash
wget  http://192.168.0.101:8080/camsnapshot.jpg?idx=2 -O /tmp/cam.jpg
osascript ~/iMessage.scpt +990011223344 "Subject: Door open" "/tmp/cam.jpg"
iMessage.scpt

Code: Select all

on run argv
	set theAttachment to POSIX file (item 3 of argv)
	tell application "Messages" to send (item 2 of argv) to buddy (item 1 of argv) of service "E:<iCloud address>"
	tell application "Messages" to send file theAttachment to buddy (item 1 of argv) of service "E:<iCloud address>"
end run
Last edited by robpow on Tuesday 17 May 2016 22:56, edited 1 time in total.
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: iMessage Notification

Post by Flopp »

Hide your number
User avatar
robpow
Posts: 38
Joined: Friday 19 July 2013 19:28
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta :)
Location: .se
Contact:

Re: iMessage Notification

Post by robpow »

I wish I had that as a number... don't even think it's a valid phone number. :)
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

iMessage Notification

Post by Flopp »

robpow wrote:I wish I had that as a number... don't even think it's a valid phone number. :)
:)
I will test that script soon, looks REALLY nice
elizzabeth01
Posts: 1
Joined: Tuesday 11 July 2017 7:47
Target OS: OS X
Domoticz version:
Contact:

Re: iMessage Notification

Post by elizzabeth01 »

trixwood wrote:iMessage

TRiXWooD Scripts viewtopic.php?f=23&t=12145&p=87422#p87422

Uses: Mac, OSX, Applescript

Screen Shot 2016-05-08 at 07.36.25.jpg

I have domoticz running on OSX and I use this for notification iMessage. I suggest you create a new appleid for your osx domoticz server. Login to it with the message app. Now you can use this account to send imessages (you can use your own account but it nicer not to)

notify.sh

Code: Select all

#!/bin/bash
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "[email protected]" "Subject: $1"
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "[email protected]" "$2"
Note that you have to change the path to your install folder. [email protected] is the buddy (not my terminology) or account/telephonenumber you want to send the message to. No idea how to make one message with a return into the message from the command line. But this will due... besides two beeps might be important!
Ofcourse you can always change it into one beep with

Code: Select all

#!/bin/bash
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "+31063356235" "Subject: $1 $2"
imessage.scpt

Code: Select all

on run argv
	tell application "Messages" to send (item 2 of argv) to buddy (item 1 of argv)
	tell application "Messages" to send (item 3 of argv) to buddy (item 1 of argv)
end run

Untitled.jpg

If you are running on a pi and have an osx server next to it you can remote execute the applescripts :-) Anyway now you have imessage notification.

Signed TRiXWooD

Update

Ofcourse this is maybe better:

notify.sh

Code: Select all

#!/bin/bash
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "$1" "Subject: $2"
osascript ~/Smarthome/domoticz/scripts/imessage.scpt "$1" "$3"
With: script://notify.sh "[email protected]" "#SUBJECT" "#MESSAGE"

For config sake... rum...
Just today i know we can also run and send imessage from our own server we just have to tweak our server with thsese scripts so let me tell you that we can also run imessage on our pc runing windows check it out on bloomtimes. Hope you like it and thank you very mch for this guide.
theolsen
Posts: 46
Joined: Wednesday 31 July 2013 11:15
Target OS: -
Domoticz version:
Contact:

Re: iMessage Notification

Post by theolsen »

I'm sorry to open an old thread but there is not much conversation around iMessage on this forum.
i am running Domoticz on OSX.

I have created the iMessage.scpt and notify.sh and placed them both in my domoticz/scripts folder.

My imessage.scpt is like this:

Code: Select all

on run argv
        tell application "Messages" to send (item 2 of argv) to buddy (item 1 of argv) of service "[email protected]"
        tell application "Messages" to send (item 3 of argv) to buddy (item 1 of argv) of service "[email protected]"
end run
and notify.sh is like this:

Code: Select all

#!/bin/bash
osascript /Users/dave/domoticz/scripts/imessage.scpt "+44567334567” "Subject: $1 $2"

In the custom message area of notifications on a switch I have this for "On":

Code: Select all

script://notify.sh  "Hello" "World"


Nothing happens when the switch is turned on...Can somebody explain exactly how to get this set up?


Thanks in advance.
theolsen
Posts: 46
Joined: Wednesday 31 July 2013 11:15
Target OS: -
Domoticz version:
Contact:

Re: iMessage Notification

Post by theolsen »

A moment of clarity and it is now sorted!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest