Skip to content

Instantly share code, notes, and snippets.

@beforeyouknowit
Last active March 27, 2017 21:53
Show Gist options
  • Save beforeyouknowit/de64d2eaf4f5463a1f62 to your computer and use it in GitHub Desktop.
Save beforeyouknowit/de64d2eaf4f5463a1f62 to your computer and use it in GitHub Desktop.
Plex on AppleTV via Intel Edison

Bridging Plex onto AppleTV with PlexConnect and Intel Edison

Intel Edison Mini Breakout Board

For this tutorial you will need:

  • An Intel Edison and Mini Breakout Board or Arduino Breakout Board. Note: Your Edison needs to be running factory Yocto and/or updated Yocto via Intel's Phone Flash Tool, but NOT ubilinux. YMMV with other linux distros.
  • At least 2x USB to Micro-USB data cables. (Careful, some are only good for charging.)
  • An AppleTV, i.e. Model A1469 or similar revision 3 hardware, running the most up-to-date AppleTV OS package, i.e. 7.2 or greater. No AppleTV jailbreaks or root exploits are required for this workaround.
  • A reasonably fast (sustained 10Mbps or greater) local wireless network with a known SSID and password, preferably running WPA2-Personal encryption. (You aren't running WEP, are you?)
  • An existing Plex account (with known login/password,) and Plex server instance, logged-in and running somewhere on your multimedia-laden network. Refer to this Getting Started guide to get running with Plex.
  • Suitably fast upstream broadband on your host network, and suitably fast downstream broadband on your client network.
  • A Mac, running OS X 10.6 or later.

Configure Edison from Scratch & Setup Root

  1. Assemble and setup your Edison for the first time.
  2. Plug Edison into USB power with micro-USB cable, i.e. via J16 on both Edison Mini and/or Arduino breakout boards.
  3. Connect another micro-USB cable to port J3 on your Edison board, and the other USB end to your Mac.
  4. Open your favourite terminal emulator on your Mac, i.e. Terminal, iTerm 2, etc.
  5. Run ls /dev/cu.usbserial* to discover the name of your Edison's FTDI aka the Console port. It should display something like `/dev/cu.usbserial-A#######' where the #s are alphanumeric characters. Note this address.
  6. Run screen /dev/tty.usbserial-A####### 115200 -L and replace the #s with your Edison's address from the previous step. This will open a new serial terminal connection to your Edison via an app called Screen.
  7. You'll be prompted to log in; the default Edison/Yocto username is root with no password.
  8. As soon as you've logged in as root, run configure_edison --setup. Step through the menu to connect to your local wifi network; setup the Edison's network hostname as edison; change the root password, etc. Note the new root password. Also, Note: When you change the root password on factory Yocto Linux on your Edison, a script automagically enables SSH access over WiFi. SSH access is required to continue with these instructions.
  9. Note the wireless network IP address for the Edison.
  10. Exit screen by pressing Ctrl+A then C on your Mac's keyboard.
  11. Disconnect your (console) USB cable and SSH into Edison via your Mac's network connection and the Edison's WiFi adapter, i.e. ssh -l root edison.local. (Power-cycle the Edison if necessary, and wait about 20-30 seconds for it to become discoverable on your local router.)
  12. Log into the Edison via root and the password you just custom-set.

Configure Package Repos

  1. Once you're logged in, run the following command to replace the factory package vendors with Intel's full Edison vendor lists: printf 'src all http://iotdk.intel.com/repos/1.1/iotdk/all \nsrc x86 http://iotdk.intel.com/repos/1.1/iotdk/x86 \nsrc i586 http://iotdk.intel.com/repos/1.1/iotdk/i586 \n' > /etc/opkg/base-feeds.conf
  2. Run opkg update to update package libraries.

Install Python, Git, and reconfigure factory HTTP server:

  1. Run opkg install python to install the latest Python.
  2. Run opkg install git to install the latest Git.
  3. Edit the default Edison http server so that it doesn't collide with PlexConnect: vi /usr/lib/edison_config_tools/edison-config-server.js
  4. Find the last line in the file, i.e. PageDn until you see: http.createServer(requestHandler).listen(8080);
  5. Put the cursor at the beginning of this last line. (UP/DN/L/R keys.) Either comment out this last line to turn it off completely, i.e. press "I" on the keyboard to enter Insert mode in vi, then and add // (with a trailing space) to comment out the line, or alternatively, change the port to 8080 so that it's still reachable via http://edison.local:8080/.
  6. Hit Esc to exit Insert mode.
  7. Write the file and exit vi, via :wq!.
  8. Reboot the Edison, i.e. shutdown -r now. (One of the two green lights on your board will turn off, then come back on as it's booting back up. Give it another 20-30 seconds to be discoverable on your local router.)

Install PlexConnect

  1. Reconnect to the Edison via SSH: ssh -l root edison.local
  2. Run cd ~/ to change to the root user's home folder.
  3. Clone the PlexConnect repo into the folder: git clone https://github.com/iBaa/PlexConnect.git
  4. Jump into the PlexConnect directory: cd PlexConnect.

Generate OpenSSL Certficates

  1. Run this command to generate the .pem and .key files: openssl req -new -nodes -newkey rsa:2048 -out ./trailers.pem -keyout ./trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"
  2. Then run this: openssl x509 -in ./trailers.pem -outform der -out ./trailers.cer && cat ./trailers.key >> ./trailers.pem
  3. Copy the .pem and .cer files into the right location: cp trailers.pem trailers.cer ~/PlexConnect/assets/certificates/
  4. Refer to the PlexConnect Linux Documentation for more detailed guidance in getting PlexConnect installed.

Configure PlexConnect to run as a service upon boot

** TODO: Add these steps to instructions soon!** ** To run PlexConnect manually, use ~/PlexConnect/PlexConnect.py from the command line.**

Reboot Edison

  1. Power-cycle the Edison once more, and wait about 45-60 seconds for it to come online on your wireless network, and to start up the PlexConnect service.

Configure AppleTV DNS to defer to Edison

  1. On the AppleTV, go to Settings > General > Network, and Select the current WiFi network.
  2. Select current WiFi network again from the list of available SSIDs.
  3. Scroll down to "Configure DNS", and change it from "Automatic" to "Manual".
  4. Use the "Configure DNS" tool to enter the wireless network IP address from the Edison, as per above.
  5. Select "DONE."

Add Deferred DNS profile to AppleTV

  1. With your aluminum AppleTV remote, go to Settings > Send Data to Apple, change this to "NO".
  2. With the "Send Data to Apple" tile still selected, press the "Play/Pause" button on the remote.
  3. Select "Add Profile >" and OK to "Are you sure..?"
  4. In the resulting Custom Profile text entry box, add this URL: http://trailers.apple.com/trailers.cer and save it with "OK".

Reboot AppleTV.

  1. Run Settings > General > Restart

Test it out!

  1. On the AppleTV, browse to Trailers. (It should open after a second or two, and show you the PlexConnect "Playlists, Library, Shared Libraries, Channels, Search, Settings" navigation bar at the top.)
  2. Scroll over to Settings, and log in to your MyPlex Account with your Plex username and password.
  3. Now explore Library > Movies or Library > TV Shows and you should see your Plex library shown.
  4. Use the Apple remote to navigate and play back media as usual.

Enjoy. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment