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] Add PhilipsTV protocol to AndroidTV #15352

Merged
merged 71 commits into from Feb 9, 2024

Conversation

morph166955
Copy link
Contributor

@morph166955 morph166955 commented Aug 1, 2023

Adds the PhilipsTV protocol to the AndroidTV binding. The current PhilipsTV binding (which is not merged into the main repo) currently has no active mainteance. As (almost all) of the PhilipsTVs over the last several years are AndroidTV based, it is natural to add this in. The GoogleTV protocol stack will still act as the primary control mechanism. This adds vendor specific features (e.g. Ambilight) which are not available on the GoogleTV stack currently. This is conceptually identical to how the ShieldTV protocol works in the AndroidTV binding.

Depends on #16191

@morph166955 morph166955 added enhancement An enhancement or new feature for an existing add-on work in progress A PR that is not yet ready to be merged labels Aug 1, 2023
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/philips-tv-2016-binding/64579/382

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

c090110 is tested to work as similar to the existing code. Currently throwing the following exceptions:

2023-08-06 15:54:02.073 [WARN ] [rotocol.philipstv.service.AppService] - Error occurred during handling of command for apps: Cannot invoke "org.openhab.binding.androidtv.internal.AndroidTVDynamicStateDescriptionProvider.setStateOptions(org.openhab.core.thing.ChannelUID, java.util.List)" because "this.stateDescriptionProvider" is null
java.lang.NullPointerException: Cannot invoke "org.openhab.binding.androidtv.internal.AndroidTVDynamicStateDescriptionProvider.setStateOptions(org.openhab.core.thing.ChannelUID, java.util.List)" because "this.stateDescriptionProvider" is null
	at org.openhab.binding.androidtv.internal.protocol.philipstv.PhilipsTVConnectionManager.updateChannelStateDescription(PhilipsTVConnectionManager.java:440) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.service.AppService.handleCommand(AppService.java:83) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.PhilipsTVConnectionManager.refreshTvProperties(PhilipsTVConnectionManager.java:426) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	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) ~[?:?]
2023-08-06 15:40:01.055 [WARN ] [ocol.philipstv.service.VolumeService] - Error during handling the VolumeService command REFRESH for Channel volume: status code: 401, reason phrase: The given username/password combination is invalid.
org.apache.http.client.HttpResponseException: status code: 401, reason phrase: The given username/password combination is invalid.
	at org.openhab.binding.androidtv.internal.protocol.philipstv.ConnectionManager.validateResponse(ConnectionManager.java:93) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.ConnectionManager.doHttpsGet(ConnectionManager.java:68) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.service.VolumeService.getVolume(VolumeService.java:88) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.service.VolumeService.handleCommand(VolumeService.java:63) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.PhilipsTVConnectionManager.refreshTvProperties(PhilipsTVConnectionManager.java:425) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	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) ~[?:?]
2023-08-06 16:04:43.490 [WARN ] [ocol.philipstv.service.VolumeService] - Error during handling the VolumeService command REFRESH for Channel volume: Connect to 192.168.1.57:1926 [/192.168.1.57] failed: Verbindungsaufbau abgelehnt
org.apache.http.conn.HttpHostConnectException: Connect to 192.168.1.57:1926 [/192.168.1.57] failed: Verbindungsaufbau abgelehnt
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156) ~[?:?]
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) ~[?:?]
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) ~[?:?]
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[?:?]
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[?:?]
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[?:?]
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[?:?]
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[?:?]
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.ConnectionManager.doHttpsGet(ConnectionManager.java:67) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.service.VolumeService.getVolume(VolumeService.java:88) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.service.VolumeService.handleCommand(VolumeService.java:63) ~[?:?]
	at org.openhab.binding.androidtv.internal.protocol.philipstv.PhilipsTVConnectionManager.refreshTvProperties(PhilipsTVConnectionManager.java:425) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	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) ~[?:?]
Caused by: java.net.ConnectException: Verbindungsaufbau abgelehnt
	at sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]
	at sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]
	at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:554) ~[?:?]
	at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:602) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]
	at java.net.Socket.connect(Socket.java:639) ~[?:?]
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368) ~[?:?]
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) ~[?:?]
	... 18 more

@morph166955
Copy link
Contributor Author

morph166955 commented Aug 7, 2023

Open Items:

  • Update README
  • Move Username/Password/MAC to stored json file
  • Move PIN to channel
  • Normalize channel names
  • Normalize thing configuration
  • Update i18n with TranslationProvider
  • Rename ConnectionManager to avoid confusion with PhilipsTVConnectionManager
  • Resolve exceptions
  • Add NonNullByDefault to Dto models
  • Resolve remaining SAT issues
  • Add app channel
  • Change app channel to accept dn commands
  • Update ATV command handler
  • Resolve compiler warnings/info
  • Enable GTV and validate
  • Update port names across protocols
  • Move volume, mute, and potentially player from GTV to PTV

morph166955 and others added 16 commits August 8, 2023 09:45
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
…yPress.

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>
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

@openhab/add-ons-maintainers I've updated this PR for 4.2 and rebased. I'd really appreciate if someone could do a review on this. I have several things I want to do with this binding in early 2024 but I don't want to get that moving until this is squared away given the amount of changes this makes to the structure across. Thank you in advance for the time!

@morph166955
Copy link
Contributor Author

I've pulled some of the non-Philips specific updates out and put them into #16191 to try to make the review process a little easier and to unencumber updates/work to the androidtv binding with the review cycles for this PR. This PR will need to be rebased once 16191 is merged in.

morph166955 and others added 2 commits January 2, 2024 17:53
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/androidtv-binding-3-2-0-4-1-0/142203/526

morph166955 and others added 4 commits January 12, 2024 12:50
Signed-off-by: morph166955 <53797132+morph166955@users.noreply.github.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/androidtv-binding-3-2-0-4-1-0/142203/529

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

Thanks, great to have improved support for Philips TV's.
Beside he inline comments, can you also fix the SAT warnings (renaming DTO, allready fixes many see: https://www.openhab.org/docs/developer/guidelines.html#null-annotations)

@morph166955
Copy link
Contributor Author

Thank you @lsiepel ! I may actually have time to address this today! I'm going to put a few comments above while this is fresh.

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

@lsiepel I think I'm there now. I believe everything that needed to be resolved is now pushed. Please let me know what I missed if anything. Thanks!

@lsiepel
Copy link
Contributor

lsiepel commented Jan 21, 2024

@lsiepel I think I'm there now. I believe everything that needed to be resolved is now pushed. Please let me know what I missed if anything. Thanks!

Allmost there. Some last things that need to be looked at (mainly note to self):

  • translation from constant
  • dependencies both feature.xml and pom.xml (only two open comments)
  • PhilipsTVPairing.java => please fix NoEmptyLineSeparatorCheck

@morph166955
Copy link
Contributor Author

Sounds good. Standing by here for the comments on the remaining parts.

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

  • PhilipsTVPairing.java => please fix NoEmptyLineSeparatorCheck

I just pushed the fix for this.

@morph166955
Copy link
Contributor Author

@lsiepel checking in to see if you've had time to look at the last few bits so we can merge this in. Thanks!

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

@lsiepel lsiepel merged commit e4d5ae0 into openhab:main Feb 9, 2024
3 checks passed
@lsiepel lsiepel added this to the 4.2 milestone Feb 9, 2024
@morph166955
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants