Kodi Mediaserver Support

Moderator: leecollings

User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Kodi Mediaserver Support

Post by Egregius »

Since I have the Greenwave 6 plug my Kodi power supply is also on it.
I activate the power by scene 'Watch Kodi', wich put the TV on, set the amplifier to te desired input, switch power to Kodi, set some lights, wake the nas etc.
The Kodi itself is set to auto shutdown after 10 minutes of inactivity.
When the Kodi switch is on I poll the port of Kodi API to see when it's offline to switch the power off.

Code: Select all

if($Skodi=='On'&&$STkodi<$driemin) {
	$status = pingDomain('192.168.0.7', 1597);
	if(is_int($status)) Schakel($SIkodi, 'Off','kodi');
}
function pingDomain($domain, $port){
    $starttime = microtime(true);
    $file      = fsockopen ($domain, $port, $errno, $errstr, 1);
    $stoptime  = microtime(true);
    $status    = 0;
    if (!$file) $status = -1;  // Site is down
    else {
        fclose($file);
        $status = floor(($stoptime - $starttime) * 1000);
    }
    return $status;
}
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Kodi Mediaserver Support

Post by Derik »

Some one got kodi server working with a extern BT speaker...
Like a sonos idea...
Stil run Kodi, and this is a extreme media player..☺

Looks that it must be possible to make a cheap sonos like, icm whit domoticz
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by Brutus »

Is there a reason why we can only use "Smart Playlists" ? (https://www.domoticz.com/wiki/Kodi)
I just want to enable one stream within a RadioStream.m3u

Then use it with lua to activate it:

commandArray['Kodi TV Woonkamer'] = 'Play Playlist RadioStream'

I can't get any streaming URL in a Smart Playlist.

Can you make it possible to call a normal playlist Dnpwwo?
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
EBOOZ
Posts: 11
Joined: Wednesday 30 December 2015 9:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8153
Contact:

Re: Kodi Mediaserver Support

Post by EBOOZ »

I can't get Kodi to work for 100%. The remote control does work, because I can change the volume for example. However, the status of Kodi is not reported :? Domoticz is running version V2.3867.

I'm running Kodi 15.2 on Windows 10 Enterprise. Something else is using port 9090, so I was forced to use another port. The port change was successful and as said before I can control Kodi in Domoticz by using the remote control. When I telnet to the Windows machine on port 9999 and enter {"jsonrpc":"2.0","method":"JSONRPC.Ping","id":1} is also get a Pong as a result.

The first thing that triggers me that something is going wrong is the following error message when changing the port of the Kodi device and clicking save: Error: Kodi: (Kodi Woonkamer) Async Read Exception: 125, Operation canceled

I've attached both logfiles. Hopefully somebody can put me in the right direction.
Attachments
kodi.log
(196.58 KiB) Downloaded 85 times
domoticz_kodi.log
(4.04 KiB) Downloaded 76 times
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Kodi Mediaserver Support

Post by Dnpwwo »

@Brutus, smart playlists seem to be the only thing available through the API (have a look if you like http://kodi.wiki/view/JSON-RPC_API/v6 to see if I missed something). My initial intention was to support m3u and the like but couldn't find a practical way to do it. As always, there is limited documentation.

Fron what I read I couldn't see any reason why streams wouldn't work though. I assume you have a working .strm file that has the URL in it, you should be able to create a 'rule' that picks it up in a Smart Playlist.

@EBOOZ, that looks very strange. Don't worry about the 'Operation Cancelled', its just a generic socket error and no big deal if it is a once off. Probably caused by the Kodi closing the port.

This suggests that the connection is being made and the messages are being accepted but that Domoticz isn't 'seeing' the responses.

I would suggest changing the 'advancedsettings.xml' compactout setting to be 'true' (the default) and let me know if that changes anything. Domoticz is expecting compact messages (althought I would have thought that it would accept 'pretty' ones as well) :?
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by Brutus »

Dnpwwo wrote:@Brutus, smart playlists seem to be the only thing available through the API (have a look if you like http://kodi.wiki/view/JSON-RPC_API/v6 to see if I missed something). My initial intention was to support m3u and the like but couldn't find a practical way to do it. As always, there is limited documentation.

Fron what I read I couldn't see any reason why streams wouldn't work though. I assume you have a working .strm file that has the URL in it, you should be able to create a 'rule' that picks it up in a Smart Playlist.
Thank you for your reply.

I had made the .m3u file and included a streaming URL. But I can't import it with any logical rule in the Smart playlist. With the .strm file I have the same problem. So the way I see it, it isn't possible to add a stream in a smart playlist.

The problem I think is that the stream won't be added in the library. When adding it manual (right click and "add manual to library") I can't find it with the search option. So the smart playlist will also not find it.

Looking at the JSON-RPC API isn't it possible to use the "Player.Open" option? (http://kodi.wiki/view/JSON-RPC_API/v6#Player.Open).

5.9.6 Player.Open
Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database.

"Single file" could be a simple playlist or stream file?

EDIT: I have tested this my self :) I was pretty excited to get it working. Never done this before. Here is a working link to start a .m3u playlist:

Code: Select all

http://192.168.1.5/jsonrpc?request={"jsonrpc":"2.0","id":"1","method":"Player.Open","params":{"item":{"file":"special://profile/playlists/music/Radio538Stream.m3u"}}}
The Favorite option in KODI can't we use that? Its easy to make Favorites. Its mentioned in the Namespace but thats it: (http://kodi.wiki/view/JSON-RPC_API/v6#Namespaces)

Thnx again for thinking with me.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Kodi Mediaserver Support

Post by Dnpwwo »

Interesting. I've looked at the Favourites namespace before but it is not documented in the API at all (just mentioned under namespaces).

Searching the internet for "Favourites.GetFavourites" gave some details and I had a look at the Kodi source on github. The request

Code: Select all

{ "jsonrpc": "2.0", "method": "Favourites.GetFavourites", "params": { "properties": ["path"] }, "id": 1 }
seemed to give the best results.

Code: Select all

{"id":1,"jsonrpc":"2.0",
	"result":{
		"favourites":
			[
				{
					"title":"The Cars.m3u",
					"type":"window"
				},
				{
					"path":"smb://192.168.xxx.xxx/Music/Folders/Elvis Costello/This Year's Model/02 This Year's Girl.mp3",
					"title":"02. Elvis Costello - This Year's Girl",
					"type":"media"
				},
			],
		"limits":{"end":2,"start":0,"total":2}
	}
}
Worryingly playlists don't return a path (even though they appears to be 'playable' from your post) but otherwise it seems quite functional and seems to be being actively maintained in the code base so is probably not deprecated.

I'll have a play with this when I get some time.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
EBOOZ
Posts: 11
Joined: Wednesday 30 December 2015 9:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.8153
Contact:

Re: Kodi Mediaserver Support

Post by EBOOZ »

Dnpwwo wrote:@EBOOZ, that looks very strange. Don't worry about the 'Operation Cancelled', its just a generic socket error and no big deal if it is a once off. Probably caused by the Kodi closing the port.

This suggests that the connection is being made and the messages are being accepted but that Domoticz isn't 'seeing' the responses.

I would suggest changing the 'advancedsettings.xml' compactout setting to be 'true' (the default) and let me know if that changes anything. Domoticz is expecting compact messages (althought I would have thought that it would accept 'pretty' ones as well) :?
I knew it would be that easy :geek: Changing compact output to true solved the issue. Thanks!
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by Brutus »

Dnpwwo wrote:Interesting. I've looked at the Favourites namespace before but it is not documented in the API at all (just mentioned under namespaces).

Searching the internet for "Favourites.GetFavourites" gave some details and I had a look at the Kodi source on github. The request

Code: Select all

{ "jsonrpc": "2.0", "method": "Favourites.GetFavourites", "params": { "properties": ["path"] }, "id": 1 }
seemed to give the best results.

Code: Select all

{"id":1,"jsonrpc":"2.0",
	"result":{
		"favourites":
			[
				{
					"title":"The Cars.m3u",
					"type":"window"
				},
				{
					"path":"smb://192.168.xxx.xxx/Music/Folders/Elvis Costello/This Year's Model/02 This Year's Girl.mp3",
					"title":"02. Elvis Costello - This Year's Girl",
					"type":"media"
				},
			],
		"limits":{"end":2,"start":0,"total":2}
	}
}
Worryingly playlists don't return a path (even though they appears to be 'playable' from your post) but otherwise it seems quite functional and seems to be being actively maintained in the code base so is probably not deprecated.

I'll have a play with this when I get some time.
Nice that you see the potential in it to :)

Hopefully we will see a relaese in the future with the code working.
For now I am trying to enable the code with a Curl command in a LUA script.

My return for the favorite request:

Code: Select all

{"id":1,"jsonrpc":"2.0","result":{"favourites":[{"path":"plugin://plugin.audio.tuneinradio/?logo=http%3A%2F%2Fcdn-radiotime-logos.tunein.com%2Fs6712q.png&id=s6712&name=102.1+%7C+Radio+538+%28Top-40-Pop%29&path=tune","title":"102.1 | Radio 538 (Top-40-Pop)","type":"media"}],"limits":{"end":1,"start":0,"total":1}}}
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Kodi Mediaserver Support

Post by Dnpwwo »

Added Favorite support, will be in the next Beta. Usage from Lua is documented here: http://www.domoticz.com/wiki/Kodi#Event ... ifications.

Works for music and video, haven't tried plugins but anything with a 'path' should work. If you try to play something without a 'path' it will play the next item that does have one.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by Brutus »

Dnpwwo wrote:Added Favorite support, will be in the next Beta. Usage from Lua is documented here: http://www.domoticz.com/wiki/Kodi#Event ... ifications.

Works for music and video, haven't tried plugins but anything with a 'path' should work. If you try to play something without a 'path' it will play the next item that does have one.
Hi Dnpwwo,

Thank you for this update. I have installed the Windows Beta version to test this :) (http://www.domoticz.com/releases/beta/d ... latest.zip)
It works perfect 8-)

Greetings Brutus.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
fantom
Posts: 269
Joined: Thursday 26 March 2015 10:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Kodi Mediaserver Support

Post by fantom »

salvation wrote:
cjnicholl wrote:I have just rebuilt my server after a crash and am having problems with the latest Kodi Mediaserver (the old version worked fine).
Kodi is the latest version of OpenElec.
2015-09-29 12:14:29.564 Error: Kodi: (Kodi Living Room) Async Read Exception: 125, Operation canceled
Thanks
I experience comparable troubles on my Kodi instances, also Openelec based. But I it seems that it only occur if I add more than 1 Kodi node to the Kodi Media Server setup. Is it possbile those problems are somehow related to multiple instances?
I have this error too.
What do I doing ?

Fantom
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Kodi Mediaserver Support

Post by Dnpwwo »

I run 3 OpenElec Kodi without issue so I would be surprised if that is the issue.

The wiki covers how to check what is going on (http://www.domoticz.com/wiki/Kodi#Troubleshooting), you will need to post some logs with debugging turned on before I can really help.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Kodi Mediaserver Support

Post by Derik »

Best ...
Has anyone Kodi working with Intel nuc running Windows 10 ?
My management was upset over the corrupt sd cards so I needed something more stable.

In my settings I changed the ip and put the port in 9090 ....
But I still get an error message while pressing the remote kodi

Where do i go wrong..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by Brutus »

Derik wrote:Best ...
Has anyone Kodi working with Intel nuc running Windows 10 ?
My management was upset over the corrupt sd cards so I needed something more stable.

In my settings I changed the ip and put the port in 9090 ....
But I still get an error message while pressing the remote kodi

Where do i go wrong..
Hi Derik,

I have Kodi and Domoticz on a Intel NUC with Windows 10.
The corrupt SD cards and slow speed were also a reason for upgrading to a nice Intel NUC.

You enabled the webserver?
Changed the port to 9090?
Filled in a username and or password?

Enabled both features under Remotecontrol?

Greetings Brutus
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by G3rard »

I can't get the Kodi Media Server up and running.
I have a Nvidia Shield Android TV with Kodi running (installed from Play store). I have Kodi configured to allow control by remote programs.

When I put port -9090 in the settings to allow the logging I get the following messages:

Code: Select all

2016-01-22 00:08:11.899 Kodi: (Kodi kamer) Connect to '192.168.1.139:9090' failed: (111) Connection refused
Anyone an idea how to fix this?
Not using Domoticz anymore
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Kodi Mediaserver Support

Post by Derik »

@ Brutus:

I do have new hardware and sensors enabled
You enabled the webserver? yes

Changed the port to 9090? yes

Filled in a username and or password? no
What do i need to fill in here? [ is there a best option?
By Domoticz hardware for Kodi there is no user and pass. That is the reason i let this blank..

And do you have great features on the Nuc? [ icw Domoticz? ]
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by Brutus »

Derik wrote:@ Brutus:

I do have new hardware and sensors enabled
You enabled the webserver? yes

Changed the port to 9090? yes

Filled in a username and or password? no
What do i need to fill in here? [ is there a best option?
By Domoticz hardware for Kodi there is no user and pass. That is the reason i let this blank..

And do you have great features on the Nuc? [ icw Domoticz? ]
You don't need to change the port at the webserver section to 9090 for remote function in Domoticz. Then you have a double port assignment. So change that port to another port number for example 81 and reboot your computer. This section is pure for the remote apps you can install on your Phone for example.

I have installed Hyper-V to enable a second machine for testing or downloading purpose ;)
I'm making a backup of the Domoticz Backup folder to my NAS every hour through a Batch file.
I have Telegram working under LUA in Windows with the rain prediction for the Netherlands.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Kodi Mediaserver Support

Post by Dnpwwo »

@G3rard,

This looks like a problem at the Kodi end. if you are technical and know what telnet is I would try doing a 'telnet <ip> 9090', I suspect it won't connect either. If it does, try pasting {"jsonrpc":"2.0","method":"JSONRPC.Ping","id":1} and see what happens (the {} are required). Make sure that your Kodi settings line up with http://www.domoticz.com/wiki/Kodi#Kodi_Settings
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Kodi Mediaserver Support

Post by G3rard »

@Dnpwwo, I tried a telnet to <ip> 9090 and that is not working.
Telnet <ip> 8080 is working.
I have followed the instructions on the wiki.

I am not sure if I can open the Kodi xml file on the Nvidia Shield, otherwise I could check if 9090 is configured there.

I also have a Pi with Kodi, will try if that works this evening.
Not using Domoticz anymore
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest