-
-
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
[androidtv] Adds CLI Interface #15146
Conversation
Signed-off-by: Ben Rosenblum <[email protected]>
Signed-off-by: Ben Rosenblum <[email protected]>
Successful test:
|
Signed-off-by: Ben Rosenblum <[email protected]>
Signed-off-by: Ben Rosenblum <[email protected]>
.../src/main/java/org/openhab/binding/androidtv/internal/console/AndroidTVCommandExtension.java
Outdated
Show resolved
Hide resolved
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 may cause issues with some Markdown renderers as indicated by SAT: https://ci.openhab.org/job/PR-openHAB-Addons/16042/Static_20Code_20Analysis_20Report/
Signed-off-by: Ben Rosenblum <[email protected]>
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. I have one doubt/concern about this approach: This generic way to update any channels kind of short-circuits the principle to integrate through items. For items there is already a console command that can be used with any binding: openhab:update
. Also, there is now a dependency to the PIN code channel for this process.
.../src/main/java/org/openhab/binding/androidtv/internal/console/AndroidTVCommandExtension.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/openhab/binding/androidtv/internal/console/AndroidTVCommandExtension.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/openhab/binding/androidtv/internal/console/AndroidTVCommandExtension.java
Outdated
Show resolved
Hide resolved
|
||
@NonNullByDefault | ||
@Component(service = ConsoleCommandExtension.class) | ||
public class AndroidTVCommandExtension extends AbstractConsoleCommandExtension { |
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 could consider implementing ConsoleCommandCompleter
for tab completion.
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.
Absolutely agreed and it's on my list. I wanted to get the i18n bits sorted first to reduce duplicate work. That PR is pending.
I don't disagree that it does create a short cut, but I don't think people are interacting with OH at the console level where it would be a problem. The problem is that the way the binding is structured, with the single Handler and the individual protocol ConnectionManagers, the PIN logic would have to be significantly altered. Also, as I add additional protocols (both Philips and Sony are on my radar right now), it would increase complexity. This keeps the logic in one place and just allows a different entry point. Also, this makes it slightly easier to troubleshoot and test the binding. |
Signed-off-by: Ben Rosenblum <[email protected]>
@jlaur I pushed a commit to update the typographical changes as requested. |
The problem I see with this, is that you have implemented a generic way to interact with channels through the console. If this is accepted, it would better to implement in core, so all bindings would have this possibility in a consistent way. Otherwise any binding could implement this in its own way, and this binding would have created precedence for that.
I haven't checked the code yet, so can't comment on that, but it seems like you want to introduce the channel approach as a work-around for the current binding design? To add some additional context, see also #15134 (comment) I will let @wborn decide as he already reviewed and approved. I have expressed my point of view. |
No disagreement, this would be better done at the core level for every binding. Perhaps that's something to tag as a feature for 4.1.0. To play devils advocate, OH has never been a platform to force users to do things in a particular way. When I wrote this PR it made logical sense to me to enable the users to interact with the binding how they saw fit. Either via the item, through the API, or the cli, whichever they found easier or more appropriate for their use case. And I wouldn't call it a work around either. I chose to implement in this manner. That's not to discredit my previous statement that the binding would require restructuring, but that's not due to any design failing. The original design executes pin through an item, hence the logic being in the handleCommand side. This enhancement is providing access to that from another mechanism. I've personally found access to some of the other channels helpful during initial setup as well, so I don't want to create an artificial limitation either. EDIT: I'll give a slightly different example. AndroidTVPKI shouldn't exist either. Those kind of PKI functions absolutely should exist in the core. Unfortunately, they just don't yet. I have a PR started to merge them into core for 4.1.0. When that happens, ill adapt this binding to use that instead. |
@wborn thoughts? Feature freeze is ~72 hours out and I'd really like to get this in for the release. |
I'm OK with merging this to get the functionality into OH 4.0 and then adapt it to the generic approach in OH 4.1! 🙂 |
Thank you! |
openhab/openhab-core#3705 has been opened to track moving this into the core. |
Signed-off-by: Ben Rosenblum <[email protected]> Signed-off-by: Jørgen Austvik <[email protected]>
Adds a CLI interface for the androidtv binding.
Resolves #15143