Kodi Mediaserver Support

Moderator: leecollings

jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

I did one more trial:
In the hardware page I altered the Kodi Media Server by changing the IP address of the Kodi device and followed that by disabling Kodi Media Server.
Secondly I added the 'Kodi Players' hardware again with the correct IP of the Kodi device. Unfortunately this didn't help a thing and Domoticz still crashed. I therefore think that having the 'standard' Kodi hardware in the list available, is not the root cause of Kodi crashing with this new plugin.
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Kodi Mediaserver Support

Post by deennoo »

Have to admit that i get some segmentatuon fault using kodi plugin.

Where can we found more "revelant log" ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
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 »

@jake,

Thanks, I suspected as much. I have isolated the issue to the device creation functions which is good because it means I haven't broken support for Python 3.2 in a big way. It may be related to when I added support for named parameters.

@deenoo,

I haven't seen any crashes but I've only run for around 24 hours at a time so far. Can you provide some details on if the crash is at a predictable time after start up or any other pattern you can see.

I have add an exception handler around the core code to help get some more detail.

I will try and push another version today but after that I will be travelling for the next week but I will continue looking at it when I get back.
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
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
Brutus wrote:@Dnpwwo, when installing without the all user option the setup of Python adds the "PATH" in the environment variables. When selecting the "install for all users" option it doesn't. So I add it myself: PATH --> C:\Program Files (x86)\Python35-32\

I also copied the dll file into the root of the Domoticz folder. It doesn't work :(
Got back to this today (sorry its taken a while).
Uninstalled Python then re-installed it to prove it worked on Windows and it didn't :lol: I develop on Windows but always in debug mode and it was the Release build that was broken.

Fixed now though, can you give it another go when the latest pull request has been merged in?

I installed it using these setting btw:
Python352.png
Python352.png (152.08 KiB) Viewed 4803 times
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 »

@Dnwwo, you don't have to excuse yourselve. You don't have to solve and react right away ;) I'm glad your helping and it wasn't my mistake :oops:

Thnx for the printscreens. Thats the way I installed it. Will give it a try soon.

Today I was hitting a little problem. I have made A simple script that will change the volume and start a favorite of Kodi:

Code: Select all

if Alarm == 'Off' and Kodi == 'On' then
        print ('<font color="Green">Kodi gestopt? Start Radio</font>')
        commandArray['Kodi TV Woonkamer'] = 'Play Favorites 0'
        commandArray['Kodi TV Woonkamer'] = 'Set Volume 75'
The only thing that happens is that the Volume changes.

When I change the script to:

Code: Select all

if Alarm == 'Off' and Kodi == 'On' then
        print ('<font color="Green">Kodi gestopt? Start Radio</font>')
        commandArray['Kodi TV Woonkamer'] = 'Set Volume 75'
        commandArray['Kodi TV Woonkamer'] = 'Play Favorites 0'
The only thing that now happens is that the radio begins to play (favorite number 0).
So it looks like the second command is executed only?
Is it me or is here something wrong?

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
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, I needed to change the command syntax a little to fool Domoticz into passing it through to the plugin.

You need to 'Trigger' a playlist rather than 'Play'ing it, Kodi plugins need to be 'Run' not 'Execute'd.

If you can read Python at all have a look at line 355 of the Kodi plugin, there are some examples in comments, Favourites are just below that
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
jammiejammie
Posts: 21
Joined: Thursday 09 October 2014 16:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by jammiejammie »

Brutus wrote:@Dnwwo, you don't have to excuse yourselve. You don't have to solve and react right away ;) I'm glad your helping and it wasn't my mistake :oops:

Thnx for the printscreens. Thats the way I installed it. Will give it a try soon.

Today I was hitting a little problem. I have made A simple script that will change the volume and start a favorite of Kodi:

Code: Select all

if Alarm == 'Off' and Kodi == 'On' then
        print ('<font color="Green">Kodi gestopt? Start Radio</font>')
        commandArray['Kodi TV Woonkamer'] = 'Play Favorites 0'
        commandArray['Kodi TV Woonkamer'] = 'Set Volume 75'
The only thing that happens is that the Volume changes.

When I change the script to:

Code: Select all

if Alarm == 'Off' and Kodi == 'On' then
        print ('<font color="Green">Kodi gestopt? Start Radio</font>')
        commandArray['Kodi TV Woonkamer'] = 'Set Volume 75'
        commandArray['Kodi TV Woonkamer'] = 'Play Favorites 0'
The only thing that now happens is that the radio begins to play (favorite number 0).
So it looks like the second command is executed only?
Is it me or is here something wrong?

Greetings.
I think this has to be that you overwrite the command array items, so it will only execute the last item.
Have a look at the Wiki page with events, it states the following example for multiple commands for Lua:

Code: Select all

 commandArray = {}
 commandArray[1]={['OpenURL']='www.cam1.com/api/movecamtopreset.cgi' }
 commandArray[2]={['OpenURL']='www.cam2.com/api/movecamtopreset.cgi' }
 commandArray[3]={['OpenURL']='www.cam3.com/api/movecamtopreset.cgi' }
 return commandArray
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:
I installed Domoticz version: V3.6235 and it gives me this error at the restart of Domoticz:

Code: Select all

2016-12-25 15:44:01.665 PluginSystem: Failed dynamic library load, install the latest libpython3.x library that is available for your platform. 
The PATH is correct and I put the DLL file in the root of Domoticz. Python version: 35-32

@JammieJammie:
Thnx for pointing that out! I changed my Lua to this and it worked:

Code: Select all

if Alarm == 'Off' and Kodi == 'On' then
        print ('<font color="Green">Kodi gestopt? Start Radio 538</font>')
        commandArray[1]={['Kodi TV Woonkamer'] = 'Set Volume 75'}
        commandArray[2]={['Kodi TV Woonkamer'] = 'Play Favorites 0 AFTER 5'}
Didn't know of this solution before. When you switch some lights it works the "normal" way:

Code: Select all

if Switch1 == 'On' and Light1 == 'Off' then
        commandArray['Light1'] = 'On'
        commandArray['Light2'] = 'On'
Btw i'm using this script because when you play audio the volume is harder then playing a movie or video file. So when playing a video file it changes back to "Volume 100". Maybe handy for others.
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: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

Just wondering about the volume possibilities:

With a volume change, is that on Kodi only, (like Yatse changes the output volume towards the receiver only) or through Kodi (with CEC through HDMI) directly on the receiver (like the Domoticz remote control for Kodi does)?
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:Just wondering about the volume possibilities:

With a volume change, is that on Kodi only, (like Yatse changes the output volume towards the receiver only) or through Kodi (with CEC through HDMI) directly on the receiver (like the Domoticz remote control for Kodi does)?
I change the Kodi Volume with this command.
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 »

@Brutus, the Windows fix won't be available for a week because the pull request hasn't been merged due to a build error on OSX. The Python version has been updated to 3.6 on the OSX build server and it can't find the include files.

I'm away from home this week and will look at it when I return
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: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

Dnpwwo wrote:... The Python version has been updated to 3.6 on the OSX build server and it can't find the include files.

I'm away from home this week and will look at it when I return
Is there an update on the Domoticz side that we can use to try again with the Kodi plugin?
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by tjabas »

Is it possible to update the kodi plugin in Domoticz? I have read some posts here, but im not sure if its possible to update or not, and how can i get Domoticz to see more commands from kodi, as for now all Domoticz can see is play and pause in the Domoticz log.
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 »

@jake, no update yet but I have realised why Python 3.2 is not working. It works if you build Domoticz from source but not if you download updates.

Sadly this is not fixable so the minimum supported Python version will need to be 3.4 :(

Ideally people should move from the old Wheezy operating system to the newer Jessie (which has 3.4) but I appreciate that it is a hassle so I will look into documenting how to build Python from source. Several people have tried this but Domoticz still couldn't find Python afterwards so I need too understand why.

Seems the best way forward overall.

@tjabas,

There is no upgrade to the current Kodi plugin but there is an early beta of a new one. If you are running the beta version you can follow instructions in this thread although Windows will not work for at least the next few days.
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
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kodi Mediaserver Support

Post by tjabas »

Dnpwwo wrote:@jake, no update yet but I have realised why Python 3.2 is not working. It works if you build Domoticz from source but not if you download updates.

Sadly this is not fixable so the minimum supported Python version will need to be 3.4 :(

Ideally people should move from the old Wheezy operating system to the newer Jessie (which has 3.4) but I appreciate that it is a hassle so I will look into documenting how to build Python from source. Several people have tried this but Domoticz still couldn't find Python afterwards so I need too understand why.

Seems the best way forward overall.

@tjabas,

There is no upgrade to the current Kodi plugin but there is an early beta of a new one. If you are running the beta version you can follow instructions in this thread although Windows will not work for at least the next few days.

ok, thanks.
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

Dnpwwo wrote:@jake, no update yet but I have realised why Python 3.2 is not working. It works if you build Domoticz from source but not if you download updates.

Sadly this is not fixable so the minimum supported Python version will need to be 3.4 :(

Ideally people should move from the old Wheezy operating system to the newer Jessie (which has 3.4) but I appreciate that it is a hassle so I will look into documenting how to build Python from source. Several people have tried this but Domoticz still couldn't find Python afterwards so I need too understand why.

Seems the best way forward overall.
I just did that and now running Jessie with Python 3.4.2:

Code: Select all

 2017-01-06 22:53:43.771 Domoticz V3.6312 (c)2012-2017 GizMoCuz
2017-01-06 22:53:43.777 Build Hash: 6da08af, Date: 2017-01-05 17:53:30
2017-01-06 22:53:43.778 System: Raspberry Pi
2017-01-06 22:53:43.778 Startup Path: /home/pi/domoticz/
2017-01-06 22:53:44.133 EventSystem: reset all events...
2017-01-06 22:53:45.992 PluginSystem: Started, Python version '3.4.2'.
2017-01-06 22:53:46.061 WebServer(HTTP) started on address: :: with port 8080
2017-01-06 22:53:46.092 WebServer(SSL) started on address: :: with port 443
2017-01-06 22:53:46.102 Proxymanager started.
2017-01-06 22:53:46.117 TCPServer: shared server started...
2017-01-06 22:53:46.118 RxQueue: queue worker started...
2017-01-06 22:53:48.122 Pinger: Started
2017-01-06 22:53:48.123 Kodi: Started
2017-01-06 22:53:48.124 WOL: Started
2017-01-06 22:53:48.125 P1 Smart Meter: Using serial port: /dev/ttyAMA0
2017-01-06 22:53:48.127 PVOutput (Input): Worker started...
2017-01-06 22:53:48.127 Wunderground: Worker started...
2017-01-06 22:53:48.129 EventSystem: reset all events...
2017-01-06 22:53:48.137 EventSystem: reset all device statuses...
2017-01-06 22:53:48.155 EventSystem: Started
2017-01-06 22:53:48.170 PluginSystem: Entering work loop.
2017-01-06 22:53:48.628 OpenZWave: Starting...
2017-01-06 22:53:48.628 OpenZWave: Version: 1.4-2279-g7c8c27d-dirty
2017-01-06 22:53:48.629 OpenZWave: using config in: /home/pi/domoticz/Config/
2017-01-06 22:53:49.661 OpenZWave: Driver Ready
2017-01-06 22:53:50.145 Fritzbox: connected to: 192.168.1.254:1012
2017-01-06 22:53:50.146 OTGW: connected to: 127.0.0.1:7689 
Anyway, I was ready to add the Kodi hardware again, only I don't find it in the list of hardware anymore, the 'Kodi Media Server' is the only Kodi* hardware out there.
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 »

@Jake,

Things are still evolving a little while the Python Framework is in Beta.

If you are running the latest version then you will need to create a directory under the plugins directory (I called my 'Kodi') and drop the file in there. You will also need to rename it 'plugin.py'.
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: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: RE: Re: Kodi Mediaserver Support

Post by jake »

Dnpwwo wrote:@Jake,

Things are still evolving a little while the Python Framework is in Beta.

If you are running the latest version then you will need to create a directory under the plugins directory (I called my 'Kodi') and drop the file in there. You will also need to rename it 'plugin.py'.
Well, that worked. I needed to restart the domoticz service, but finally... yes, the devices are created!

To enable the switches to work, I needed to disable the 'Kodi Meda Server' first.

Update: when I click on the volume switch, on the loud speaker icon, Kodi goes to 'mute', while the switch remains 'on' and the volume on '100%'. What is worse, the volume doesn't come back 'on' again, until I go to the Kodi app and undo 'mute'

@Dnpwwo Do you mind if I post more findings/bugs or is this trial just published to have a general overview of the possibilities out there?
Last edited by jake on Saturday 07 January 2017 23:24, edited 1 time in total.
Trigun
Posts: 390
Joined: Wednesday 30 November 2016 11:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Kodi Mediaserver Support

Post by Trigun »

Hi All,

I hope if anyone can help me.
I am looking to find a way to control Kodi with domoticz.
I was thinking of using a multi selector switch with, for example: Play, Pauze, Stop.

Is there an easy way to do this?
I am new to scripting though :(


Thnx in advance!

PS. I use a raspberry Pi 3 with an Aeon stick Gen 5
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Kodi Mediaserver Support

Post by jake »

Trigun wrote:Hi All,

I hope if anyone can help me.
I am looking to find a way to control Kodi with domoticz.
I was thinking of using a multi selector switch with, for example: Play, Pauze, Stop.

Is there an easy way to do this?
I am new to scripting though :(
Have a look first of all on the Kodi wiki page on domoticz.com. The 'standard' Kodi hardware support already offers a play pause stop through LUA
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest