ha-androidtv-custom icon indicating copy to clipboard operation
ha-androidtv-custom copied to clipboard

Standby for exactly 10 sec (couple of times per hour) [Nvidia Shield]

Open Xitro01 opened this issue 3 years ago • 6 comments

First of all: great integration! Finally solved the issue that it was not always showing the name of the app correctly.

I have another unresolved issue though, also occurs with the default integrations. My Nvidia Shield shows as 'standby' while playing something. This happens a couple of times per hour and it shows 'standby' for exactly 10 seconds.

Knipsel

Do you have any idea what could cause this?

Thanks in advanced.

Xitro01 avatar Sep 20 '22 11:09 Xitro01

I have the exact same issue but I haven't fixed it yet...

cyberden avatar Oct 14 '22 21:10 cyberden

I have a lot of idle's in between quite often as well, when I have this issue, the playback on my device also seems very slow. Maybe it polls the device too much, more than it might be able to handle?

Xitro01 avatar Nov 14 '22 10:11 Xitro01

I managed to improve these idle times using the guide of the Home Assistant Wiki using the ADB command "Properties" and changing the settings of the Android TV Integration for each app using the wake lock data and audio_state values.

It seems ok but it's a pain.

cyberden avatar Nov 14 '22 15:11 cyberden

Not sure if this fixes my problems, as I see my Shield struggle, until I restart the Shield. After the reset the video playback is working normal again and the states are detected normally again (besides the sudden standby's in between, but I just ignore these).

Xitro01 avatar Nov 14 '22 15:11 Xitro01

@cyberden would you be so kind as to provide an example? What you changed, how, and why? I'm reading same page I think, but it's very generally written.

And I don't understand a lot of this in order to have the aha moment.

I did change line 99 in constants.py which solved the what's playing, but still rather limited. Luckily, we use Kodi/Jellyfin which I hope that integration will be easier.

spcano01 avatar Nov 15 '22 03:11 spcano01

In the integration page of HASS you click "configure" on the Android TV Custom Integration.

image

You click on the "new rule" radio button and "submit" and then you enter the application Id for which you want to customize the states detection and you enter the "mapping" allowing to detect the overall state using the "audio_state", "wake_lock_size" and "media_session_state"

Here is en exemple that works for Disney+ on my shield (appId : com.disney.disneyplus) : [{"standby": {"audio_state": "idle", "wake_lock_size": 1}}, {"standby": {"audio_state": "idle", "wake_lock_size": 2}}, {"playing": {"audio_state": "playing", "wake_lock_size": 3}}, {"paused": {"audio_state": "paused"}}]

To edit this, you can go to the services tab in developers tools section and call the adb command "GET_PROPERTIES" :

service: androidtv_custom.adb_command data: command: GET_PROPERTIES target: device_id: 887fbc1aa14e9ffe52caa1b592fa9169

Once called, you can get the response in the states tab in the json containing the properties for your device. You can find the values for each state.

The idea is to launch each app, call the GET_PROPERTIES command, see the states of the properties, adding these values in the mapping for the "standby" state for this app. Play a video, calling the GET_PROPERTIES etc...

cyberden avatar Nov 15 '22 08:11 cyberden