Pop-up your security cam on Kodi

This is how i show a pop-up of my camera on Kodi:

Step 1
Install the Surveillance Room add-on from here by downloading the zip.
There are also instructions on this page on how to set it up. (it also shows remote commands you can use and it gives an example on how to bind the camera view to one of your remote’s buttons.

Step 2
This is what i did to be able to call a live preview from Home Assistant.
Make sure you have the webserver in Kodi enabled.
On my rpi 2 which is running Home Assitant i installed xbmc-eventclients with:
sudo apt-get install xbmc-eventclients-xbmc-send

Now you should be able by using the command line to show a preview of your camera on Kodi with this command:

ssh kodi_username@kodi_ip_address 'xbmc-send -a "XBMC.RunPlugin(plugin://plugin.video.surveillanceroom?action=show_preview&camera_number=1)"'

When you used the right username and ip adress as set in the Kodi webserver part you should see your camera being displayed for a few seconds. Or if you have setup an password on Kodi it wil asks for your password before sending the command. I have a password setup so i did have to do step 3.

Step 3
There might be easier ways to send the command to kodi then by ssh into Kodi but i didn’t managed to get it to work.
So to go around the password prompt i logged in to the venv where my home assistant installation is and i did run the following commands which makes home assitant doesn’t need a password when sending the command:

ssh-keygen

ssh-copy-id [email protected]

In the command above i entered the username and ipaddress of the Kodi installation.

Step 4
When using the command below in the shell_command it gives me a yaml error. I think because of all the ‘’’’
So i created a text file with the command in it and called that from the shell_command in Home Assistant.

ssh kodi_username@kodi_ip_address 'xbmc-send -a "XBMC.RunPlugin(plugin://plugin.video.surveillanceroom?action=show_preview&camera_number=1)"'

config.yaml:

shell_command:
  show_cam: 'sh /home/pi/textcommands/cam.txt'

So now you can trigger this command on motion or your doorbell or whatever you want :slight_smile:.

When i the command one it won’t always trigger so i send the command two times with one sec delay so it is always triggered.

For Foscam camera’s is more support built in, but i don’t have one so i couldn’t test any of these features.

6 Likes

ABSOLUTELY COOL!! got it running finally :slight_smile:

Glad you like it :slight_smile:

I am getting error " xbmc-eventclients-xbmc-send : Depends: xbmc-eventclients-common (= 2:13.2+dfsg1-4)
E: Unable to correct problems, you have held broken packages." while installing the package. I have installed “xbmc-eventclients-common is already the newest version.” Any ideas

Here is a way of doing this via a shell command without have to install the xbmc-send. The first line brings up the preview window and the second takes the movie back to full screen.

curl -i -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"wait":false,"addonid":"plugin.video.surveillanceroom","params":{"action":"show_preview","camera_number":"1","id":"1"}},"id":2}' http://192.168.1.20:8080/jsonrpc

curl -i -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": "toggle" }, "id": "1"}' http://192.168.1.20:8080/jsonrpc
1 Like

Thanks @Mister-Espria. I now have this working to popup a 20 sec preview in my theater. I am using the line cross detection sensor feature of the Hikvision component when someone comes to my front door as well as when there is movement in my daughter’s room at night.

https://community.home-assistant.io/t/hikvision-event-stream-sensors

Thanks for this, I had to modify the “action” value it to get it to work on mine, as:

curl -i -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"wait":false,"addonid":"plugin.video.surveillanceroom","params":{"action":"single_camera&camera_number=1"}}}' http://192.168.178.71:8080/jsonrpc

There’s also the other option:

"action":"all_cameras"

If there’s anyone like myself who is using motion for their security cams, the settings I found best are to choose MJPEG for all the source types. Also the plugin expects full addresses not just an IP, e.g.

http://192.168.1.1:8081

I love coming to this board, I’ve wanted to get Kodi to do this for ages!

Thanks to all :slight_smile:

Does that show the preview or the single camera full screen? The preview one pops ups and allows your movie to continue.

The “action”:“all_cameras” gives the preview pop-up, and the other setting is the single camera full screen.

Hey guys newbie here. im using a different app called securitycam. i have my doorbell hooked up to my Vera home security. when someone presses the doorbell, I’d like kodi to execute the security cam plugin. this will give a 15 second overlay of a small window of my door security cam even while watching a movie. the Vera will call a Wget URL
what do i do to call the security cam app?

http://192.168.0.123:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"plugin.script.securitycam"}}

the app shouldn’t take any params
any help would be nice

thanks

I figured it out
http://192.168.0.123:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.securitycam"},"id":"1"}}

3 Likes

Hey guys. Need your assistance. Working perfect from browser:

http://127.0.0.1:8089/jsonrpc?request={“jsonrpc”:“2.0”,“method”:“Addons.ExecuteAddon”,“params”:{“wait”:false,“addonid”:“plugin.video.surveillanceroom”,“params”:{“action”:“show_preview”,“camera_number”:“1”,“id”:“1”}},“id”:2}

However, in shell with:

curl -i -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc”:“2.0”,“method”:“Addons.ExecuteAddon”,“params”:{“wait”:false,“addonid”:“plugin.video.surveillanceroom”,“params”:{“action”:“single_camera&camera_number=1”}}}’ http://127.0.0.1:8089/jsonrpc

I get:

HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Type: application/json
Content-Length: 76
Cache-Control: private, max-age=0, no-cache
Accept-Ranges: none
Date: Fri, 10 Feb 2017 17:29:50 GMT

{“error”:{“code”:-32700,“message”:“Parse error.”},“id”:null,“jsonrpc”:“2.0”}

Could anyone help me to fix it? TIA

you are missing the id:2 section. try last line as
{“action”:“single_camera&camera_number=1”}}“id”:2}’ http://127.0.0.1:8089/jsonrpc

Thanks for the help. I did modify this just a little by putting into an .sh file and then I call it from a shell_command with alexa

curl -i -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc”:“2.0”,“method”:“Addons.ExecuteAddon”,“params”:{“wait”:false,“addonid”:“script.securitycam”}}’ ‘http://192.168.1.55:8096/jsonrpc

I am testing this command in ssh.
It works. But he does not pause the movie and takes me to the addon screen. It does not display only the preview.

curl -i -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"wait":false,"addonid":"plugin.video.surveillanceroom","params":{"action":"show_preview","camera_number":"1","id":"1"}},"id":2}' http://192.168.1.20:8080/jsonrpc

Now when I try to install xbmc-eventclients with

sudo apt-get install xbmc-eventclients-xbmc-send

I get the msg:

sudo apt command not foud

I just wanted to display the preview without changing the screen. Pause I do HA.

So I created a file “cam.txt”

I’m trying to call it by the following shell_command

show_cam: 'ssh /home/textcommands/cam.txt'

I get this error.

Error running command: `ssh / home / textcommands / cam.txt`, return code: 255
21:50 /usr/lib/python3.6/site-packages/homeassistant/components/shell_command.py (ERROR)

I have tried only “sh”

Error running command: sh /home/textcommands/cam.txt, return code: 2
22:02 /usr/lib/python3.6/site-packages/homeassistant/components/shell_command.py (ERROR)

help please!

Could you give me more information the way you’re calling shell_command?

sorted out. It was enough to change the location of the file.
and put bash in front of the sh path.

Now one thing … it would be better if it were not for addon screen … Just show the preview. It’s possible ?

It’s coming out of the movie screen! Ideally it was only to show the preview.