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)
rtsp://username:password@ipaddress/PSIA/Streaming/Channels/101
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)
http://kodi_ip_address:8080/jsonrpc?request={“jsonrpc”:“2.0”,“method”:“Player.Open”,“params”:{“options”:{“shuffled”:false,“repeat”:“off”},“item”:{“file”:“special://profile/playlists/video/cam1.m3u”}},“id”:“1”}
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)
shell_command:
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"
trigger:
platform: state
entity_id: binary_sensor.fibaro_system_fgbs001_universal_binary_sensor_sensor_6_0
to: 'off'
action:
- service: shell_command.cam1_on_kodi
Every time the doorbell is pushed, the camera stream opens fullscreen in Kodi…