Kodi Mediaserver Support

Moderator: leecollings

Post Reply
Session
Posts: 7
Joined: Thursday 26 November 2015 19:15
Target OS: Linux
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by Session »

What is the best was to control 3 different lights when play/pause from kodi?

Now I have 2 scenes with "group":

Film play:
3 devices with dim levels: 75% 50% and 15%

Film pause:
3 devices with dim levels: 90% 75% and 50%

In blockly I have two different events: Kodi play & kodi pause:

Kodi pause:
If: kodi = "paused"
Do: set group film pause = on
set group film play = off

Kodi play:
If: kodi = "video"
Do: set group film play = on
set group film pause = off

This is not working as I though it would in my head ;)

Someone here smarter and better than me probably has a better solution they might want to share :D
User avatar
Egregius
Posts: 2582
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 »

Are those the same 3 dimmers in both groups?
Then I don't think you need to set the group off.
Session
Posts: 7
Joined: Thursday 26 November 2015 19:15
Target OS: Linux
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by Session »

That did the trick!
Edit: Also made a dummy switch that I can use to turn the "movie light mode" on/off. Man, this is great fun! :)
barbaar
Posts: 56
Joined: Wednesday 24 December 2014 16:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by barbaar »

Somehow it all stopped working :(

I have a p2 running OpenElec official 6.0.0. I have included the following in advancedsettings.xml:

Code: Select all

 <jsonrpc>
    <compactoutput>false</compactoutput>
    <tcpport>9090</tcpport>
  </jsonrpc>
And my Domoticz log shows

Code: Select all

2015-12-06 17:05:26.403 Kodi: (OpenElec) Missed 1 pings, assumed off.
2015-12-06 17:05:26.418 Kodi: (OpenElec) Event: 'Off'.
2015-12-06 17:05:26.579 Kodi: (OpenElec) Disonnected.
2015-12-06 17:05:27.418 Kodi: (OpenElec) Connected to '192.168.0.204:9090'.
2015-12-06 17:05:27.423 Kodi: (OpenElec) Event: 'On'.
Thus, Domoticz does not detect when a movie or audio is playing. any ideas?
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 »

I think this is due to the possible login credentials needed ?

I have made a new setup for my Kodi but I use a username and password to enable some apps on my phone to remotly controll kodi.
But I see in Domoticz that I can't put these credentials anywhere...

Greetings.
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
barbaar
Posts: 56
Joined: Wednesday 24 December 2014 16:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by barbaar »

Brutus wrote:I think this is due to the possible login credentials needed ?

I have made a new setup for my Kodi but I use a username and password to enable some apps on my phone to remotly controll kodi.
But I see in Domoticz that I can't put these credentials anywhere...

Greetings.
Credentials required to logon to Domoticz? That could be, because thats one thing I did change..
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 »

barbaar wrote:
Brutus wrote:I think this is due to the possible login credentials needed ?

I have made a new setup for my Kodi but I use a username and password to enable some apps on my phone to remotly controll kodi.
But I see in Domoticz that I can't put these credentials anywhere...

Greetings.
Credentials required to logon to Domoticz? That could be, because thats one thing I did change..
Nope credentials for Kodi. They can't be inserted into Domoticz.
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: 819
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 »

@barbaar and brutus, I think you are making this much more complicated than it needs to be.

You should not need to touch advancedsettings.xml unless you want the jsonrpc service to run on a different port. 9090 is the default so I would recommend reverting your change.

AFAIK username/password settings in Kodi only apply to the web server not the jsonrpc server which is why you can't put them in. Many applications and remotes use that web service but the Domoticz implementation does not (which is probably where the confusion comes in).

If you are convinced there is a problem then issue a 'telnet <IP> 9090' command to the Kodi to see if it connects. If it does, paste in {"jsonrpc":"2.0","method":"JSONRPC.Ping","id":1} and hit enter and see if it responds. If you get a 'Pong' back then Domoticz will work, if not then it won't.

The wiki covers how to check what is going on (http://www.domoticz.com/wiki/Kodi#Troubleshooting), unless you see some log entries where Domoticz is 'Parsing data' then you have connected to the wrong port or not connected.

Good luck!
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
barbaar
Posts: 56
Joined: Wednesday 24 December 2014 16:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by barbaar »

Thanks, removing the entries in advancedsetting solved this indeed.
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:@barbaar and brutus, I think you are making this much more complicated than it needs to be.

You should not need to touch advancedsettings.xml unless you want the jsonrpc service to run on a different port. 9090 is the default so I would recommend reverting your change.

AFAIK username/password settings in Kodi only apply to the web server not the jsonrpc server which is why you can't put them in. Many applications and remotes use that web service but the Domoticz implementation does not (which is probably where the confusion comes in).

If you are convinced there is a problem then issue a 'telnet <IP> 9090' command to the Kodi to see if it connects. If it does, paste in {"jsonrpc":"2.0","method":"JSONRPC.Ping","id":1} and hit enter and see if it responds. If you get a 'Pong' back then Domoticz will work, if not then it won't.

The wiki covers how to check what is going on (http://www.domoticz.com/wiki/Kodi#Troubleshooting), unless you see some log entries where Domoticz is 'Parsing data' then you have connected to the wrong port or not connected.

Good luck!
Thnx for your reply and explanation.

But I don't understand it fully because when you go to the settings from the Kodi Media Server you can enter the IP address but at the end it says: (username:password@IP Address). What username and password is this then? When I enter those from the webserver I get the following errors every second:

2015-12-11 13:50:35.522 Error: Kodi: (Kodi TV Woonkamer) Exception: 'resolve: a fatel error occured while searching in the database' connecting to 'admin:[email protected]'
2015-12-11 13:50:35.623 Kodi: Starting I/O service thread.
2015-12-11 13:50:35.624 Error: Kodi: (Kodi TV Woonkamer) Async Read Exception: 995, The I/O-operation has been aborted because of either a thread exit or an application because of a command.
2015-12-11 13:50:35.682 Kodi: (Kodi TV Woonkamer) Event: 'Off'.

When entering only the IP address the messages are gone. But i see this error every 60 seconds:
2015-12-11 13:51:57.184 Kodi: (Kodi TV Woonkamer) Missed 1 pings, assumed off.
and:
2015-12-11 14:00:00.421 Kodi: (Kodi TV Woonkamer) Event: 'Off'.
2015-12-11 14:00:00.429 Kodi: (Kodi TV Woonkamer) Disonnected.
2015-12-11 14:00:00.583 Hardware Monitor: Fetching data (System sensors)
2015-12-11 14:00:01.422 Kodi: (Kodi TV Woonkamer) Connected to '192.168.1.5:85'.
2015-12-11 14:00:01.457 Kodi: (Kodi TV Woonkamer) Event: 'On'.
2015-12-11 14:00:06.795 Kodi: Restarting I/O service thread.

So I see my remote is on but i can't use it.

I have also checkt the option that odder applications can use the remote control of kodi.

Hope you can help me.

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
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

As said before, you should NOT do anything with a password. Are you running a current beta version? In the old days you had to connect via the webserver and at that time you needed to add credentials.
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 »

jake wrote:As said before, you should NOT do anything with a password. Are you running a current beta version? In the old days you had to connect via the webserver and at that time you needed to add credentials.
What port number I need to use then? Not the port of the webserver i think because you all say thats not used anymore.

Then the option to use the username:password@ipaddress needs to be removed. Because it confuses.

Greetings.
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
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

Brutus wrote:
jake wrote:As said before, you should NOT do anything with a password. Are you running a current beta version? In the old days you had to connect via the webserver and at that time you needed to add credentials.
What port number I need to use then? Not the port of the webserver i think because you all say thats not used anymore.

Then the option to use the usernameImageassword@ipaddress needs to be removed. Because it confuses.

Greetings.
Well, I don't understand where your comment about username and password is coming from, unless you are running an older version of Domoticz. Please confirm your build version of Domoticz, you can see that on the Domoticz homepage (V2.xxxx).
For the current versions of Domoticz, port 9090 is used. For the old versions (with usrname /password) the standard webserver port 8080 is needed.
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 »

jake wrote:
Brutus wrote:
jake wrote:As said before, you should NOT do anything with a password. Are you running a current beta version? In the old days you had to connect via the webserver and at that time you needed to add credentials.
What port number I need to use then? Not the port of the webserver i think because you all say thats not used anymore.

Then the option to use the usernameImageassword@ipaddress needs to be removed. Because it confuses.

Greetings.
Well, I don't understand where your comment about username and password is coming from, unless you are running an older version of Domoticz. Please confirm your build version of Domoticz, you can see that on the Domoticz homepage (V2.xxxx).
For the current versions of Domoticz, port 9090 is used. For the old versions (with usrname /password) the standard webserver port 8080 is needed.
I don't know it either now.. I think I am losing my mind. As you can see in the attachment thats the normal view of the kodi settings page.

At the top you can see the version of domoticz, its a recent version but in the red circle there was yesterday the text: username:password@IPAddress Now I don't see it anymore.

Problems have solved after changing the port to 9090.

Thnx for the help
Attachments
Naamloos.jpg
Naamloos.jpg (87.54 KiB) Viewed 4166 times
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
mcwieger
Posts: 107
Joined: Tuesday 08 December 2015 9:59
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by mcwieger »

Sorry for bringing up the shutdown/hibernate issue again. I would really have a full shutdown rather than hibernate. I tried overriding the 'off' command by adding this to domoticz_main:

net rpc shutdown -f -I 192.168.2.251 -U user%pw

However, the regular 'off' command is user (hibernate). Is there a way to change this behaviour in another way?

Not a very experienced user yet, don't know where the kodi config files are stored in Domoticz,for example.
I moved to HomeAssistant. It was fun while it lasted!
User avatar
Dnpwwo
Posts: 819
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 »

Domoticz queries the Kodi to find out how it is configured and requests the enabled shutdown function.

Have a look at http://kodi.wiki/view/Settings/System#Power_saving, it covers how to use the setting that 'Defines what "Shutdown" will do by default. Can be set to actually shutdown, suspend, minimize, or quit.'

If you want to know what your Kodi has enabled follow the trouble shooting instructions here: http://www.domoticz.com/wiki/Kodi#Troubleshooting and Domoticz what your Kodi reported as Domoticz starts up. Mine shows:

Code: Select all

2015-10-03 13:03:02.565 Kodi: (Lounge) Parsing data: '{"id":7,"jsonrpc":"2.0","result":{"canhibernate":false,"canshutdown":false,"cansuspend":false}}'. 
which means that clicking on the icon does absolutely nothing because its on a Raspberry Pi.
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
mcwieger
Posts: 107
Joined: Tuesday 08 December 2015 9:59
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by mcwieger »

Thanks for your help. I did check the setting before, it's set to Shutdown. The log output is:

Code: Select all

2015-12-22 21:14:16.920 Kodi: (HTPC) Sending data: '{"jsonrpc":"2.0","method":"System.GetProperties","params":{"properties":["canhibernate","cansuspend","canshutdown"]},"id":1004}'
2015-12-22 21:14:16.920 Kodi: (HTPC) Shutdown requested and is supported.
2015-12-22 21:14:16.921 Kodi: (HTPC) Handling message: '{"id":1004,"jsonrpc":"2.0","result":{"canhibernate":true,"canshutdown":true,"cansuspend":true}}'.
2015-12-22 21:14:16.921 Kodi: (HTPC) Switch Off: CanShutdown:true, CanHibernate:true, CanSuspend:true. Suspend requested.
2015-12-22 21:14:16.921 Kodi: (HTPC) Sending data: '{"jsonrpc":"2.0","method":"System.Suspend","id":1008}'
2015-12-22 21:14:16.922 Kodi: (HTPC) Handling message: '{"id":1008,"jsonrpc":"2.0","result":"OK"}'.
2015-12-22 21:14:16.922 Kodi: (HTPC) Shutdown command accepted.
2015-12-22 21:14:16.920 (HTPC) Lighting 2 (HTPC)
2015-12-22 21:14:16.954 Kodi: (HTPC) Handling message: '{"jsonrpc":"2.0","method":"System.OnSleep","params":{"data":null,"sender":"xbmc"}}'.
2015-12-22 21:14:16.954 Kodi: (HTPC) Message warning, unhandled method: 'System.OnSleep'
I don't quite know how to read it, but I see: Shutdown requested, Suspend Sent, Shutdown Accepted and something with OnSleep.

I think I understand how to configure, but it doesn't seem to do what I want. Ideas?
I moved to HomeAssistant. It was fun while it lasted!
User avatar
Dnpwwo
Posts: 819
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 »

This is really an unsolvable problem because different people have different ideas about what 'Off' means.

The high level logging just reports that the Kodi has been asked to turn off as a result of a click or event code, it generically uses the term 'shutdown' because it doesn't know what actual command will be issued until the Kodi reconfirms what options are available.

This is the key log entry:

Code: Select all

2015-12-22 21:14:16.921 Kodi: (HTPC) Switch Off: CanShutdown:true, CanHibernate:true, CanSuspend:true. Suspend requested.
because the Kodi has restated the available options at the point in time when 'Off' has been requested.

Previous feedback from this forum has been that when multiple options are available (true) Domoticz should prioritize them in this order: Suspend, Hibernate followed by Shutdown. This order could easily be changed but that will just annoy a different group of users :(

I could create some specific commands that could be used from Lua or Blockly to explicitly select an option, would that 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
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

From my side, I would rather take all functionality out of that button. Multiple times I accidentally clicked on it and it shut the Kodi rpi down. I then need to dive down to the power cable and unplug plug it again
mcwieger
Posts: 107
Joined: Tuesday 08 December 2015 9:59
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Kodi Mediaserver Support

Post by mcwieger »

Is it possible to make the Shutdown function configurable in Domoticz? It appears to be now via Kodi, but apparently it isn't picked up.

What would also be acceptable is to try to get "canhibernate","cansuspend" set to False. Is there a way to do that (maybe in Kodi)?

I haven't worked with Lua and Blockly yet (well, I tried to work with Lua, but didn't work and was advised to use domoticz_main instead for what I tried to do).
Using domoticz_main btw would also be acceptable for me, I already figured out how to shutdown over a network, see earlier post. I can see that the script is called, but only after Kodi has already been suspended, so too late ;-)

And having same issue as Jake: suspend is a terrible state to be in, very hard to get it out off...
I moved to HomeAssistant. It was fun while it lasted!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests