Page 1 of 4
XBMC notify
Posted: Wednesday 13 August 2014 21:37
by Raspberry Piet
Made this little script to use in my Domoticz scripts:
xbmc_notify.sh
Code: Select all
#!/bin/sh
################################################
# Settings
title=$1
message=$2
image=$3
user="xbmc"
pw="password"
port="8080"
time=15000
#################################################
# XBMC PC
(wget -O /dev/null "http://$user:[email protected]:$port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$time},%22id%22:1}" >/dev/null 2>&1) &
# XBMC Projector
(wget -O /dev/null "http://$user:[email protected]:$port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$time},%22id%22:1}" >/dev/null 2>&1) &
# XBMC TV
(wget -O /dev/null "http://$user:[email protected]:$port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$time},%22id%22:1}" >/dev/null 2>&1) &
Change settings and IP addresses
Invoke this script like:
Code: Select all
xbmc_notify.sh "Title" "Message" "http://URL-to-picture"
Example:
Code: Select all
xbmc_notify.sh " - Brievenbus - " "Er is nieuwe post bezorgd" "http://c.fsdn.com/allura/p/domoticz/icon"

XBMC notify
Posted: Wednesday 13 August 2014 22:06
by D'rMorris
Awesome! I'm busy with a script from XBMC to domoticz to set the playing / paused / stopped states of XBMC.
I know the X10 commander plug-in for XBMC can do that, but I found that the switch is not always triggered when I stop playback.
Also, I'm trying to keep everything in 1 language. Either bash or lua, preferably not mixed.
Re: XBMC notify
Posted: Wednesday 13 August 2014 22:31
by pvm
Gave it a try, nice
Re: XBMC notify
Posted: Friday 15 August 2014 15:29
by roblom
Nice!
XBMC notify
Posted: Friday 15 August 2014 18:17
by HoLeeShiet
Nice! I was already using this to get camera into Xbmc and it worked pretty good!
http://homeawesomation.wordpress.com/20 ... mc-update/
I tried to figure out how to combine the scripts but didn't succeed. But if someone could integrate with your script it would be very nice!
Re: XBMC notify
Posted: Friday 15 August 2014 19:33
by Raspberry Piet
HoLeeShiet wrote:Nice! I was already using this to get camera into Xbmc and it worked pretty good!
http://homeawesomation.wordpress.com/20 ... mc-update/
I tried to figure out how to combine the scripts but didn't succeed. But if someone could integrate with your script it would be very nice!
That would be nice indeed.
I remember i read a post on this forum a while ago:
http://www.domoticz.com/forum/viewtopic ... 21&t=1338&
Will have a look at it later.
Edit:
Installed this addon for xbmc:
http://forum.xbmc.org/showthread.php?tid=182540
Fill in the image url in the setting of this addon
eg
Code: Select all
http://192.168.1.17:8080/camsnapshot.jpg?idx=1
^ (ipcam added to Domoticz)
Changed my
xbmc_notify.sh a little:
Code: Select all
#!/bin/sh
################################################
# Settings
snapshot=$1
title=$2
message=$3
image=$4
user="xbmc"
pw="password"
port="8080"
time=15000
#################################################
# Check IP-Cam Status
if ping -c 1 192.168.1.24 > /dev/null ; then
echo "IP-Cam Online"
else
snapshot=0
fi
#################################################
# XBMC PC
if ping -c 1 192.168.1.10 > /dev/null ; then
(wget -O /dev/null "http://$user:[email protected]:$port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$time},%22id%22:1}" >/dev/null 2>&1) &
fi
# IPCAM SNAPSHOT to XBMC PC
if [ $snapshot -eq 1 ] && ping -c 1 192.168.1.10 > /dev/null ; then
(wget -O /dev/null "http://$user:[email protected]:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22}}") &
fi
#################################################
# XBMC Projector
if ping -c 1 192.168.1.12 > /dev/null ; then
(wget -O /dev/null "http://$user:[email protected]:$port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$time},%22id%22:1}" >/dev/null 2>&1) &
fi
# IPCAM SNAPSHOT to XBMC Projector
if [ $snapshot -eq 1 ] && ping -c 1 192.168.1.12 > /dev/null ; then
(wget -O /dev/null "http://$user:[email protected]:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22}}") &
fi
#################################################
# XBMC TV
if ping -c 1 192.168.1.23 > /dev/null ; then
(wget -O /dev/null "http://$user:[email protected]:$port/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$time},%22id%22:1}" >/dev/null 2>&1) &
fi
# IPCAM SNAPSHOT to XBMC TV
if [ $snapshot -eq 1 ] && ping -c 1 192.168.1.23 > /dev/null ; then
(wget -O /dev/null "http://$user:[email protected]:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22}}") &
fi
If you want to send a snapshot by this script:
Code: Select all
xbmc_notify.sh "1" " - Brievenbus - " "Er is nieuwe post bezorgd" "http://c.fsdn.com/allura/p/domoticz/icon"
Else change 1 to something different like 0
Code: Select all
xbmc_notify.sh "0" " - Brievenbus - " "Er is nieuwe post bezorgd" "http://c.fsdn.com/allura/p/domoticz/icon"
Re: XBMC notify
Posted: Saturday 06 September 2014 19:25
by Heisenberg
Hi,
I want to try to integrated the security cam script with my Doorbell.sh but couldn't get the camera feed in XBMC (Gotham).
Telegram does work and send a snapshot to my phone correctly if doorbell is pushed.
Also in XBMC when I click the security cam add-on it shows the camera feed without problems.
So i think it must be in the code below but I can't figure it out. Maybe someone here can point me in the right direction?
Code: Select all
#!/bin/sh
#Settings
today=$(date)
#############################################################
# XBMC Slaapkamer
(wget -O /dev/null "http://xbmc:[email protected]:8088/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message$
# Check if ip-cam is up:
if ping -c 1 $IP > /dev/null
then
# Telegram sends msg if ping successful.
/home/pi/scripts/Telegram.sh msg Heisenberg "Er is aangebeld op $today!"
# Telegram takes snapshot if ping successful:
/usr/bin/curl -s http://admin:[email protected]:9922/Streaming/channels/1/picture > /tmp/snapshot.jpg
# Telegram sends snapshot to the following recipient(s):
/home/pi/scripts/Telegram.sh send_photo Heisenberg /tmp/snapshot.jpg
# Delete snapshot:
/bin/rm /tmp/*.jpg
else
/home/pi/scripts/Telegram.sh msg Heisenberg " Camera $IP is offline."
fi
Re: XBMC notify
Posted: Saturday 06 September 2014 22:51
by Raspberry Piet
Heisenberg wrote:
Code: Select all
#!/bin/sh
#############################################################
# XBMC Slaapkamer
(wget -O /dev/null "http://xbmc:[email protected]:8088/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message$
Why don't invoke the xbmc_notify.sh script inside your own script?
Code: Select all
#!/bin/sh
#############################################################
# XBMC Slaapkamer
/home/pi/domoticz/scripts/bash/xbmc_notify.sh "1" " - Deurbel - " "Er wordt aangebeld" "http://c.fsdn.com/allura/p/domoticz/icon"
Re: XBMC notify
Posted: Sunday 07 September 2014 8:53
by Heisenberg
Thnx Raspberry Piet! I invoke the xbmc_notify.sh script inside my script and it works!
Another question is if it's possible to pause a movie when the xbmc_notify script is activated.
(e.g. If someone is at the door and the photo slides in, movie should pause, and when photo slides out XBMC resumes to play movie).
Re: XBMC notify
Posted: Sunday 07 September 2014 13:44
by Raspberry Piet
Heisenberg wrote:Thnx Raspberry Piet! I invoke the xbmc_notify.sh script inside my script and it works!
Another question is if it's possible to pause a movie when the xbmc_notify script is activated.
(e.g. If someone is at the door and the photo slides in, movie should pause, and when photo slides out XBMC resumes to play movie).
You can add to your script:
Code: Select all
#!/bin/sh
#############################################################
# XBMC Slaapkamer
/home/pi/domoticz/scripts/bash/xbmc_notify.sh "1" " - Deurbel - " "Er wordt aangebeld" "http://c.fsdn.com/allura/p/domoticz/icon"
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"Player.PlayPause","params":{"playerid":1}}' http://xbmc:[email protected]:8088/jsonrpc
Or you might want to choose the stop command instead of the play/pause toggle command:
Code: Select all
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"Player.Stop","params":{"playerid":1}}' http://xbmc:[email protected]:8088/jsonrpc
Re: XBMC notify
Posted: Monday 08 September 2014 15:22
by Heisenberg
Great! It works!
Re: XBMC notify
Posted: Friday 17 October 2014 21:41
by Raspberry Piet
Changed my xbmc_notify script a little.
Works better for me. Does'nt lock things when invoking xbmc_notify via other scripts. (Tnx Heisenberg for testing)
xbmc_notify.sh
Code: Select all
#!/bin/sh
snapshot=$1
title=$2
message=$3
image=$4
################################################
# Settings
TIME="15000" # Time the notification is displayed
USER="xbmc"
PW="xbmc"
PORT="8080"
XBMC1_IP="192.168.1.10" #XBMC PC
XBMC2_IP="192.168.1.12" #XBMC Projector
XBMC3_IP="192.168.1.23" #XBMC TV
CAM_IP="192.168.1.24"
#################################################
# Check IP-Cam Status
if ping -c 1 $CAM_IP > /dev/null ; then
echo "IP-Cam ($CAM_IP) Online"
else
echo "IP-Cam Offline"
snapshot=0
fi
#################################################
# Check XBMC1 Status
nc -w 1 $XBMC1_IP $PORT
if [ $? -eq 0 ] ; then
echo "XBMC1 ($XBMC1_IP) Online"
xbmc1=1
else
echo "XBMC1 Offline"
xbmc1=0
fi
# XBMC1
if [ $xbmc1 -eq 1 ] && [ $snapshot -eq 0 ]; then
(wget -O /dev/null "http://$USER:$PW@$XBMC1_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$TIME},%22id%22:1}" >/dev/null 2>&1) &
elif [ $xbmc1 -eq 1 ] && [ $snapshot -eq 1 ]; then
# IPCAM SNAPSHOT to XBMC1
(wget -O /dev/null "http://$USER:$PW@$XBMC1_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$TIME},%22id%22:1}" >/dev/null 2>&1) &
(wget -O /dev/null "http://$USER:$PW@$XBMC1_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22}}")
fi
#####################################################################################################################################################################################################################################################
# Check XBMC2 Status
nc -w 1 $XBMC2_IP $PORT
if [ $? -eq 0 ] ; then
echo "XBMC2 ($XBMC2_IP) Online"
xbmc2=1
else
echo "XBMC2 Offline"
xbmc2=0
fi
# XBMC2
if [ $xbmc2 -eq 1 ] && [ $snapshot -eq 0 ]; then
(wget -O /dev/null "http://$USER:$PW@$XBMC2_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$TIME},%22id%22:1}" >/dev/null 2>&1) &
elif [ $xbmc2 -eq 1 ] && [ $snapshot -eq 1 ]; then
# IPCAM SNAPSHOT to XBMC2
(wget -O /dev/null "http://$USER:$PW@$XBMC2_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$TIME},%22id%22:1}" >/dev/null 2>&1) &
(wget -O /dev/null "http://$USER:$PW@$XBMC2_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22}}")
fi
#####################################################################################################################################################################################################################################################
# Check XBMC3 Status
nc -w 1 $XBMC3_IP $PORT
if [ $? -eq 0 ] ; then
echo "XBMC3 ($XBMC3_IP) Online"
xbmc3=1
else
echo "XBMC3 Offline"
xbmc3=0
fi
# XBMC3
if [ $xbmc3 -eq 1 ] && [ $snapshot -eq 0 ]; then
(wget -O /dev/null "http://$USER:$PW@$XBMC3_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$TIME},%22id%22:1}" >/dev/null 2>&1) &
elif [ $xbmc3 -eq 1 ] && [ $snapshot -eq 1 ]; then
# IPCAM SNAPSHOT to XBMC3
(wget -O /dev/null "http://$USER:$PW@$XBMC3_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22$title%22,%22message%22:%22$message%22,%22image%22:%22$image%22,%22displaytime%22:$TIME},%22id%22:1}" >/dev/null 2>&1) &
(wget -O /dev/null "http://$USER:$PW@$XBMC3_IP:$PORT/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22}}")
fi
#####################################################################################################################################################################################################################################################
Re: XBMC notify
Posted: Sunday 17 May 2015 8:53
by Dnpwwo
Native Kodi notifications have been added to the Beta version from build 2448 onwards, tested against Kodi Helix.
By default it will multi-cast to all Kodi's on the local network (or you can target one specifically). Just enable it under Settings\Notifications and hit 'Test'. If you have a complicated network you may need to bump the number of 'Hops' so that the notification will go further.
Re: XBMC notify
Posted: Sunday 17 May 2015 10:43
by jin
Great great new feature! Just tested and works like a charm and out of the box via multicast!!!
Thank you very much Dnpwwo and Gizmocuz!
Re: XBMC notify
Posted: Sunday 17 May 2015 10:56
by chimit
I think one could even use the custom http notification settings for this.
Re: XBMC notify
Posted: Sunday 17 May 2015 11:05
by Dnpwwo
Technical users probably could (not sure about updating multiple devices that way (I have 3))
This is actually the first step of making Domoticz Kodi aware, next step will be to push the icons of the device itself, then add it as a supported device to save people writing bash scripts for detecting if they are on and what they are doing etc.
Baby steps dude, I don't get much dev time.
Re: XBMC notify
Posted: Sunday 17 May 2015 11:23
by Raspberry Piet
Thanks Dnpwwo for implement it in Domoticz!
Multicast works except for one of my (3) Kodi machines. (have to investigate the cause)
Awesomeness would be complete if Domoticz could trigger the
Security CAM Overlay add-on natively.

Re: XBMC notify
Posted: Sunday 17 May 2015 11:46
by Dnpwwo
Try bumping the 'Hops' count. Every time a multicast goes through a switch it decrements this counter (which is technically the TTL parameter) and drops the broadcast when it hits zero.
I needed to set Hops to '2' for one of my mine to work because it went through a switch and a hub.
Haven't decided on a target feature set because I'm still working through what is possible (I'm quite new to Kodi) . I can certainly see the value in streaming one or more images to one. Is there a way of doing it without installing an add-in?
Re: XBMC notify
Posted: Sunday 17 May 2015 11:55
by Raspberry Piet
Dnpwwo wrote:Try bumping the 'Hops' count. Every time a multicast goes through a switch it decrements this counter (which is technically the TTL parameter) and drops the broadcast when it hits zero.
I needed to set Hops to '2' for one of my mine to work because it went through a switch and a hub.
Tried that but no joy. Will investigate further later.
Dnpwwo wrote:Haven't decided on a target feature set because I'm still working through what is possible (I'm quite new to Kodi) . I can certainly see the value in streaming one or more images to one. Is there a way of doing it without installing an add-in?
Without installing an add-in i think that would not be possible. (at least not that i know of)
The security cam overlay add-on works very nice. (how to trigger see my script somewhere in this thread)
Re: XBMC notify
Posted: Sunday 17 May 2015 21:24
by Brutus
I saw this nice new feature been added to one of the latest releases.
So I updated my Windows Installation to version: V2.2456
When I leave the settings default and enable the Kodi Notification then enter different numbers and hit the test button nothing comes up.
When I enter the IP adres of my only Kodi server: 192.168.1.5 still nothing.
What can be wrong.
Are there some settings to be made in Kodi?
Thnx for any help.