FireTV installation [solved]

I recently tried to integrate one of my FireTV sticks, and I had no luck.
I followed the directions here: https://home-assistant.io/components/media_player.firetv/
I’m not sure exactly what I did, but I ran into some permissions problems, so I switched to running the commands with sudo and I got some messages that said maybe I have to run with sudo -H. After getting this issue, I wasn’t sure what was going on, but I ran pretty much every combination of sudo, sudo -H, and just installing with my home assistant user. After the first run through, the variations did nothing - all simply completed without issue - essentially saying these packages were already installed. Anyway - installation completed.

I tried running firetv-server -d [fire tv device IP]:5555. It appeared to work (no errors anyway), but http://localhost:5556/devices/list gave me connection refused, so it didn’t appear to be working. I do most of my installation through ssh, so I also tried http://[LAN IP]:5556/devices/list from the machine I was using, and that didn’t work either.
I don’t know how to background a process after running it, so I cancelled it, and ran (firetv-server -d :5555 &). This didn’t work either…

I then read that it had to be installed under Python 2.x. Well, I didn’t do anything special to install it under Python 2.x, so I tried reinstalling with python2.7 pip… This said everything was already installed, and indeed, looking back - it did show that everything was installed to python2.7 directories.

Since that failed, I created /srv/firetv, and activated a virtual environment there. I then reinstalled in the virtualenv with python2.7 pip… This time, all installation commands worked perfectly (as published on the home assistant website) without sudo.
I got exactly the same result. firetv-server runs with no errors, but I cannot access http://localhost:5556/devices/list.

I’m novice enough with Linux that installing stuff under python is beyond my ability to troubleshoot on my own. I’m not sure what could be happening or even where to find an error log. Anyone got any ideas?

Thanks.

I figured it out…
I messed around with it for a while and finally just ran firetv-server all by itself (no options). It worked. On a whim I ran the previous command I had used (firetv-server -d ip:5555) and it also worked!

Perhaps running firetv-server once by itself creates some files or sets something up? Did it for me…

hm, dont know whats going wrong but from one moment to the other it quits working :sweat:

Traceback (most recent call last):
  File "/usr/local/bin/firetv-server", line 9, in <module>
    load_entry_point('firetv==1.0.5', 'console_scripts', 'firetv-server')()
  File "/usr/local/lib/python2.7/dist-packages/firetv/__main__.py", line 237, in main
    if args.default and not add('default', args.default):
  File "/usr/local/lib/python2.7/dist-packages/firetv/__main__.py", line 81, in add
    devices[device_id] = FireTV(str(host))
  File "/usr/local/lib/python2.7/dist-packages/firetv/__init__.py", line 61, in __init__
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/firetv/__init__.py", line 71, in connect
    serial=self.host)
  File "/usr/local/lib/python2.7/dist-packages/adb/adb_commands.py", line 87, in ConnectDevice
    return cls.Connect(handle, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/adb/adb_commands.py", line 110, in Connect
    device_state = cls.protocol_handler.Connect(usb, banner=banner, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/adb/adb_protocol.py", line 272, in Connect
    cmd, arg0, arg1, banner = cls.Read(usb, ['CNXN', 'AUTH'])
  File "/usr/local/lib/python2.7/dist-packages/adb/adb_protocol.py", line 215, in Read
    cmd, arg0, arg1, data_length, data_checksum = cls.Unpack(msg)
  File "/usr/local/lib/python2.7/dist-packages/adb/adb_protocol.py", line 200, in Unpack
    raise ValueError('Unable to unpack ADB command.', cls.format, message, e)
ValueError: ('Unable to unpack ADB command.', '<6I', '', error('unpack requires a string argument of length 24',))

Can you remember souch an error?

Yep… Back to not working.
The server runs with no command line options, but will not run with -d or -c.
It does not discover any FireTVs with no options.

It just hangs at the command line of I run with options.

Did you ever manage to fix this?