I’ve just noticed Kodi is not able to play_media, but that would be great to have (our favorite media player) Kodi with similar features like Chromecast (as seen in the Docs).
Have this online video in case you need it for testing that feature:
Thanks,
H
I was suggested by robbiet480 to fix this by my self, so I’ve accepted the challenge and then started reading (for future reference):
h**ps://github.com/balloob/home-assistant/blob/dev/homeassistant/components/media_player/kodi.py
h**p://kodi.wiki/view/JSON-RPC_API/v6#Player.Open
h**p://forum.kodi.tv/showthread.php?tid=167175
h**ps://github.com/gerold-penz/python-jsonrpc/issues/30
h**p://forum.kodi.tv/showthread.php?tid=157996
So I’ve managed to make it work with these changes:
https://github.com/hmronline/home-assistant/tree/kodi_play_media
You can test it with this config:
`
automation:
alias: ‘Play Rain Lullaby’
trigger:
platform: state
entity_id: input_select.lullaby
to: “Rain”
action:
service: media_player.play_media
data:
entity_id: media_player.kodi_test
media_content_id: “Downloads/”
media_content_type: “directory”
`
Of course you will need some media files in your Downloads directory.
Please someone test it.
Thanks,
H
rmdejonge
(Rmdejonge)
June 30, 2016, 10:49am
3
What are the changes? I like to know it. The link is not working anymore. https://github.com/hmronline/home-assistant/tree/kodi_play_media
hmronline:dev
← home-assistant:dev
opened 09:18PM - 29 Apr 16 UTC
it is already in the code so he is basically saying test it in your config.
automation:
- alias: 'Play Rain Lullaby'
trigger:
platform: state
entity_id: input_select.lullaby
to: "Rain"
action:
service: media_player.play_media
data:
entity_id: media_player.kodi_test
media_content_id: "Downloads/"
media_content_type: "directory"
rmdejonge
(Rmdejonge)
June 30, 2016, 11:57am
5
thanks a lot! I going to test it now, i let you know (Y)
Yes, it is working! Thanks for your support Dennissaion!
This is my config for the part to play media_play.kodi. Maybe someone have something on this information:
alias: Kodi test
trigger:
platform: state
entity_id: 'input_boolean.enable_playlist'
to: 'on'
action:
service: media_player.play_media
data:
entity_id: media_player.kodi
media_content_id: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
media_content_type: "video/mp4"
1 Like
Kodi has a feature where I can have the following commands in a file called autoexec.py and it automatically starts playing a folder on startup.
Can I use this command through HA?
import xbmc
import time
time.sleep(5)
xbmc.executebuiltin("PlayerControl(Random)")
xbmc.executebuiltin("PlayMedia(/storage/music,isdir)")
xbmc.executebuiltin("PlayerControl(RepeatAll)")