I think I fixed it. Please remove those folders again, restart HA, and let me know if it works.
Yep that worked.
Showed running apps in source though if app hasn’t been started then didn’t appear until it had been started on the fire.
Would it not make more sense for source to list installed apps instead? Allowing HA to open apps that aren’t already running in background?
"pm list packages -3"|cut -f 2 -d ":"
^ would list user installed apps, then adding known pkgs such as com.amazon.tv.launcher
and other preinstalled apps would be a more useful sources list would it not?
I guess pushing aapt to a temporary directory on the device to be able to get an array of these app id’s and their friendly names would be a step too far though…
You can launch an app from the component, just use the media_player.select_source
service.
Showing the installed apps is an interesting idea. The list might be a bit long, though. Either way, I think adding an installed_apps
property would be a good contribution to the firetv
package.
Apologies yes, I misworded my comment. My line of thought was that as it picks that up from the running_apps
property that on a freshly turned on firetv it wouldn’t appear on sources list until you’d manually launched it, so you’d either need a way to set apps you know you’ve got installed in either an automation or add a feature to the component to add them in the config.
Just tried the lastest master firtv.py and get the following error.
Error loading custom_components.media_player.firetv. Make sure all dependencies are installed
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 117, in _load_file module = importlib.import_module(path) File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/custom_components/media_player/firetv.py", line 162, in <module> class FireTVDevice(MediaPlayerDevice): File "/config/custom_components/media_player/firetv.py", line 165, in FireTVDevice from firetv import KEYS ImportError: cannot import name 'KEYS'
I opened an issue for future reference: https://github.com/JeffLIrion/homeassistant_native_firetv/issues/25
Problem: You have an old version of the firetv
package installed.
Solution: In your <configuration>/deps
folder (and all subfolders), delete all firetv
and firetv*
folders and restart Home Assistant. HA will install the latest version of firetv
1.0.8 from GitHub.
Tried this out last night, but there appears to be pip dependency failures when trying to install 1.0.8 on hassio running home assistant 0.84.6.
install package https://github.com/JeffLIrion/python-firetv/zipball/pure-python-adb#firetv==1.0.8: Failed building wheel for pycryptodome
python-jose-cryptodome 1.3.2 has requirement pycryptodome<3.4.0,>=3.3.1, but you'll have pycryptodome 3.7.3 which is incompatible.
pyrebase4 4.2.0 has requirement oauth2client==4.1.2, but you'll have oauth2client 4.0.0 which is incompatible.
broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.7.3 which is incompatible.
It appears the pins for python-jose-crptodome
are too restrictive and there are newer versions installed in my hassio instance. Then there are more versions not possible due to strict pins for other dependencies.
Has anyone come across this?
Yes, other people have had that issue. I don’t know what the solution is, but here’s an idea.
Remove the firetv.py
custom component file and restart HA, modifying your configuration as needed. Hopefully the built-in Fire TV component will install the correct version of pycryptodome. Then restore the firetv.py
custom component and restart. Let me know if that fixes it!
Just tried this out and it worked! Thanks!
Sorry for posting this is it’s already been answered. Getting the following now with master firetv.py
INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
ERROR:homeassistant.scripts.check_config:BURB
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 207, in check
res['components'] = check_ha_config_file(hass)
File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 374, in check_ha_config_file
platform = loader.get_platform(hass, domain, p_name)
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 61, in get_platform
domain=domain, platform=platform_name))
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 117, in _load_file
module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/media_player/firetv.py", line 7
<!DOCTYPE html>
^
SyntaxError: invalid syntax
Fatal error while loading config: invalid syntax (firetv.py, line 7)
Failed config
General Errors:
- invalid syntax (firetv.py, line 7)
Successful config (partial)
You downloaded the file as html, instead of as the raw file. Download the file from this url: https://raw.githubusercontent.com/JeffLIrion/homeassistant_native_firetv/pure-python-adb/media_player/firetv.py
Yup. My bad.
Actually, the master branch is more current: https://github.com/JeffLIrion/homeassistant_native_firetv/blob/master/media_player/firetv.py
You might need to delete the firetv
package that is currently installed. See here for more info: https://github.com/JeffLIrion/homeassistant_native_firetv/issues/25
I am seeing these messages too, watching it regularly flick between unavailable to working, I’m thinking that this has something to do with drop outs and high response time which is a known problem with the Fire 4KTV.
2019-02-09 23:51:06 WARNING (Thread-7) [root] Couldn’t connect to host: 192.168.0.65:5555, error: Connection reset by peer
2019-02-09 23:51:37 ERROR (Thread-10) [custom_components.media_player.firetv] Failed to execute an ADB command; will attempt to re-establish the ADB connection in the next update
2019-02-09 23:52:01 ERROR (Thread-6) [custom_components.media_player.firetv] Failed to execute an ADB command; will attempt to re-establish the ADB connection in the next update
2019-02-09 23:52:10 WARNING (Thread-19) [root] Couldn’t connect to host: 192.168.0.65:5555, error: Connection reset by peer
Pinging 192.168.0.65 with 32 bytes of data:
Reply from 192.168.0.56: Destination host unreachable.
Reply from 192.168.0.56: Destination host unreachable.
Reply from 192.168.0.56: Destination host unreachable.
Reply from 192.168.0.56: Destination host unreachable.
Reply from 192.168.0.65: bytes=32 time=1025ms TTL=64
Reply from 192.168.0.65: bytes=32 time=3ms TTL=64
Reply from 192.168.0.65: bytes=32 time=1654ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2ms TTL=64
Reply from 192.168.0.65: bytes=32 time=910ms TTL=64
Reply from 192.168.0.65: bytes=32 time=1ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2007ms TTL=64
Reply from 192.168.0.65: bytes=32 time=3ms TTL=64
Reply from 192.168.0.65: bytes=32 time=908ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2ms TTL=64
Reply from 192.168.0.65: bytes=32 time=1917ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2059ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2ms TTL=64
Reply from 192.168.0.65: bytes=32 time=1152ms TTL=64
Reply from 192.168.0.65: bytes=32 time=1ms TTL=64
Reply from 192.168.0.65: bytes=32 time=3ms TTL=64
Reply from 192.168.0.65: bytes=32 time=2ms TTL=64
Reply from 192.168.0.65: bytes=32 time=632ms TTL=64
Reply from 192.168.0.65: bytes=32 time=342ms TTL=64
Reply from 192.168.0.65: bytes=32 time=118ms TTL=64
Ping statistics for 192.168.0.65:
Packets: Sent = 25, Received = 25, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2059ms, Average = 606ms
For some reason i’m still getting the “keys” error after deleting everything in my “deps” folder. Any other tricks to get the older version out?
First, make sure you’re using the latest firetv.py component from the master branch. I fixed a typo earlier where the wrong link was used for the requirement.
The latest version of HA wasn’t installing the package from GitHub for me, so I had to install it into a directory on a separate computer via pip install --target . https://github.com/JeffLIrion/python-firetv/zipball/next-release
and then copy the files over.
Or you can:
# use the correct path for your setup
cd /config/deps/python3.6/site-packages/firetv
mv __init__.py BACKUP.py
wget https://raw.githubusercontent.com/JeffLIrion/python-firetv/next-release/firetv/__init__.py
Using an ADB server to send the ADB commands should be more stable than using the Python adb
package. See item 2 in the “ADB Setup” section of the README.
Installed the latest version with the ADB server addon on Hassio. Getting this error:
Error while setting up platform firetv
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/adb/adb_protocol.py", line 226, in Unpack
cls.format, message)
struct.error: unpack requires a buffer of 24 bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/firetv.py", line 71, in setup_platform
ftv = FireTV(host)
File "/usr/local/lib/python3.6/site-packages/firetv/__init__.py", line 106, in __init__
self.connect()
File "/usr/local/lib/python3.6/site-packages/firetv/__init__.py", line 119, in connect
self._adb = adb_commands.AdbCommands().ConnectDevice(**kwargs)
File "/usr/local/lib/python3.6/site-packages/adb/adb_commands.py", line 142, in ConnectDevice
self._Connect(**kwargs)
File "/usr/local/lib/python3.6/site-packages/adb/adb_commands.py", line 173, in _Connect
conn_str = self.protocol_handler.Connect(self._handle, banner=banner, **kwargs)
File "/usr/local/lib/python3.6/site-packages/adb/adb_protocol.py", line 314, in Connect
cmd, arg0, arg1, banner = cls.Read(usb, [b'CNXN', b'AUTH'])
File "/usr/local/lib/python3.6/site-packages/adb/adb_protocol.py", line 243, in Read
cmd, arg0, arg1, data_length, data_checksum = cls.Unpack(msg)
File "/usr/local/lib/python3.6/site-packages/adb/adb_protocol.py", line 228, in Unpack
raise ValueError('Unable to unpack ADB command.', cls.format, message, e)
ValueError: ('Unable to unpack ADB command.', b'<6I', b'', error('unpack requires a buffer of 24 bytes',))
Already tried several reboots, delete custom firetv.py, restart and re-install.
Anyone encounter this?
I was using the adb addon released by Frank but it seemed to break the ability to use the adb_shell to send commands to the Fire TV.