Page 3 of 18

Re: Kodi Mediaserver Support

Posted: Friday 04 September 2015 19:26
by Justintime
When give the Off command in the mediaplayer it switches my Kodi system completly off. Looks like it doesn't give the sleep command?
When I click suspend mode in Kodi it wakes up with WOL.

Re: Kodi Mediaserver Support

Posted: Friday 04 September 2015 19:28
by Justintime
pepeEL wrote:
pvm wrote:It is similar to domoticz. Download SD card image from http://openelec.tv/get-openelec and write in the same way to an empty SD card and plug it in, power it on. Openelec.tv also has a wiki/chat/forum for questions
And then i must install KODI ? Or Kodi is in Image SD ?
If you are Dutch you can subscribe on my Facebook page xbmcvoorbeginners. We have also a special raspberry Pi page with a complete working image with many great addon's.

Re: Kodi Mediaserver Support

Posted: Saturday 05 September 2015 1:04
by Dnpwwo
Justintime, the current shutdown attempts to respect what you have configured in your Kodi itself (http://kodi.wiki/view/Settings/System#Power_saving).

If you have a look in the Domoticz log it will show what the Kodi reported and what action it selected, Shutdown doesn't work for me at all so I see:

Code: Select all

2015-09-05 09:00:19.538 Kodi: (Family) Switch Off: CanReboot:false, CanShutdown:false, CanHibernate:false, CanSuspend:false. Nothing requested.
If you configure your Kodi to suspend it should be respected.

Can you give it a go and post the result?

Re: Kodi Mediaserver Support

Posted: Saturday 05 September 2015 10:38
by Justintime
Dnpwwo wrote:Justintime, the current shutdown attempts to respect what you have configured in your Kodi itself (http://kodi.wiki/view/Settings/System#Power_saving).

If you have a look in the Domoticz log it will show what the Kodi reported and what action it selected, Shutdown doesn't work for me at all so I see:

Code: Select all

2015-09-05 09:00:19.538 Kodi: (Family) Switch Off: CanReboot:false, CanShutdown:false, CanHibernate:false, CanSuspend:false. Nothing requested.
If you configure your Kodi to suspend it should be respected.

Can you give it a go and post the result?

This is my Log. I guess you run Kodi on a Raspberry PI. Which can't suspend, cant reboot is a bit strange. And cant shutdown is obvious on a PI.

Code: Select all

Switch Off: CanReboot:true, CanShutdown:true, CanHibernate:false, CanSuspend:true. Shutdown requested.
So it look like the shutdown command is given. But we (i) need the suspend mode. Then you can wake it up correctly.

I have set the suspend mode in Kodi when off is requested. But it still completly shuts down.

Re: Kodi Mediaserver Support

Posted: Saturday 05 September 2015 10:43
by Justintime
pepeEL wrote:I installed openelec 5.0.8 on my raspberry pi 2. But when i want suspend raspberry i can not. I only have option to CLOSE. How configure my Raspberry with KODI to suspend mode and then wake on lan from Domoticz ?
Please read this, PI cant suspend.

http://wiki.openelec.tv/index.php?title ... Fwakeup.3F

Re: Kodi Mediaserver Support

Posted: Saturday 05 September 2015 11:13
by Justintime
pepeEL wrote:Ok but how disable KODI on raspberry by Domoticz and then Turn ON again by DOmoticz ?
In short not... A Pi with kodi you can leave it on 24/7 or switch it off with a usb hardware switch.

Re: Kodi Mediaserver Support

Posted: Saturday 05 September 2015 12:11
by Justintime
pepeEL wrote:Can you explain me more about what's going on with this USB switch?
Meaning something like this. http://m.dhgate.com/product/10pcs-whole ... tml#pd-103

But we are getting way offtopic here.

Re: Kodi Mediaserver Support

Posted: Saturday 05 September 2015 16:45
by pvm
It's max 3 watt, not much energy during a year

Re: Kodi Mediaserver Support

Posted: Tuesday 22 September 2015 15:11
by Dnpwwo
Posted a new Kodi version to beta channel.

Couple of changes:
  • If using default port numbers update device details from 8080 to 9090
  • username/password shouldn't be required (not an http request anymore)
  • log messages show more details than the device status text
  • Device off favours hibernate & suspend over shutdown if Kodi is configured to allow them
This is a complete rewrite of the backend that I have run for a week on Windows & Unix so apologies if I've broken things that worked before but I figured that there was no point in working on notifications if they were several seconds late due to polling.

Also started work on a wiki page that I will pad out over the next few days: http://www.domoticz.com/wiki/Kodi

Re: Kodi Mediaserver Support

Posted: Tuesday 22 September 2015 18:10
by Justintime
Dnpwwo wrote:Posted a new Kodi version to beta channel.

Couple of changes:
  • If using default port numbers update device details from 8080 to 9090
  • username/password shouldn't be required (not an http request anymore)
  • log messages show more details than the device status text
  • Device off favours hibernate & suspend over shutdown if Kodi is configured to allow them
This is a complete rewrite of the backend that I have run for a week on Windows & Unix so apologies if I've broken things that worked before but I figured that there was no point in working on notifications if they were several seconds late due to polling.

Also started work on a wiki page that I will pad out over the next few days: http://www.domoticz.com/wiki/Kodi
Do I have to add as a new device? Or is it just update on all ready owned devices.
Because when I shut it off. It still request a shutdown command in the Domoticz log.

Re: Kodi Mediaserver Support

Posted: Tuesday 22 September 2015 18:54
by bizziebis
I tried the new version but only get this in the log when using port 9090:

Code: Select all

Kodi: Restarting I/O service thread.
When I use port 80 I get this:

Code: Select all

Kodi: (Kodi) Connected.
Kodi: (Kodi) Event: 'On'.
But does nothing after that..

When I use the remote:

Code: Select all

Kodi: (Kodi) Sent command: 'Input.ExecuteAction playpause'.
Error: Kodi: (Kodi) Async Read Exception: Operation canceled
Kodi: (Kodi) Disonnected.
Kodi: (Kodi) Connect failed: (104) Connection reset by peer
Kodi: Restarting I/O service thread.
Kodi: (Kodi) Connected.

Re: Kodi Mediaserver Support

Posted: Wednesday 23 September 2015 3:43
by Dnpwwo
Devices do not need to be deleted and re-created, just update the port number for the existing device. Probably worth stopping and starting Domoticz just to be sure.

I would expect using port 80 or 8080 to show a successful connection but it will not work on those ports anymore. Have a look at http://kodi.wiki/view/JSON-RPC_API#TCP.

There are a couple of things you can do to troubleshoot this if you have any technical knowledge:
  • Do a 'telnet <kodi_ip> 9090' and if it connects use your Kodi (not through Domoticz) and see anything gets written out. If it does nothing or won't connect then you may not have enabled the 'Allow Kodi to be controlled by 3rd parties' setting or you've changed the port being used
  • If you build from source, open Kodi.cpp under hardware and change #define DEBUG_LOGGING false on line 17 to #define DEBUG_LOGGING true and rebuild. This will spit out loads of details into the Domoticz log.
Always useful for me to know if this worked before and what platform you are on and logs of any messages.

Also useful if people can report successful experiences as well.

I will be updating the Hardware page in the next day or so to change the default.

Re: Kodi Mediaserver Support

Posted: Wednesday 23 September 2015 9:23
by Justintime
I am on stable Openelec. But got the message in Kodi that he can't start the Webserver on Port 9090.

When I am at home I have to investigate further... Maybe with custom port.

Re: Kodi Mediaserver Support

Posted: Wednesday 23 September 2015 10:03
by bizziebis
I had to enable that setting in Kodi in Services to enable a remote system to controll Kodi. Now it's working.

One other thing now (and in the past) is that I cannot do anything with the status of the switch which is created. When I try to get the status in LUA I get 'On' (otherdevices['Kodi']). Not something like playing, paused etc so I cannot switch my lights based on that. Or '0' when I use otherdevices_svalues['Kodi'].

Is this even possible, or am I doing it wrong?

Re: Kodi Medisserver Support

Posted: Wednesday 23 September 2015 15:31
by kraades
Chopper_Rob wrote:If you would switch to the raw TCP port instead of the web api you can integrate a much better listening system. After connecting, KODI pushes all actions to the connected devices, so you would only need to listen and not poll. My script works the same way, this makes to reaction time very fast.

You can test this by connecting to the TCP port (9090) with a simple telnet client.
So this should now be working? If it is, great job! I will give it a try! :D

Edit:
Wait a minute...
When I read the post ^^^ it looks like you do not have a Domoticz "Kodi playing" or "Kodi online" switch that you can use in Domoticz?
Or am I mistaken?

Like for example:
Image

Re: Kodi Mediaserver Support

Posted: Wednesday 23 September 2015 17:33
by Justintime
I have tried to change the port with.

Code: Select all

<jsonrpc>
    <compactoutput>false</compactoutput>
    <tcpport>9095</tcpport>
</jsonrpc>
But no luck it has a BIG conflict with the Pulsar addon of Kodi.
I dont know if other members uses it. Great addon btw.

It failed to communicate with the webserver.
I guess the Pusar addon uses that port too??

As far i can read here...you have to enable it to use Pulsar correct.

https://seo-michael.co.uk/how-to-instal ... -for-xbmc/

EDIT:
When i connect with the 9090 port it goes in suspend mode, but gives the message "problem switching off command and Domoticz crashes .

Re: Kodi Mediaserver Support

Posted: Thursday 24 September 2015 14:06
by Dnpwwo
@Justintime, I uploaded a new version that will 'succeed' on shutdown if hiberate,suspend or shutdown are enabled so you shouldn't see the failure message in the web browser. I can't see anything that would cause a Domoticz crash. If the backend is crashing, run it from the command line then capture the crash message and post it.

I looked at the plugin and can't see any reason why they would clash. The plugin goes out and connects to sources while the remote accepts incoming connections so they shouldn't clash. Can you post the evidence that they do?

@kraades & bizziebis, I haven't done the event bit yet, that is next now the status changes are coming through in near real time.

Re: Kodi Mediaserver Support

Posted: Thursday 24 September 2015 17:51
by Justintime
Dnpwwo wrote:@Justintime, I uploaded a new version that will 'succeed' on shutdown if hiberate,suspend or shutdown are enabled so you shouldn't see the failure message in the web browser. I can't see anything that would cause a Domoticz crash. If the backend is crashing, run it from the command line then capture the crash message and post it.

I looked at the plugin and can't see any reason why they would clash. The plugin goes out and connects to sources while the remote accepts incoming connections so they shouldn't clash. Can you post the evidence that they do?

@kraades & bizziebis, I haven't done the event bit yet, that is next now the status changes are coming through in near real time.
When i change the port in Kodi to 9090 it says "webserver failed to start" So i force the port in advancedsettings.xml to port 9095. Change the port in Domoticz on 9095. When i start Kodi. I get the message in Kodi Pulsar failed to start, starting again. But it wont start. Its even that bad that i have to restore the backup. Because i cant open menu's in Kodi. So thats why i think it clashes.

When i leave the port in Kodi on port 80 and the device in Domoticz on 9090. The media device in Domoticz responds... But when i do an off command on the "off"button Domoticz still crashes. With the message error switching command.

Can you please tell me what you mean with run it in the command line and capture the crash message?
What and how can i provide you with the information??

Re: Kodi Mediaserver Support

Posted: Thursday 24 September 2015 19:34
by bizziebis
I really wonder which port you are changing. The webserver port has nothing to do with the latest kodi plugin. When you enable "Allow programs on other systems to control Kodi" port 9090 will be activated.

Re: Kodi Mediaserver Support

Posted: Friday 25 September 2015 2:12
by Dnpwwo
@Justintime, I've added a 1st version of a help page to the wiki (http://www.domoticz.com/wiki/Kodi) and there is a section where I've tried to be clear about what to configure on the Kodi end. Can you have a look and see if it helps?

Also thought I'd upload some Kodi custom icons to save everyone making their own.
Kodi.zip
Kodi Custom Icons
(5.68 KiB) Downloaded 1622 times