Stream Security Camera Fullscreen To Kodi (without Kodi Surveillance Room add-on)

I did this with the following hardware and software:

  • Hikvision DS-2CD2532F-IWS
  • Kodi 17.3 Krypton
  • Home Assistant 47.0 AIO on RPI3

Change Kodi settings:

Go to Settings / Service Settings / Allow remote control from applications on other systems: On

Create a file “cam1.strm” on a share or locally on the Kodi machine and replace with your cameras username, password and ipaddress: (the rtsp url is different for every camera brand and type, you can test this by opening the cam1.strm with VLC player)


Create media source in Kodi:

Go to Videos / Files / Add videos… / Browse / Windows network (SMB) / Select directory with cam1.strm in it

Create Kodi playlist:

Open the newly created media source in the menu videos/directory
Right click cam1.strm and select queue item

The next part was the most difficult part to find out, I didn’t know Kodi had a extra menu on the left. After you queued the file:

Press the left arrow key to open the left side menu
Then select “Go to playlist”
Click Save and enter the playlist name “cam1”

Test playlist in Kodi:

Go to Videos / Playlists / Click cam1.m3u
The camera stream should open fullscreen in Kodi

Test playlist in browser: (change kodi_ip_address)


Test playlist on raspberry commandline: (change kodi_ip_address)

curl -i -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc”:“2.0”,“method”:“Player.Open”,“params”:{“options”:{“shuffled”:false,“repeat”:“off”},“item”:{“file”:“special://profile/playlists/video/cam1.m3u”}},“id”:“1”}’ http://kodi_ip_address:8080/jsonrpc

Adding shell command to configuration.yaml: (change kodi_ip_address)

  cam1_on_kodi: "curl -i -X POST -H \"Content-Type: application/json\" -d '{\"jsonrpc\":\"2.0\",\"method\":\"Player.Open\",\"params\":{\"options\":{\"shuffled\":false,\"repeat\":\"off\"},\"item\":{\"file\":\"special://profile/playlists/video/cam1.m3u\"}},\"id\":\"1\"}' http://kodi_ip_address:8080/jsonrpc"

Trigger shell command in configuration.yaml:

automation doorbell_pushed:
  alias: "Doorbell Pushed"
    platform: state
    entity_id: binary_sensor.fibaro_system_fgbs001_universal_binary_sensor_sensor_6_0
    to: 'off'
    - service: shell_command.cam1_on_kodi

Every time the doorbell is pushed, the camera stream opens fullscreen in Kodi…


This is clever - I’ll be using this at some point!


Great! I have Kodi installed on an Android box. How long will the stream play after doorbell rings?

Absolutely Amazing! Will check this directy for my setup! :slight_smile:

Until you stop it. You could add a delay and stop it with an automation.

bookmarked, thanks a lot.

The preformatted text got messed up…
I fixed it with the triple top quote trick before and after the yaml code

yaml code
with indents

1 Like

thanks @MisterGlass

I managed to get it to call successfully but tried to place a 5 second stop on it in the script.
From the CLI it stops fine, but for some reason in the script, it doesnt stop.

via CLI this works:
curl -i -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "Player.Stop", "params": { "playerid": 1 }, "id": 1}'

vis script this doesnt stop the feed:
cam1_stop_on_kodi: "curl -i -X POST -H \"Content-Type: application/json\" -d '{\"jsonrpc\":\"2.0\",\"method\":\"Player.Stop\",\"params\":{\"playerid\":\"1\"},\"id\":\"1\"}'"

This is my script:

  alias: 'Security: DoorBell Pressed'
    - service: notify.telegram
        title: ""
        message: "prior"
    - service: shell_command.cam1_on_kodi
    - delay:
        seconds: 5
    - service: notify.telegram
        title: ""
        message: "5 secs complete"
    - service: shell_command.cam1_stop_on_kodi
    - service: notify.telegram
        title: ""
        message: "after complete"

What am I missing?

cam1_stop_on_kodi: "curl -i -X POST -H \"Content-Type: 
application/json\" -d 

In the CLI you don’t have double qoutes around the “1” of playerid and id. I have remove these from the shell_command and it stops the stream now. I added the working code.

cam1_stop_on_kodi: "curl -i -X POST -H \"Content-Type: 
application/json\" -d 
1 Like

Confirmed working. Great work with this.

Is it possible to make this work outside of Kodi? e.g. for Chromecast?

1 Like

I’m trying to use the basic idea here to automate playing a playlist. The web remote works fine and the playlist is stored properly. However, when I try to use this command from the browser:


I get the following error:

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

I’m trying to see what is different here other than the obvious file name and IP, but it all looks the same to me. Does the json or path formatting change if the Kodi machine is Windows vs Linux?

EDIT: Of course within 5 seconds of making my post I have a “Eureka” moment and find the issue. In the original post, the forum inserts a click count indicator before the URL actually ends so I stopped copying there; which meant I didn’t finish closing out the }. So if anyone else faces this issue, double check that.

I try:{“jsonrpc”:“2.0”,“method”:“Player.Open”,“params”:{“options”:{“shuffled”:false,“repeat”:“off”},“item”:{“file”:“special://profile/playlists/video/cam1.m3u”}},%E2%80%9Cid%E2%80%9D:%E2%80%9C1%E2%80%9D}

but also with similar error:

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

Any idea? Remote allowed in kodi settings. IP and port is correct (web remote running here).

Anybody? Please help :slight_smile:

I think the json commands changed in the new Kodi version. Try this!{"jsonrpc":"2.0","id":"1","method":"Player.Open","params":{"item":{"file":"special://profile/playlists/video/cam1.m3u"} }}, "id": 1}
1 Like

YES, this works! Thank you so much!

curl -i -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc":“2.0”,“id”:“1”,“method”:“Player.Open”,“params”:{“item”:{“file”:“special://profile/playlists/video/cam1.m3u”} }}, “id”: 1}’

curl: (6) Could not resolve host: application
curl: (3) Illegal port number
curl: (3) Illegal port number
curl: (3) Illegal port number
curl: (6) Could not resolve host: ‘“params”:“item”:“file”:“special
curl: (3) Illegal port number
HTTP/1.1 415 Unsupported Media Type
Connection: Keep-Alive
Content-Length: 0
Cache-Control: private, max-age=0, no-cache
Accept-Ranges: none
Date: Thu, 26 Jul 2018 16:20:52 GMT

if I try:
curl -i -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc":“2.0”,“id”:“1”,“method”:“Player.Open”,“params”:{“item”:{“file”:“special://profile/playlists/video/cam1.m3u”} }}, “id”: 1}’

it returns:

Instead of trying to use the shell_command, why not use the media_player.kodi_call_method instead? That is what I do. Though I use AppD, but if I want to say play a YouTube video, I use this instead

self.call_service('media_player/kodi_call_method', entity_id = 'media_player.kodi', method = "Player.Open", item = {"file":"plugin://{}".format(kwargs['stream'])})

Using HA automation, I think it should be something like this

service: media_player.kodi_call_method
   entity: media_player.kodi
   method: Player.Open
   item: {“file”:“special://profile/playlists/video/cam1.m3u”}

I maybe wrong with the HA automation, but try this and it should be easier than the curl stuff.

1 Like
 - service: media_player.kodi_call_method
      entity: media_player.kodi
      method: Player.Open
      item: {"file":"special://profile/playlists/video/cam1.m3u"}

in automations.yaml returns this error:

2018-07-26 17:13:28 ERROR (MainThread) [homeassistant.components.media_player.kodi] Run API method media_player.kodi.Player.Open({‘entity’: ‘media_player.kodi’, ‘item’: OrderedDict([(‘file’, ‘special://profile/playlists/video/cam1.m3u’)])}) error: {‘message’: ‘Invalid params.’, ‘code’: -32602, ‘data’: {‘message’: ‘Too many parameters’, ‘stack’: {‘name’: ‘item’, ‘type’: ‘object’}, ‘method’: ‘Player.Open’}}

Ok try this:

- service: media_player.kodi_call_method
      entity: media_player.kodi
      method: Player.Open

As I said I don’t use this, but you can paste the error and maybe we can figure the rest out.