JeffLIrion / python-androidtv

Communicate with an Android TV or Fire TV device via ADB over a network.
MIT License
164 stars 56 forks source link

Android TV 12 devices not working properly #323

Open Dillton opened 1 year ago

Dillton commented 1 year ago

Hello.

After my Chromecast with Google TV received an update from Android 10 to Android 12 the state of the device is always only "off". ADB commands seems to be working at least for me however the key states like idle, playing, paused, etc. does not. Automations depends on those.

This is common issue for Android 12 devices, other users already reported this in different threads for example: https://github.com/home-assistant/core/issues/80555 https://github.com/home-assistant/core/issues/79154

@ollo69 recommends the issue should be opened here instead of HA/core as this problem is inside AndroidTV library.

@JeffLIrion Could you please check this issue? If you need logs or something let me know I can collect and provide them once I am home.

chatziko commented 1 year ago

Hi when can we expect this fix in HA officially?

The PR is merged and scheduled for 2022.12.2, so likely in the following days.

VoyteckPL commented 1 year ago

Just one more thing I noticed. State detection is delayed around 5 seconds. I also have google cast integration when there is no or very little delay. For example when switching from youtube to main launcher it is update after some time which is bad for automations based on this state.

benrjunk commented 1 year ago

Just one more thing I noticed. State detection is delayed around 5 seconds. I also have google cast integration when there is no or very little delay. For example when switching from youtube to main launcher it is update after some time which is bad for automations based on this state.

Use this automation to increase updating frequency to every 2 seconds. Also disable automatic updating in the integration settings

`alias: Update AndroidTV description: "" trigger:

VoyteckPL commented 1 year ago

Thanks man. It works. Kinda... Even when setting to 1 sec. I get delay around 3 seconds ☹️

VoyteckPL commented 1 year ago

Google Cast integration has immediate reaction.

Dillton commented 1 year ago

Thanks man. It works. Kinda... Even when setting to 1 sec. I get delay around 3 seconds ☹️

Hi. I think you can try use the action below in automation if it will be faster instead of homeassistant.update_entity. service: androidtv.adb_command data: command: GET_PROPERTIES target: entity_id: media_player.chromecast_google_tv

VoyteckPL commented 1 year ago

Unfortunately that didn't help.

hermanho commented 1 year ago

After I have updated the HA with this fixing, the device status will be reported as "off" sometimes when I browse the thumbnails in Netflix or during video playing in YouTube. It impacts the automation trigger.

TRusselo commented 1 year ago

i find it much better since the HA update. play/pause has been great in YouTube. still broken for Emby. I might contact them.

markwiese commented 1 year ago

i find it much better since the HA update. play/pause has been great in YouTube. still broken for Emby. I might contact them.

I found I had to update the state detection rule for Emby to the below. Works fine, now, however, my Chromecast still gets detected as being "off" sometimes. That's nothing to do with Emby, though.

[{"playing": {"wake_lock_size": 2}}, {"paused": {"wake_lock_size": 1}}]

TRusselo commented 1 year ago

i find it much better since the HA update. play/pause has been great in YouTube. still broken for Emby. I might contact them.

I found I had to update the state detection rule for Emby to the below. Works fine, now, however, my Chromecast still gets detected as being "off" sometimes. That's nothing to do with Emby, though.

[{"playing": {"wake_lock_size": 2}}, {"paused": {"wake_lock_size": 1}}]

I love the sound of what you are saying... but have no idea where to put that code. i dont know of a "state detection rule" to edit

markwiese commented 1 year ago

i find it much better since the HA update. play/pause has been great in YouTube. still broken for Emby. I might contact them.

I found I had to update the state detection rule for Emby to the below. Works fine, now, however, my Chromecast still gets detected as being "off" sometimes. That's nothing to do with Emby, though. [{"playing": {"wake_lock_size": 2}}, {"paused": {"wake_lock_size": 1}}]

I love the sound of what you are saying... but have no idea where to put that code. i dont know of a state detection rule to edit

In HA, go to Integrations, select the Android TV instance and click Configure. In the screen that pops up, you can select New Rule at the bottom and then click Submit. That will allow you to enter the app ID for Emby along with the state detection rule I provided.

TRusselo commented 1 year ago

i find it much better since the HA update. play/pause has been great in YouTube. still broken for Emby. I might contact them.

I found I had to update the state detection rule for Emby to the below. Works fine, now, however, my Chromecast still gets detected as being "off" sometimes. That's nothing to do with Emby, though. [{"playing": {"wake_lock_size": 2}}, {"paused": {"wake_lock_size": 1}}]

I love the sound of what you are saying... but have no idea where to put that code. i dont know of a state detection rule to edit

In HA, go to Integrations, select the Android TV instance and click Configure. In the screen that pops up, you can select New Rule at the bottom and then click Submit. That will allow you to enter the app ID for Emby along with the state detection rule I provided.

I had to input, [{"playing": {"wake_lock_size": 3, "wake_lock_size": 4}}, {"paused": {"wake_lock_size": 2, "wake_lock_size": 1}}] it works. if i reopen the rule it says [{"playing": {"wake_lock_size": 4}}, {"paused": {"wake_lock_size": 1}}] either way, its working. THANK YOU SO MUCH. this [POST] had a bunch of configs THIS DOC. was helpful for figuring out syntax, the ADB commands, reponses to get it working.

regardless mark, thank you so much, THIS POST, has code that allows me to turn on Hue Sync via Hue Essentials when Emby starts playing. (you just fixed. thankyou)