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

[bug] Android TV: Input Sources don't include HDMI #128

Open
1 task done
uvjim opened this issue Oct 17, 2023 · 11 comments
Open
1 task done

[bug] Android TV: Input Sources don't include HDMI #128

uvjim opened this issue Oct 17, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@uvjim
Copy link

uvjim commented Oct 17, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Description

As per the following screenshot. I am unable to select an HDMI input from the sources list for the "On Sequence".
I'm not sure if this was previously possible as I still haven't been able to setup any parts of the remote as I would like.

image

How to Reproduce

  1. Add the Android TV integration
  2. Try to create an Activity that sets the source

Expected behavior

The ability to select an HDMI source.

System version

v1.4.2

What part of the system affected by the problem?

No response

Additional context

No response

@uvjim uvjim added the bug Something isn't working label Oct 17, 2023
@kennymc-c
Copy link

I can confirm this for my Sony XE9005. For me it was also never possible to set anything else than any of the installed apps instead of an actual input of the tv.
There are also other missing tv function in the Android TV integrations: #92

@zehnm
Copy link

zehnm commented Oct 18, 2023

The current input sources are a static list of well-known Android apps.
Unfortunately, there's currently no way to retrieve all apps and physical inputs with the Android TV library we are using.
User editing of the pre-defined apps is in the backlog.

However, quickly checking the library, there are key commands to switch inputs!
https://github.com/tronikos/androidtvremote2/blob/v0.0.14/src/androidtvremote2/remotemessage.proto#L681-L731

We'll try this, if it works, we include all of them as input sources. Better too many non-existing inputs than none ;-)

@zehnm
Copy link

zehnm commented Nov 3, 2023

Release 1.4.5 contains a test mode in the REST API for the mentioned input keys.
Unfortunatly we only have Android media players, but no access at the moment to real TVs running Android TV.
Could someone please test this and report back?

If input switching works, we'll either integrate it in the available sources, or prioritize either the "special entity commands" for media-players or supporting a "remote-entity".

PUT /api/entities/:entityId/command

{
  "cmd_id": "select_source",
  "params": {
      "source": "HDMI 1"
  }
}

The following inputs are available, use the key as value in params.source:

KeyCode = {
    "HDMI 1": "KEYCODE_TV_INPUT_HDMI_1",
    "HDMI 2": "KEYCODE_TV_INPUT_HDMI_2",
    "HDMI 3": "KEYCODE_TV_INPUT_HDMI_3",
    "HDMI 4": "KEYCODE_TV_INPUT_HDMI_4",
    "Toggle Antenna / Cable": "KEYCODE_TV_ANTENNA_CABLE",
    "Toggle Network": "KEYCODE_TV_NETWORK",
    "Satellite": "KEYCODE_TV_SATELLITE",
    "Analog TV": "KEYCODE_TV_TERRESTRIAL_ANALOG",
    "Digital TV": "KEYCODE_TV_TERRESTRIAL_DIGITAL",
    "Composite 1": "KEYCODE_TV_INPUT_COMPOSITE_1",
    "Composite 2": "KEYCODE_TV_INPUT_COMPOSITE_2",
    "Component 1": "KEYCODE_TV_INPUT_COMPONENT_1",
    "Component 2": "KEYCODE_TV_INPUT_COMPONENT_2",
    "VGA 1": "KEYCODE_TV_INPUT_VGA_1",
}

curl example:

curl --request PUT http://$IP/api/entities/$ENTITY_ID/command \
--header 'Content-Type: application/json' \
--user web-configurator:$PIN \
--data '{
  "cmd_id": "select_source",
  "params": { "source": "HDMI 1" }
}'

Expected response: {"code":"OK","message":"Command executed"}

  • $IP: ip or hostname of your remote
  • $PIN: your web-configurator pin
  • $ENTITY_ID: Android TV media-player entity identifier. Starts with uc_androidtv_driver.main.
    • Can be retrieved with: GET /api/entities?entity_types=media_player&intg_ids=uc_androidtv_driver.main
    • Or by editing the media-player entity in the integration page of the web-configurator: -> entity-id is below the title
image

@kennymc-c
Copy link

Unfortunately, it doesn't seem to work on my Sony XE9005 with Android TV 9. I get a command executed as feedback but the input is not changed and nothing happens.

@uvjim
Copy link
Author

uvjim commented Nov 3, 2023

Same here unfortunately. I've attempted a couple of HDMI sources, but nothing happened on the TV. The TV is a Sony KD-65XF9005

image

@zehnm
Copy link

zehnm commented Nov 7, 2023

Thanks for the feedback @kennymc-c @uvjim

To users with other Android TV models & brands: please add a comment if any of the inputs mentioned above work or not.

@zehnm
Copy link

zehnm commented Nov 8, 2023

It seems like a general issue, that the INPUT keys don't work: tronikos/androidtvremote2#10
Let's hope someone figures it out, until then, we can't do anything unfortunately.
If companies would only release public APIs...

@einfall
Copy link

einfall commented Nov 12, 2023

isn't working here too.

With adb its working:
HDMI 1

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHDMI100004

HDMI 2
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW6

HDMI 3
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW7

HDMI 4

adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.mediatek.tvinput%2F.hdmi.HDMIInputService%2FHW8

@einfall
Copy link

einfall commented Nov 12, 2023

you could do a trick over HA with ADB Bridge as Script.
https://www.home-assistant.io/integrations/androidtv/

androidtv_ha_Script

@uvjim
Copy link
Author

uvjim commented Nov 18, 2023

Whilst this may not help others... It's possible that once the HEOS integration is released I may not need to switch inputs using the Android TV integration. The HEOS may do that for me. Will need to test when it's released.

@uvjim
Copy link
Author

uvjim commented Mar 17, 2024

I've come back to this again whilst trying again to configure the remote. Looking at the Bravia TV integration for Home Assistant, this is possible - well, at least for Bravia TVs. The media_player entity in Home Assistant exposes the available sources as a list that you can select from and switch. I have just tested and that seems to work on my TV without issue.

Is it possible to look at this and see if a similar method can be used in the UC Android TV integration? I already have Home Assistant running so I may need to switch to using that as a proxy for controlling the TV if not - I was hoping to minimise dependencies between systems though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Reported
Development

No branches or pull requests

4 participants