-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial commit of the kodi binding #1262
Conversation
Thanks to @Pail for implementing this binding. I have tried it with my Kodi installation and the first tests looks very good. I have still some comments/questions:
As far as I can see only one class in the binding needs to be modified to introduce jetty. I can try it in the next days. |
Definitely yes! |
@MHerbst the binding also works for videos. PVRs are not supported at the moment since I don't use kodi as a PVR. Maybe somebody who uses the PVR functionality could extend this binding once this PR is merged. |
FYI: openhab/openhab-distro#329 |
Thanks @kaikreuzer. That was really fast. @pail23 I just tested it with a movie and video and everything works fine. Don't know why I thought that there was missing something ... Maybe you can add an additional channel to display the media type. The old XMBC binding has got a property "Player.Type". If you have problems with the migration you can leave me a message and then I can try to help. |
- Added media type channel - Added the AudioSink support Signed-off-by: Paul Frank <[email protected]>
@MHerbst I have tried to migrate the binding to websocket. Preliminary tests have been successful. It would be great if you could test as well and provide me feedback. I have also added the mediatype channel. |
Great @pail23 ! Will test it this weekend. |
<option value="Select">Select</option> | ||
<option value="Back">Back</option> | ||
<option value="Home">Home</option> | ||
<option value="ContextMenu">Conext Menu</option> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a typo. Should be "Context menu"
} else if (method.startsWith("GUI.OnScreensaver")) { | ||
processScreensaverStateChanged(method, params); | ||
} else { | ||
logger.warn("Received unknown method: {}", method); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better so reduce the warning level to debug. When Kode updates its library e.g. there are a log of messages like this:
2016-11-26 11:33:36.524 [WARN ] [b.kodi.protocol.KodiConnection:341 ] - Received unknown method: AudioLibrary.OnUpdate
I have also seen several other methods that are not handled (and don't need to be handled). So I think level "debug" would be sufficient.
Hi Paul, Here two additional remarks:
|
I forgot one remark: you have add a new channel to the binding ("mediatype"). After I started openHAB with an existing configuration the new channel was not visible within Paper UI in the Kodi thing. I had to remove and add the thing again. I am not sure whether this is a problem in the (Smarthome) runtime or whether the binding has to implement something to refresh the channel. |
Hello Paul and thanks for implementing that binding. As an intensive user of Kodi I really appreciate it. Is this a new development or is it based on the xbmc binding? I had a quick look at the README and I think it should be extended by more details before the merge of this PR @kaikreuzer. |
Signed-off-by: Paul Frank <[email protected]>
Hi @MHerbst Thanks for testing and reviewing. I have update the PR based on your comments @ThomDietrich This binding was orignially based on the OH1 xbmc binding, but in the meanwhile it's quite different. As an example: The new binding uses only web socket communication, whereas the the OH1 binding also uses http communication. I can try to work on the README. Nevertheless I appreciate also contributions from others ;-) |
Hi @pail23 thanks :-). Will try it in the next days. I hope I'll be able to send you a properties file with german translations until end of this week. Maybe you have already seen the issue regarding #1496 regarding national characters. In the meantime I was able to add a PVR add-on to my Kodi installation. So I can try to add PVR support and the functionality would be similar to the old XMBC binding. |
This is indeed a known issue. I have just created eclipse-archived/smarthome#2555, so it can be addressed in future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution!
I managed to reduce the LOCs by half by removing superfluous empty lines ;-)
Love to see it merged soon! Please also add it to the binding/pom.xml and the feature.xml.
When testing, my Kodi stayed in "INITIALIZING" status, i.e. it never went ONLINE or OFFLINE. Does this work for you? Maybe check if this status update mechanism can be somehow improved. Thanks!
http://www.eclipse.org/legal/epl-v10.html | ||
|
||
--> | ||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.onkyo" activate="activate"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.openhab.onkyo -> org.openhab.kodi
|
||
## Binding Configuration | ||
|
||
The binding can auto-discover the Kodi players present on your local network. The auto-discovery is enabled by default. To disable it, you can create a file in the services directory called Kodi.cfg with the following content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should actually be in the "Discovery" section. And no need to create a Kodi.cfg file; instead, the line should be added to conf/services/runtime.cfg.
The binding can auto-discover the Kodi players present on your local network. The auto-discovery is enabled by default. To disable it, you can create a file in the services directory called Kodi.cfg with the following content: | ||
|
||
``` | ||
org.openhab.Kodi:enableAutoDiscovery=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
org.openhab.Kodi -> org.openhab.kodi
|
||
The Kodi player thing requires the ip address and the port to access it on. | ||
In the thing file, this looks e.g. like | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an empty line above code sections as otherwise Jekyll breaks the layout.
In the thing file, this looks e.g. like | ||
``` | ||
Kodi:Kodi:myKodi [ipAddress="192.168.1.100", port="9090"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing the closing ``` here.
logger.error("exception during connect to " + wsUri.toString(), t); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
|
||
public void input(String key) { | ||
socket.callMethod("Input." + key); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
JsonObject params = new JsonObject(); | ||
params.addProperty("text", text); | ||
socket.callMethod("Input.SendText", params); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
|
||
public void playNotificationSoundURI(String uri) { | ||
playURI(uri); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
playURI(uri); | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove empty line
Hey guys, this might be too early in the development process: I want to point out, that the README.md in this PR lacks some information and clarity. It would be amazing if this would get sorted out before the binding is merged. |
I definitely have this enabled, yes. Still, it stays in INITIALIZING. @ThomDietrich What information and clarity do you exactly miss? Imho, the readme is ok, at least for people that already know what Kodi is. |
@kaikreuzer my remark was more aimed at little details like capitalization or clarity of certain terms. I've got one question. The former xbmc binding had a lot more properties/channels (e.g. the show title). Are you going to add these as well? |
- improved the online/offline state handling Signed-off-by: Paul Frank <[email protected]>
@kaikreuzer The status goes no to OFFLINE after startup if there is no connection to kodi |
Thanks @pail23! Now I only need to figure out, why it isn't connecting in my case... |
@pail23 @ThomDietrich I have a now PVR support (for T-Entertain) running in my Kodi installation and can work on it. I just wanted to wait until a first version of the binding was merged. |
@pail23 What about data like the show title? I think there is more available than the PVR related stuff... |
@ThomDietrich I have added code to read the show title from kodi and add it to the title channel. I was not able to play something in kodi which has a non empty showtitle. It would be great if you could test this. |
Hey pail, I'm not in my home for 1-2 weeks. That will make it difficult to test with my Kodi instance. In my current setup I've got the following two items:
These items normally behave in the following way: Only a show has a ShowTitle. Pretty easy to identify. Thanks for adding the show title but please do not just add it to the title channel with a " - " in between. That's not how I want to use it and others might also have their own ideas... Would you consider provide it as its own channel? |
- Implemented a systemcommand channel which allows to hibernat/shutdown/... Signed-off-by: Paul Frank <[email protected]>
@ThomDietrich I have seperated the show title now. My first intend with the merged title was to save real estate on the screen when displaying these values. But this can also easily be achieved with a simple rule concatinating the 2 values. |
Wonderful. Thank you. I will be happy to test this binding and report my findings after it got merged. Is anything still stopping this? |
on my to-do list for today! |
I finally figured out why I wasn't able to connect: I was using Kodi 17 alpha and this simply didn't allow remote applications... The beta now works nicely :-)
Shall we maybe define the channel as "advanced" then? I don't really like to see this empty field there by default... "mediatype" imho should also be marked advanced. But apart from that, I don't have any further remarks, so let's merge - many thanks, it is a cool feature! |
Great. This makes it easier to add some additional (still missing) features to have a full replacement of the older version. |
@kaikreuzer could you (to me as a non binding developer) explain which implications "advanced" would have? |
"advanced" means that it is only shown when you click "more" in the Paper UI and that in simple mode, it isn't linked by default. |
@pail23 I just saw that the merged readme.md does not contain a "Full Example" :( Would you care to add one? |
@pail23 |
Dear @pail23, thank you for your new binding. Everything works so far for me. But I have two questions:
Thank you! |
* Initial commit of the kodi binding Signed-off-by: Paul Frank <[email protected]>
Signed-off-by: Kai Kreuzer <[email protected]>
…b#1262) Signed-off-by: Hilbrand Bouwkamp <[email protected]>
This is the initial commit for a kodi (https://kodi.tv/) binding.