Skip to content
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

[androidtv] AndroidTV Binding initial contribution #14282

Merged
merged 109 commits into from
Jun 26, 2023

Conversation

morph166955
Copy link
Contributor

@morph166955 morph166955 commented Jan 26, 2023

This is the initial contribution of the AndroidTV binding. AndroidTV has a unique place in the market where it exists in several different vendors in the market. This creates the basic binding framework and adds the Nvidia ShieldTV protocol (which was reverse engineered from the Nvidia ShieldTV Android App) and version 2 of the GoogleTV protocol (which was reverse engineered from the GoogleTV Android App). Discovery is provided by mDNS.

All devices use the GoogleTV protocol as the base for command/control/information. The Nvidia ShieldTV adds the ShieldTV protocol on top for additional metadata and application control.

This version provides connectivity, authentication via the on-screen PIN based process, PKI support for certificates, keypress support for all identified keys, and app control/awareness/information.

This is a follow-on to the original shieldtv PR (#13934) which was closed in favor of a more encompassing androidtv binding to better support the community.

Fixes #14315

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Reduces functions in handler.

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955 morph166955 requested a review from a team as a code owner January 26, 2023 21:09
@morph166955
Copy link
Contributor Author

morph166955 commented Jan 26, 2023

A test jar is available through the marketplace at https://community.openhab.org/t/androidtv-binding-3-2-0-4-0-0/142203

@lolodomo lolodomo added the new binding If someone has started to work on a binding. For a new binding PR. label Jan 27, 2023
morph166955 and others added 11 commits January 27, 2023 11:31
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955
Copy link
Contributor Author

morph166955 commented Feb 1, 2023

Created:

openhab/openhab-docs#2001 (Now merged)

and

#14315

As per guidelines

morph166955 and others added 10 commits February 2, 2023 07:26
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Adds DynamicCOmmandDescriptionProvider and bug fixes
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955
Copy link
Contributor Author

I'm OK with this, although it would be preferable to do now to avoid update instructions for removing the obsolete channel again.

Just to be clear on my intentions, I'm fine with adding the CLI commands as an alternative however I'm going to leave the channel in place as well as some users do prefer this method. Also, as this has been on the marketplace for 6 months now we would already have to update there anyway.

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955
Copy link
Contributor Author

Updated to the newest snapshot and I'm getting an NPE on start. Just pushed a commit to resolve that.

2023-05-22 08:58:54.129 [ERROR] [y.mdns.internal.MDNSDiscoveryService] - Participant 'org.openhab.binding.androidtv.internal.discovery.GoogleTVDiscoveryParticipant' threw an exception
java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "javax.jmdns.ServiceInfo.getPropertyString(String)" is null
        at org.openhab.binding.androidtv.internal.discovery.GoogleTVDiscoveryParticipant.getThingUID(GoogleTVDiscoveryParticipant.java:101) ~[?:?]
        at org.openhab.binding.androidtv.internal.discovery.GoogleTVDiscoveryParticipant.createResult(GoogleTVDiscoveryParticipant.java:78) ~[?:?]
        at org.openhab.core.config.discovery.mdns.internal.MDNSDiscoveryService.createDiscoveryResult(MDNSDiscoveryService.java:222) ~[?:?]
        at org.openhab.core.config.discovery.mdns.internal.MDNSDiscoveryService.considerService(MDNSDiscoveryService.java:214) ~[?:?]
        at org.openhab.core.config.discovery.mdns.internal.MDNSDiscoveryService.serviceResolved(MDNSDiscoveryService.java:207) ~[?:?]
        at javax.jmdns.impl.ListenerStatus$ServiceListenerStatus.serviceResolved(ListenerStatus.java:106) ~[?:?]
        at javax.jmdns.impl.JmDNSImpl$1.run(JmDNSImpl.java:911) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

@morph166955
Copy link
Contributor Author

@wborn checking in again on this. We're getting close to the code getting locked for the 4.0.0 release and I'd really like to get this merged in for that. Thanks!

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955
Copy link
Contributor Author

Google updated the GoogleTV protocol to version 4.39. Two minor commits have be pushed to update the login string to resolve an issue posted to the forum and to make a few small changes to the checks and logging for the PIN process.

@jlaur
Copy link
Contributor

jlaur commented Jun 3, 2023

@wborn - what is the status of your review?

@morph166955
Copy link
Contributor Author

@wborn Please let me know if there's anything else for this. Thanks!

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments. 👍
Sorry, I was a bit busy but I've added a few more comments below:

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955
Copy link
Contributor Author

morph166955 commented Jun 11, 2023

@wborn I've pushed several commits to resolve the bulk of the comments. I've left comments on the rest for your consideration.

EDIT: Also to note, I've not had time to do thorough regression testing on these changes. I don't see any reason they should fail, and they all compile clean, but just noting for record.

@morph166955
Copy link
Contributor Author

@wborn Checking in to see if there's anything else on this.

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments! I've added a few more below. After that I think it's nice and clean. 🙂

Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@morph166955
Copy link
Contributor Author

@wborn I've pushed the fixes as requested. I'm going to push the current code to the addon marketplace as well.

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks! 👍 Let's merge it! 🚀

@wborn wborn merged commit 46039ef into openhab:main Jun 26, 2023
@wborn wborn added this to the 4.0 milestone Jun 26, 2023
@morph166955
Copy link
Contributor Author

Thank you @wborn!

@jlaur I haven't forgotten you, I'll be working on those follow-on PRs in the next few days in hopes to get them pulled in prior to the final 4.0.0 release.

@morph166955 morph166955 deleted the androidtv branch June 26, 2023 12:24
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Aug 9, 2023
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Matt Myers <mmyers75@icloud.com>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New binding for AndroidTV
5 participants