ollo69 / ha-androidtv-custom

Home Assistant custom component for AndroidTV based on native integration
Apache License 2.0
17 stars 0 forks source link

SURVEY: Customizable commands used #1

Open ollo69 opened 2 years ago

ollo69 commented 2 years ago

I open this survey with the purpose to collect the customizable command used in the configuration option. This would probably help to understand the right command to use for different AndroidTV models and find a method to implement this in backend library.

Please provide:

Thanks.

glassbase commented 2 years ago

Onn Android TV with OS 10 current app: dumpsys activity a . | grep -E 'mResumedActivity' | cut -d ' ' -f 8 | cut -d '/' -f 1 ** this untested with your custom component, it was merely what I figured out using adb_response with official component.

(I am not an expert with this type of coding (grep, etc) but this is what I figured out so far)

glassbase commented 2 years ago

Based on my experience with this Onn with OS 10 with official component: app_id, app_name, source is never populated. So do we need a way to create custom command to get current app?

GET_PROPERTIES from official component:

{
  "screen_on": true,
  "awake": true,
  "audio_state": "paused",
  "wake_lock_size": 4,
  "current_app": null,
  "media_session_state": null,
  "audio_output_device": "hdmi",
  "is_volume_muted": false,
  "volume": 15,
  "running_apps": [
    "com.android.systemui",
    "com.google.android.inputmethod.latin",
    "com.google.android.tv.remote.service",
    "com.google.process.gservices",
    "com.google.android.tvrecommendations",
    "com.netflix.ninja",
    "com.google.android.apps.mediashell",
    "com.google.android.tv.axel",
    "com.google.android.katniss:interactor",
    "com.google.android.katniss:search",
    "com.google.android.gms.unstable",
    "com.plexapp.android",
    "com.android.providers.tv",
    "com.google.android.gms",
    "com.google.android.gms.persistent",
    "com.google.android.partnersetup",
    "com.quickplay.android.bellmediaplayer",
    "com.android.vending",
    "com.google.process.gapps",
    "com.android.vending:background",
    "com.google.android.tvlauncher",
    "com.askey.android.tvsetup.partnercustomizer"
  ],
  "hdmi_input": null
}
kauelima commented 2 years ago

Hey guys! I'm the one with the TCL c725. I've used the HA-androidtv11 hack but now changed to this as it seems to work a little better. @ollo69 I was using your samsung integration before changing my now defunct samsung for this new TCL! Your work is great!

Let me know what I can do to help gather more information. At this time I'll report some things that I already tried:

Model name: TCL c725 with android 11 (Google TV). On Android, the model reads as "Smart TV Pro"

Here's the properties using this custom component:

adb_response: com.tcl.tv
hdmi_input: TV
friendly_name: Android TV 192.168.3.38
supported_features: 23997
source_list:
  - com.google.android.gms
  - com.android.systemui
  - com.tcl.bi:service
  - com.google.android.ext.services
  - com.tcl.usercenter
  - com.google.android.tv.remote.service
  - com.google.android.katniss:search
  - com.android.providers.media.module
  - Google TV Launcher
  - com.android.providers.tv
  - com.google.process.gapps
  - com.tcl.inputmethod.international
  - com.tcl.xian.StartandroidService
  - com.google.android.youtube.tv.recommendations
  - com.google.process.gservices
  - com.google.android.apps.tv.launcherx:coreservices
  - Google Cast
  - com.google.android.gms.persistent
  - com.google.android.apps.mediashell:privileged_process0
  - com.google.android.katniss:interactor
  - de.cyberdream.androidtv.notifications.google
volume_level: 0.13
is_volume_muted: false
app_id: 'de.cyberdream.androidtv.notifications.google}:'
app_name: 'de.cyberdream.androidtv.notifications.google}:'
source: 'de.cyberdream.androidtv.notifications.google}:'
entity_picture: >-
  /api/media_player_proxy/media_player.android_tv_192_168_3_38?token=<REDACTED>&cache=1652890527.092747

ADB response was using @glassbase command dumpsys activity a . | grep -E 'mResumedActivity' | cut -d ' ' -f 8 | cut -d '/' -f 1

Full resumed activity: 'mResumedActivity: ActivityRecord{d310a3b u0 com.tcl.tv/.TVActivity t478}'

What works: On/Off button Play/Pause button Volume + Volume - Source changing

What does not work: Entity and device not listed on ADB send command service interface Volume slider (gets the current volume but does not set values) States are weird app_id app_name source Entity picture blinks and turns dark to try and get the next picture

ollo69 commented 2 years ago

Here I'm just adding to standard integration the customizable commands implemented by @JeffLIrion in AndroidTV library. I hope that this thread and this repository can help to provide additional suggestion for the library and come back to original HA integration.

JeffLIrion commented 2 years ago
  • Model and manufacturer of your AndroidTV device

Specifically, what is needed is the output of this command:

https://github.com/JeffLIrion/python-androidtv/blob/043bbb5bf72717f40fde7ea3d4bb776293c49005/tests/test_constants.py#L119

getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release
kauelima commented 2 years ago

Specifically, what is needed is the output of this command:

Hey @JeffLIrion! In my TCL c725 that's the result:

adb_response: |-
  TCL
  Smart TV Pro
  d80140df0a50330ed
  11

I don't know how to run the whole script you linked to get this info, but if you need me to do it just direct me on how to and I'll do it!

glassbase commented 2 years ago

Onn Android TV

askey
sti6140d360
OUSA2110031108
10

here is my custom_current_app_media_session_state: CURRENT_APP=$(dumpsys activity a . | grep -E 'mResumedActivity' | cut -d ' ' -f 8 | cut -d '/' -f 1) && echo $CURRENT_APP && dumpsys media_session | grep -A 100 'Sessions Stack' | grep -A 100 $CURRENT_APP | grep -m 1 'state=PlaybackState {'

supergroover commented 2 years ago

Nvidia Shield tv pro 2019

adb_response: |-
  NVIDIA
  SHIELD Android TV
  1323420042908
  11

Nvidia Shield tv 2017

adb_response: |-
  NVIDIA
  SHIELD Android TV
  0322818016167
  11
TommisGR commented 2 years ago

adb_response: |- SkyworthDigital TV Box 4482203280071217 10

and using custom_current_app_media_session_state:

CURRENT_APP=$(dumpsys activity a . | grep -E 'mResumedActivity' | cut -d ' ' -f 8 | cut -d '/' -f 1) && echo $CURRENT_APP && dumpsys media_session | grep -A 100 'Sessions Stack' | grep -A 100 $CURRENT_APP | grep -m 1 'state=PlaybackState {'

boralyl commented 2 years ago

2019 Nvidia Shield Pro

$ getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release
NVIDIA
SHIELD Android TV
1320722089217
11
jrousek commented 1 year ago

SkyworthDigital TV Box 4490000000268143 10

unfortunately, I still haven't understood how I can add states or other