Page 15 of 18

Re: Kodi Mediaserver Support

Posted: Wednesday 08 February 2017 8:27
by markjgabb
Same as me....

Few questions
Do you enable remote device control on?
Do you use an advanced settings.xml?
If you do have you set a custom tcp port?
If you haven't set one I suggest setting one.... I had to do this to get mine working....

And I see after reading a lot of posts that others have had success doing this.

Re: Kodi Mediaserver Support

Posted: Wednesday 08 February 2017 10:30
by PSYCHOTIC
gielie wrote:I've always used Kodi within Domoticz without any problems but now it doesn't work anymore.

Code: Select all

2017-02-07 22:28:15.286 Kodi: (Huiskamer) Missed 1 pings, assumed off.
2017-02-07 22:28:15.288 Kodi: (Huiskamer) Event: 'Off'.
2017-02-07 22:28:15.304 Kodi: (Huiskamer) Disonnected.
2017-02-07 22:28:16.287 Kodi: (Huiskamer) Connected to '192.168.1.115:8080'.
2017-02-07 22:28:16.289 Kodi: (Huiskamer) Event: 'On'.
2017-02-07 22:28:16.306 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"System.GetProperties","params":{"properties":["canhibernate","cansuspend","canshutdown"]},"id":1007}'
2017-02-07 22:28:17.306 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"JSONRPC.Ping","id":1001}'
2017-02-07 22:28:19.861 Kodi: Restarting I/O service thread.
I've seen a lot of people with this problem but no solutions so far, anyone else with a bright idea?
You need to add the json settings in your advancedsettings.xml i had the same with the openelec distro.

<jsonrpc>
<tcpport>9090</tcpport>
</jsonrpc>

Re: Kodi Mediaserver Support

Posted: Wednesday 08 February 2017 13:58
by gielie
PSYCHOTIC wrote:
gielie wrote:I've always used Kodi within Domoticz without any problems but now it doesn't work anymore.

Code: Select all

2017-02-07 22:28:15.286 Kodi: (Huiskamer) Missed 1 pings, assumed off.
2017-02-07 22:28:15.288 Kodi: (Huiskamer) Event: 'Off'.
2017-02-07 22:28:15.304 Kodi: (Huiskamer) Disonnected.
2017-02-07 22:28:16.287 Kodi: (Huiskamer) Connected to '192.168.1.115:8080'.
2017-02-07 22:28:16.289 Kodi: (Huiskamer) Event: 'On'.
2017-02-07 22:28:16.306 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"System.GetProperties","params":{"properties":["canhibernate","cansuspend","canshutdown"]},"id":1007}'
2017-02-07 22:28:17.306 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"JSONRPC.Ping","id":1001}'
2017-02-07 22:28:19.861 Kodi: Restarting I/O service thread.
I've seen a lot of people with this problem but no solutions so far, anyone else with a bright idea?
You need to add the json settings in your advancedsettings.xml i had the same with the openelec distro.

<jsonrpc>
<tcpport>9090</tcpport>
</jsonrpc>
Ok i got it to work again, thus far it was a bit unclear to me.
What i did was;

1) remove username from the webserver (so no username and no password)
2) leave the webserver port on 8080 (is this the standard port? at least in my case)
3) add the json part with the 9090 port to the advanced settings.xml
4) add kodi to domoticz with port nr 9090

et voila it works, thank to all.

Re: Kodi Mediaserver Support

Posted: Wednesday 08 February 2017 22:37
by markjgabb
excelent, glad to hear you got it working...

edit: have updated wiki at bottom with a note for openelec, librelec to point to the advanced settings wiki on kodi, and the specific settings needed

Re: Kodi Mediaserver Support

Posted: Thursday 09 February 2017 10:08
by gielie
Ok now kodi is working again in my Domoticz id like to create a blocky to activate some action uppon playing/pausing.
I tried to create a blocky like this

if kodi = video/pause
do send notification

there is no responce, what am i doing wrong?

Re: Kodi Mediaserver Support

Posted: Thursday 09 February 2017 10:23
by markjgabb
Can you paste a screen shot of your blocky??

Re: Kodi Mediaserver Support

Posted: Thursday 09 February 2017 11:48
by gielie
markjgabb wrote:Can you paste a screen shot of your blocky??
Image

Re: Kodi Mediaserver Support

Posted: Thursday 09 February 2017 12:26
by markjgabb
Under setup settings down the bottom left corner is Kosi for notifications....
You need to set this up for notifications to work

Re: Kodi Mediaserver Support

Posted: Thursday 09 February 2017 12:33
by gielie
markjgabb wrote:Under setup settings down the bottom left corner is Kosi for notifications....
You need to set this up for notifications to work
This is to get notification within kodi from Domoticz i belief, this is not wat i want to aclompisch.
I want an action (lights off/on) after kodi starts to play/paused.

So i want my lights to go out when kodi starts to play and the lights on when i pause.
the message is just a trial to see if i get any response after i start/pause kodi

Re: Kodi Mediaserver Support

Posted: Thursday 09 February 2017 21:45
by markjgabb
hmmm interesting, because replicating your blocky works perfectly for me....
however my duplication of your blocky wouldnt work untill i enabled the notifaction part in settings, so if that part of your test is not working. this is why

ill try with a dummy switch and see what happens

(worked perfectly)
in the mean time can you paste your log for where you push play and pause?

Re: Kodi Mediaserver Support

Posted: Saturday 11 February 2017 23:08
by gielie
Ok, i created a dummy switch called "kodi status" with a blocky to switch this switch like this

Image
Image
Image

And this is the log with it.

Code: Select all

2017-02-11 23:03:25.381 Kodi: (Huiskamer) Handling message: '{"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":1.209769129753112793,"speed":0}}'.
2017-02-11 23:03:32.906 Kodi: (Huiskamer) Handling message: '{"jsonrpc":"2.0","method":"GUI.OnScreensaverDeactivated","params":{"data":{"shuttingdown":false},"sender":"xbmc"}}'.
2017-02-11 23:03:32.906 Kodi: (Huiskamer) Message warning, unhandled method: 'GUI.OnScreensaverDeactivated'
2017-02-11 23:03:33.008 Kodi: (Huiskamer) Handling message: '{"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"id":1,"type":"episode"},"player":{"playerid":1,"speed":1}},"sender":"xbmc"}}'.
2017-02-11 23:03:33.008 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"Player.GetItem","id":1003,"params":{"playerid":1,"properties":["artist","album","year","channel","showtitle","season","episode","title"]}}'
2017-02-11 23:03:33.073 Kodi: (Huiskamer) Handling message: '{"id":1003,"jsonrpc":"2.0","result":{"item":{"album":"","artist":[],"episode":1,"id":1,"label":"Pilot","season":1,"showtitle":"Fear the Walking Dead","title":"Pilot","type":"episode","year":0}}}'.
2017-02-11 23:03:33.073 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"Player.GetProperties","id":1002,"params":{"playerid":1,"properties":["live","percentage","speed"]}}'
2017-02-11 23:03:33.076 Kodi: (Huiskamer) Event: 'Video - Fear the Walking Dead [S1E1], Pilot'.
2017-02-11 23:03:33.105 Kodi: (Huiskamer) Handling message: '{"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":1.2170809507369995117,"speed":1}}'.
2017-02-11 23:03:35.380 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"Player.GetProperties","id":1002,"params":{"playerid":1,"properties":["live","percentage","speed"]}}'
2017-02-11 23:03:35.382 Kodi: (Huiskamer) Handling message: '{"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":1.2736383676528930664,"speed":1}}'.
2017-02-11 23:03:42.919 Kodi: (Huiskamer) Handling message: '{"jsonrpc":"2.0","method":"Player.OnPause","params":{"data":{"item":{"id":1,"type":"episode"},"player":{"playerid":1,"speed":0}},"sender":"xbmc"}}'.
2017-02-11 23:03:42.922 Kodi: (Huiskamer) Event: 'Paused - Fear the Walking Dead [S1E1], Pilot'.
2017-02-11 23:03:45.381 Kodi: (Huiskamer) Sending data: '{"jsonrpc":"2.0","method":"Player.GetProperties","id":1002,"params":{"playerid":1,"properties":["live","percentage","speed"]}}'
2017-02-11 23:03:45.383 Kodi: (Huiskamer) Handling message: '{"id":1002,"jsonrpc":"2.0","result":{"live":false,"percentage":1.4659953117370605469,"speed":0}}'.
The Kodi gives me the status video/pauze but there is nothing happening with that information.
What is going on? It must be a Domoticz error because the "huiskamer" is giving the right information.
I turned on the notification part as stated above.
I also tried to remove kodi in the hardware section and re add them again with the same result.
In the past this always worked fine.
Could someone make a lua from the above blocky to see if it is a blocky thing?

btw the remote part of kodi within Domoticz works fine, i can play/pauze within Domoticz

Re: Kodi Mediaserver Support

Posted: Sunday 12 February 2017 0:44
by markjgabb
can someone else check out this log? im looking at it, but it doesnt seem quite right....

Re: Kodi Mediaserver Support

Posted: Sunday 12 February 2017 17:10
by gielie
I reinstaled my domoticz and it's working now, I don't know what was wrong, the output log looks the same. Case closed.

Re: Kodi Mediaserver Support

Posted: Wednesday 15 February 2017 11:49
by Trigun
jake wrote:
Trigun wrote:
jake wrote:Thanks, you're welcome. This finally was within my scope of reach, so, happy to help :)
Hi Jake,

I've been using the script a while now but at some point it seems to stop my kodi device while it is playing.
could it be that there might be a mistake in the script compilation.
with my limited knowledge line 23 might give issues.

is there chance you can help me out here?

Thanks for you help!
Can you make a match in your log's of the selector switch and the Kodi switch to see at what point in time it happened? Could it be that the Kodi switch changes it's status at that time?

Hi Jake,

It took a while for it to happen again. but I can make a match in the logfile of domoticz and the stream to stop. it seems that the virtual switch of Kodi itself is sending an "On" signal. it also appears to happen after every +/- 7 and 9 minutes .

I don't know where this is coming from. If I run the script through a compiler, it does says that it is incomplete(allthough it is usually running correctly) but I'm a noob so have no idea where it goes wrong.

does this help?

grtz.

Re: RE: Re: Kodi Mediaserver Support

Posted: Saturday 18 February 2017 13:31
by jake
Trigun wrote:[


Hi Jake,

It took a while for it to happen again. but I can make a match in the logfile of domoticz and the stream to stop. it seems that the virtual switch of Kodi itself is sending an "On" signal. it also appears to happen after every +/- 7 and 9 minutes .

I don't know where this is coming from. If I run the script through a compiler, it does says that it is incomplete(allthough it is usually running correctly) but I'm a noob so have no idea where it goes wrong.

does this help?

grtz.
Hi, I can't help you, I'm afraid: When the 'On' comes, the script reacts on that. I think that the other part of the script again reacts on the update of the selector switch. So, Kodi tell's 'On', the selector switch goes to 'off', the script gives Kodi a 'Stop' because of the updated selector switch. It might help to add a user variable and use that as some kind of memory to prevent this act-react thing what might happen to you. So by updating the switch status, also update the variable with some kind of info, like '1' or 'auto', but I am not sure if that would create issues when you click on the selector button itself.

Re: RE: Re: Kodi Mediaserver Support

Posted: Wednesday 22 February 2017 12:59
by Trigun
jake wrote:
Trigun wrote:[


Hi Jake,

It took a while for it to happen again. but I can make a match in the logfile of domoticz and the stream to stop. it seems that the virtual switch of Kodi itself is sending an "On" signal. it also appears to happen after every +/- 7 and 9 minutes .

I don't know where this is coming from. If I run the script through a compiler, it does says that it is incomplete(allthough it is usually running correctly) but I'm a noob so have no idea where it goes wrong.

does this help?

grtz.
Hi, I can't help you, I'm afraid: When the 'On' comes, the script reacts on that. I think that the other part of the script again reacts on the update of the selector switch. So, Kodi tell's 'On', the selector switch goes to 'off', the script gives Kodi a 'Stop' because of the updated selector switch. It might help to add a user variable and use that as some kind of memory to prevent this act-react thing what might happen to you. So by updating the switch status, also update the variable with some kind of info, like '1' or 'auto', but I am not sure if that would create issues when you click on the selector button itself.
Hi Jake,

Thanks for you reply.
I think I found the issue :)I think I made a typo in combination with my Frontpage.
I Reconfigured everything with the right naming confentions and so far so good, I haven't had the issue anymore!

Anyway, thanks for your time for looking into it!

Cheers

Re: RE: Re: RE: Re: Kodi Mediaserver Support

Posted: Wednesday 22 February 2017 22:59
by jake
Trigun wrote:
jake wrote:
Trigun wrote:[


Hi Jake,

It took a while for it to happen again. but I can make a match in the logfile of domoticz and the stream to stop. it seems that the virtual switch of Kodi itself is sending an "On" signal. it also appears to happen after every +/- 7 and 9 minutes .

I don't know where this is coming from. If I run the script through a compiler, it does says that it is incomplete(allthough it is usually running correctly) but I'm a noob so have no idea where it goes wrong.

does this help?

grtz.
Hi, I can't help you, I'm afraid: When the 'On' comes, the script reacts on that. I think that the other part of the script again reacts on the update of the selector switch. So, Kodi tell's 'On', the selector switch goes to 'off', the script gives Kodi a 'Stop' because of the updated selector switch. It might help to add a user variable and use that as some kind of memory to prevent this act-react thing what might happen to you. So by updating the switch status, also update the variable with some kind of info, like '1' or 'auto', but I am not sure if that would create issues when you click on the selector button itself.
Hi Jake,

Thanks for you reply.
I think I found the issue :)I think I made a typo in combination with my Frontpage.
I Reconfigured everything with the right naming confentions and so far so good, I haven't had the issue anymore!

Anyway, thanks for your time for looking into it!

Cheers
I'm sorry, but I can't really help:

- Kodi showing the wrong status would need a fix from the developer of it.

- The fact that the selector switch 'fires' the connected command (Kodi: 'on' -> update selector switch to 'stop' -> make Kodi 'stop') to Kodi, is also an issue that is not solvable within Domoticz at the moment. I posted a comment about it in the topic about this subject, however the original question there is quite old, but no solution is shown at the moment: viewtopic.php?p=120979#p120979

Re: RE: Re: Kodi Mediaserver Support

Posted: Thursday 23 February 2017 19:26
by jake
Trigun wrote:
jake wrote:
Trigun wrote: It took a while for it to happen again. but I can make a match in the logfile of domoticz and the stream to stop. it seems that the virtual switch of Kodi itself is sending an "On" signal. it also appears to happen after every +/- 7 and 9 minutes .

does this help?

grtz.
In the mentioned topic above they came with a solution to only update the selector switch buttons, but without actually firing the event which would happen if you click the selector switch manually.

You need to lookup one more thing when you copy/paste the script, it is the following line:

local kodi_multiswitch_idx = 99 -- The idx of the self made virtual multi-selector as it can be found in the 'Devices' under 'setup'

Code: Select all

-- Title: script_device_kodi
-- Date: 09-01-2017
-- Start, Pause and Stop media playing on Kodi driven media center

-- Define local variables to match (virtual) hardware in Domoticz

-- Make sure capital letters are matching ('Kodi Media Center' is something different than 'kodi media center'), so everything is case sensitive

local kodidevice = 'Kodi Media Center' 	-- The name of the Kodi Hardware as it can be found in the 'switches' page
local kodi_multiswitch = 'Kodi Remote' 	-- the name of the self made virtual multi-selector as it can be found in the 'switches' page
local kodi_multiswitch_idx = 99			-- The idx of the self made virtual multi-selector as it can be found in the 'Devices' under 'setup'
-- The following lines are to define the different levels of the selector switch
local kodiplay = "Play" 				-- by using a variable the possibility is to use a local language on the dashboard (level name)
local kodiplay_level = "0" 				-- level value of the 'Play' level name
local kodipause = "Pause" 				-- by using a variable the possibility is to use a local language on the dashboard (level name)
local kodipause_level = "10" 			-- level value of the 'Pause' level name
local kodistop = "Stop"  				-- by using a variable the possibility is to use a local language on the dashboard (level name)
local kodistop_level = "20" 			-- level value of the 'Stop' level name

-- No need to change anything below this line

commandArray = {}
-- Set Kodi to react to input of selector switch in Domoticz
if (devicechanged[kodi_multiswitch] == kodiplay and (otherdevices [kodidevice] ~= "Audio" and otherdevices [kodidevice] ~= "Video")) then
   commandArray [kodidevice] = "Play"
elseif (devicechanged[kodi_multiswitch] == kodipause and otherdevices [kodidevice] ~= "Paused") then
   commandArray [kodidevice] = "Pause"
elseif (devicechanged[kodi_multiswitch] == kodistop and otherdevices [kodidevice] ~= "On") then
   commandArray [kodidevice] = "Stop"
end

-- Update selector switch in Domoticz to react to status change of Kodi, but don't fire the above code (update device only, instead of creating a 'devicechanged' event) 
if ((devicechanged[kodidevice] == "Audio" or devicechanged[kodidevice] == "Video") and otherdevices [kodi_multiswitch] ~= kodiplay) then
   commandArray ['UpdateDevice'] = kodi_multiswitch_idx .. '|0|' .. kodiplay_level
elseif (devicechanged[kodidevice] == "Paused" and otherdevices [kodi_multiswitch] ~= kodipause) then
   commandArray ['UpdateDevice'] = kodi_multiswitch_idx .. '|0|' .. kodipause_level
elseif (devicechanged[kodidevice] == "On" and otherdevices [kodi_multiswitch] ~= kodistop) then
   commandArray ['UpdateDevice'] = kodi_multiswitch_idx .. '|0|' .. kodistop_level
end


return commandArray

Re: RE: Re: RE: Re: Kodi Mediaserver Support

Posted: Friday 03 March 2017 18:03
by jake
Trigun wrote:
jake wrote:
Trigun wrote:[


Hi Jake,

It took a while for it to happen again. but I can make a match in the logfile of domoticz and the stream to stop. it seems that the virtual switch of Kodi itself is sending an "On" signal. it also appears to happen after every +/- 7 and 9 minutes .

I don't know where this is coming from. If I run the script through a compiler, it does says that it is incomplete(allthough it is usually running correctly) but I'm a noob so have no idea where it goes wrong.

does this help?

grtz.
Hi, I can't help you, I'm afraid: When the 'On' comes, the script reacts on that. I think that the other part of the script again reacts on the update of the selector switch. So, Kodi tell's 'On', the selector switch goes to 'off', the script gives Kodi a 'Stop' because of the updated selector switch. It might help to add a user variable and use that as some kind of memory to prevent this act-react thing what might happen to you. So by updating the switch status, also update the variable with some kind of info, like '1' or 'auto', but I am not sure if that would create issues when you click on the selector button itself.
Hi Jake,

Thanks for you reply.
I think I found the issue :)I think I made a typo in combination with my Frontpage.
I Reconfigured everything with the right naming confentions and so far so good, I haven't had the issue anymore!

Anyway, thanks for your time for looking into it!

Cheers
Does it work better with the improved code?

Re: RE: Re: RE: Re: Kodi Mediaserver Support

Posted: Sunday 05 March 2017 20:25
by Trigun
jake wrote:
Trigun wrote:
jake wrote: Hi, I can't help you, I'm afraid: When the 'On' comes, the script reacts on that. I think that the other part of the script again reacts on the update of the selector switch. So, Kodi tell's 'On', the selector switch goes to 'off', the script gives Kodi a 'Stop' because of the updated selector switch. It might help to add a user variable and use that as some kind of memory to prevent this act-react thing what might happen to you. So by updating the switch status, also update the variable with some kind of info, like '1' or 'auto', but I am not sure if that would create issues when you click on the selector button itself.
Hi Jake,

Thanks for you reply.
I think I found the issue :)I think I made a typo in combination with my Frontpage.
I Reconfigured everything with the right naming confentions and so far so good, I haven't had the issue anymore!

Anyway, thanks for your time for looking into it!

Cheers
Does it work better with the improved code?
Hi Jake,

please discard my reply above as the issue seem to be still present.

I just wanted to implement the script above but are you sure the script above(with the IDX) is correct? I don't think you numer 0 can be "play" as it always has the description "off" do I need to change it in some way or, should "play" be 10?

Thanks again!