I have been controlling my FireTVs via ADB for a few months now, and I eventually got annoyed enough with the slow response from the ADB interface to come up with a better answer.
For starters, the FireTV method I was using consisted of:
- A crontab script that ran as the openhab user every 15 minutes to ensure there was an active ADB connection to the FireTV
- A shell script that would run the adb executable to send the FireTV the keystroke desired based on a case statement for $1 (ie: “/usr/local/bin/firetv-office-adb.sh up” would send the “up” command to the FireTV.
It’s worth noting that while OpenHAB I’m sure added some latency due to the shell execution, even just running the adb command at a prompt still was slower then I’d Iike.
Enter IRUSB by VideoStorm. (http://www.video-storm.com/proddetail.asp?prod=irusb)
It’s a dongle that is designed to allow a FireTV to send IR commands to other devices using their software via network commands to their software/app. BUT, that same app also allows you also send HID commands to the device, as if it was a keyboard or remote connected via USB. The response time is almost as good as the native Bluetooth remote.
The short instructions are:
- Buy dongle
- Wait for dongle to arrive
- Plug dongle in
- Install app from the Amazon App Store
- Upgrade firmware if necessary
- Send it commands (per their API spec)
The commands I’m using use plain old netcat:
#!/bin/bash case $1 in up) /bin/echo -ne "QHIDCODE1000082\r" | /bin/nc 192.168.0.80 9093 ;; down) /bin/echo -ne "QHIDCODE1000081\r" | /bin/nc 192.168.0.80 9093 ;; left) /bin/echo -ne "QHIDCODE1000080\r" | /bin/nc 192.168.0.80 9093 ;; right) /bin/echo -ne "QHIDCODE1000079\r" | /bin/nc 192.168.0.80 9093 ;; enter) /bin/echo -ne "QHIDCODE2000065\r" | /bin/nc 192.168.0.80 9093 #SELECT ;; back) /bin/echo -ne "QHIDCODE2002036\r" | /bin/nc 192.168.0.80 9093 ;; home) /bin/echo -ne "QHIDCODE2002035\r" | /bin/nc 192.168.0.80 9093 ;; menu) /bin/echo -ne "QHIDCODE1000101\r" | /bin/nc 192.168.0.80 9093 ;; play) /bin/echo -ne "QHIDCODE1000232\r" | /bin/nc 192.168.0.80 9093 ;; rew) /bin/echo -ne "QHIDCODE2000180\r" | /bin/nc 192.168.0.80 9093 ;; ff) /bin/echo -ne "QHIDCODE2000179\r" | /bin/nc 192.168.0.80 9093 ;; esac
Works like a champ! Highly recommended for anyone who doesn’t like the ADB delay but wants to control a FireTV.