Found a great XBMC addon that is used to setup a security camera as a picture in picture called security camera overlay (guide here for anyone interested).
I want to use motion detection via Blue Iris to trigger the security camera addon which should be straight forward but I am struggling to find a method in Openhab. I can trigger the addon using the JSON post below:
rule "View entry camera on living room XBMC"
when
Item VT_Living_Kodi_ViewEntry received command ON
then
var String command = "/opt/openhab/etc/scripts/kodicam.py 'living_xbmc:8080'"
executeCommandLine(command, 2000)
end
rule "Entry gate opened"
when
Item OU_Entry_Gate changed to OPEN
then
VT_Living_Kodi_ViewEntry.sendCommand(ON)
end
You should still be able to run python scripts on Windows.
I guess it would be nice to build this into the XBMC/Kodi binding but it is not really a core Kodi featue (i.e. is an addon) so it would need to be some generic - Activate Addon action I guess. But then some addons would require parameters etc so it would quickly become a bit tricky.
thank you for uploading your latest script but i still have allot of questions reading this.
where does your script gets the kodi information it needs ? does this come from the openhab.cfg ?
when you say adjust the script you mean i have to input the username and password at the lines
kodiusername = None
kodipassword = None
correct ?
can you please explain what following in your script means.
I have virtual items which I call when I want to display a camera in Kodi (I have multiple Kodi clients so I can show the camera on each one by passing the kodihost).
You will need to also pass your username and password in your rule, or just hard code them in your kodicam.py script.
url = 'http://%s/jsonrpc' % (kodihost) is a simple parameter substitution, which results in; http://living-kodi:8080/jsonrpc
Here is one of my openHAB rules which triggers the script;
rule "View entry camera on living room Kodi"
when
Item VT_Living_Kodi_ViewEntry received command ON
then
var String command = "/opt/openhab/etc/scripts/kodicam.py 'living-kodi:8080'"
executeCommandLine(command, 2000)
end
so if i read this correct you call them on hostname and not by ip adress ?
do you have the xbmc binding installed aswell as the action or only the xmbc binding ?
how can i hard code the username and password ? like i suggested in previous post ? inside the py script ?
i’m running 1.8.3 on a synology station.
before i used the exec binding to use the orignial script i had but the wget command is no longer working for kodi 16.1
thats why i’m searching for a solution
CMD="${WGET} ${PARAMS} http://“
if ! [ “${KODI_USER}” == “” ]; then
CMD=”${CMD}${KODI_USER}“
if ! [ “${KODI_PASS}” == “” ]; then
CMD=”${CMD}:${KODI_PASS}“
fi
CMD=”${CMD}@“
fi
CMD=”${CMD}${KODI_HOST}:${KODI_PORT}/“
if [ “$2” == “ON” ]; then
CMD=”${CMD}${JSON_ON}“
else
CMD=”${CMD}${JSON_OFF}"
fi
rule "View entry camera on living room Kodi"
when
Item XbmcKODI_Frontdoorcam received command ON
then
var String json = "%7B%22jsonrpc%22%3A%222.0%22%2C%22id%22%3A1%2C%22method%22%3A%22Addons.ExecuteAddon%22%2C%22params%22%3A%7B%22addonid%22%3A%22script.securitycam%22%2C%22params%22%3A%7B%22command%22%3A%22activate%22%7D%7D%2C%22id%22%3A1%7D%0D%0A"
sendHttpGetRequest(“http://login:password@ip:port/jsonrpc?request=” + json)
end