I’ve got two TV’s…LG in living room configured via webostv and Toshiba Fire TV in bedroom configured via androidtv. I can turn them both on and off but the Toshiba cycles states in the UI after I turn it on…
Logger: homeassistant.components.androidtv.media_player
Source: components/androidtv/media_player.py:371
Integration: androidtv (documentation, issues)
First occurred: 5:14:36 PM (39 occurrences)
Last logged: 5:31:56 PM
Failed to execute an ADB command. ADB connection re-establishing attempt in the next update. Error: Reading from 192.168.1.91:5555 timed out (10.0 seconds)
Logger: homeassistant.helpers.entity
Source: components/androidtv/media_player.py:763
First occurred: 5:14:36 PM (39 occurrences)
Last logged: 5:31:56 PM
Update for media_player.bedroom_tv fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/usr/src/homeassistant/homeassistant/components/androidtv/media_player.py", line 363, in _adb_exception_catcher
return await func(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/androidtv/media_player.py", line 763, in async_update
) = await self.aftv.update(self._get_sources)
File "/usr/local/lib/python3.8/site-packages/androidtv/firetv/firetv_async.py", line 69, in update
screen_on, awake, wake_lock_size, current_app, media_session_state, running_apps, hdmi_input = await self.get_properties(get_running_apps=get_running_apps, lazy=lazy)
File "/usr/local/lib/python3.8/site-packages/androidtv/firetv/firetv_async.py", line 115, in get_properties
output = await self._adb.shell(constants.CMD_FIRETV_PROPERTIES_LAZY_RUNNING_APPS)
File "/usr/local/lib/python3.8/site-packages/androidtv/adb_manager/adb_manager_async.py", line 314, in shell
return await self._adb.shell(cmd)
File "/usr/local/lib/python3.8/site-packages/adb_shell/adb_device_async.py", line 377, in shell
raise exceptions.AdbConnectionError("ADB command not sent because a connection to the device has not been established. (Did you call `AdbDeviceAsync.connect()`?)")
adb_shell.exceptions.AdbConnectionError: ADB command not sent because a connection to the device has not been established. (Did you call `AdbDeviceAsync.connect()`?)
LG:
webostv:
host: 192.168.1.90
name: Living Room TV
turn_on_action:
service: wake_on_lan.send_magic_packet
data:
mac: 38:8c:50:b4:1f:30
broadcast_address: 192.168.1.255
Toshiba:
media_player:
# Use the Python ADB implementation
- platform: androidtv
name: Bedroom TV
host: 192.168.1.91
Was this ever resolved? I have the same problem. I have 2 Toshiba Fire TVs and 2 Fire TV sticks. The Sticks seems to be working ok but the Toshibas are toggling between being available and not or are not detected during startup of hassio.
I’ve not been able to get the Toshiba to stay awake. If it is awake, HA sees it but then after a period of time of inactivity it goes into power save mode and drops off the network. I’ve not found a setting in the TV to change this…
Thanks for the response. If the TV is going into sleep and stays there after you turn off you can try to set “Turn on TV with Alexa” to “On” and it should keep the wifi active while off. The problem I have is that the status toggles between “unavailable” and the true status - even if the TV is on, Sometimes the 2 TVs are toggling. One becomes available when the other one is not and sometimes one TV works well and the other toggles availability. I am considering trying out wired as well. Have you tried that?
This morning I reconfigured “Turn on TV with Alexa” as well as re-paired it in Alexa app and reconfigured androidtv in HA and the TV has stayed on all day. I appears just find in HA but always shows the state of standby regardless of whether it is on or off. I cannot turn it on or off from HA but adjusting the volume from HA does turn it on. Also, the media player has a volume slider but the TV only increases or decreases volume setting by 3 with each change on the slider and the slider then adjusts to show the new current volume level. I’m not sure why on/off is not working…
media_player:
# Use the Python ADB implementation
- platform: androidtv
name: Bedroom TV
host: 192.168.1.91
turn_on_command: "input keyevent 3"
turn_off_command: "input keyevent 223"
state_detection_rules:
'com.amazon.tv.launcher':
- 'standby'
'com.netflix.ninja':
- 'media_session_state'
'com.ellation.vrv':
- 'audio_state'
'com.plexapp.android':
- 'paused':
'media_session_state': 3 # this indentation is important!
'wake_lock_size': 1 # this indentation is important!
- 'playing':
'media_session_state': 3 # this indentation is important!
- 'standby'
'com.amazon.avod':
- 'playing':
'wake_lock_size': 4 # this indentation is important!
- 'playing':
'wake_lock_size': 3 # this indentation is important!
- 'paused':
'wake_lock_size': 2 # this indentation is important!
- 'paused':
'wake_lock_size': 1 # this indentation is important!
- 'standby'
At least there is some progress I would suggest to go back to a simple config and then add sections one by one to see where it breaks. Mine can turn on/off without an explicit entry in the yaml.
media_player:
- platform: androidtv
name: Office Fire TV
host: 10.0.1.82
device_class: firetv
All I wanted to do was have the TV turn off from my Good Night script. I activate that via Alexa, good night so I’ve edited that Alexa routine and added a Power off Toshiba Fire TV before calling my Good Night Scene (HA script). I am abandoning HA control of it and removing the config…
It is far from working perfectly for me, but as mentioned before it seems like chance of success is greater if the media players are on during reboot. I am using the simple media player definition as above and my script looks like this:
Additional info: I had a Toshiba TV and a Fire TV stick stuck on unavailable - also after reboot. I restarted both devices via the menu and the showed w/o rebooting HA
Ok, so here’s where I’m at…
Vanilla config in HA.
If TV is off I can turn it on
It should switch to HDMI2 but it switches then comes back to Home screen.
While on Home screen, androidtv cycles connected/disconnected/connected with status com.android launcher something or other.
If I switch to HDM2, HA shows connected/on and stays that way and I can then turn it off from HA.
At least if I’m watching HDMI2 and say Alexa, good night, the script now turns the TV off.
Living room TV works fine but that is LG using webostv. Guess I should have bought the premium LG for the bedroom instead of the Toshiba!
Yes, it works. But for this, you need to understand the Toshiba TV sound process. Or if your Toshiba TV sound system is not working, you can try resetting the TV. it can help too.