Raspberry Pi 3 with Kodi, Netflix, Spotify Connect, Hyperion and RetroArch

I’m currently using an old Mac Mini from 2009 as my media center. I’ve updated it recently with more RAM and an SSD but it has its problems with Bluetooth, regardless my used bluetooth card or USB adapter. Before this setup I’ve used a Raspberry Pi 3 with LibreElec which I’ve now reactivated successfully.

I’m using the Mac Mini for hearing Spotify, watching Netflix and Sky Go Connect, SNES Emulator with Xbox 360 and PS3 Gamepads and of course Kodi as media center in combination with Hyperion on a Raspberry Pi 1 as Ambilight clone. I’ve had to replace all this functionality with the Pi 3, but luckily it is possible!

I’ve started with LibreElec (8.0.2 stable) and installed it on the Pi 3. I had to copy the necessary Kodi files for setting the used sources and mysql database, so that I get my existing library and its viewing status.

Hyperion was easy to install via HyperionRemote. I only had to enable guest control for external resources in Kodi, so that Hyperion could properly shut down the backlight while the main menu is being displayed.

The SNES emulator can be used on LibreElec using the Kodi add-on Gamestarter. Just follow the GitHub instructions.

My Xbox 360 Gamepads where installed without problems. I just had to connect them via the USB adapter and pair them with the adapter. They are usable in Kodi as well as in Gamestarter without further configuration. I think that PS3 gamepads will probably behave similar.

The Bluetooth Mac Keyboard and Trackpad can also be paired with the Pi 3 via LibreElecs system settings. This allows a better search since you don’t need to use the onscreen Keyboard.

For Spotify I’ve just wanted the Pi 3 to appear as a Spotify connect speaker. The mobile apps and my other machines in the network are a better solution to select the music I want to hear, so I just wanted the Pi 3 to appear as a target. The Librespot provides this cool feature and also enables you to add easily Spotify connect to other rooms in your house with just a Raspberry Pi. Just search in the add-on for Librespot and install it. After a restart its active. Spotify connect is available immediately and stops automatically once a movie is started. It will be available again once the movie is really stopped (being paused is insufficient). Connecting to Librespot is really fast and works even better than with my Heos speakers!

Netflix is a completely different beast. Netflix is relying on a library called WideVine which handles the DRM. Google created a version for Chrome on ARM devices and some LibreElec and Kodi developers found a great way to integrate all this into the next version of LibreElec 9 and Kodi 18. So you need to update to  LibreElec 9 alpha. Copy the downloaded update file for Raspberry Pi 2 and 3 and put it into the update folder of your Pi 3. Now just restart and you’ll get the new version. However, be sure to make a backup of your library, just in case anything doesn’t work as expected!

You’ll now need the WideVine libs, you can install them with this command on your Pi:

You’ll now only need the plugin.video.netflix add-on. Once it is started you’ll be asked for your Netflix credentials. If you enter everything correctly you’ll have all the options of Netflix displayed as nice library entries in Kodi. Really comfortable if you ask me! It even works directly with the Hyperion Ambilight which is a cool feature. I was able to use 720p without problems, 1080p is too much for the Pi 3 to decode only in software.

Now with LibreElec 9 you’ll have problems starting RetroArch via Gamestarter. Luckily there’s a version for LibreElec 9 which you can just install and update your existing add-on.

 

Congratulations! You’ve got now a Rasperry Pi 3 with Kodi 19, Hyperion Ambilight, RetroArch Emulator, Xbox 360 Gamepad support and Spotify Connect. Only thing not working is Sky Go Connect Ticket, due to a missing browser and probably DRM related issues. But since I’m just using it for 3 months to see Game Of Thrones I can workaround this with connecting my MacBook to the TV.

Migrate from OpenElec to OSMC

I recently upgraded my ambilight clone from 50 to 104 LEDs and I’ve also updated my OpenElec installation on my Raspberry Pi B+ to 6.0.0. However, the hyperiond wasn’t able to communicate properly with Kodi so that no ambilight information was send to the LEDs: The LEDs would always be black, if I want to watch something on the Raspberry Pi.

I’ve opened an issue on github but I didn’t get  a useable response so far. The configuration and installation worked fine when I’ve connected with the iOS app or from the command line.

Today I’ve tried to use OSMC as surrogate for OpenElec and I’m really impressed: it worked almost out of the box with my old configuration. So I want to share what’s necessary to migrate from OpenElec to OSMC:

  1. Create a backup from your OpenElec .kodi folder. You’ll find this folder on OpenElec in /storage/.kodi
  2. Backup your hyperion.config.json or create a new one with HyperCon according to your setup
  3. Install OSMC on a SD card
  4. Boot from this SD card and follow the initial configuration screen
  5. Connect via SSH to OSMC. default user/password are osmc/osmc.
  6. Install hyperion according to nadnerb’s instructions. The spi part is important, since OSMC has SPI disabled by default. You’ll also want to remove the lirc line since this blocks the pins necessary for the default installation of WS2801 LEDs.
  7. Copy your hyperion.config.json to /etc. Be sure that you’ve changed the path to your effects folder from /storage/hyperion/effects to /usr/hyperion/effects
  8. Copy your .kodi folder to OSMC’s /home/osmc folder and overwrite any file
  9. Reboot and enjoy your known settings 🙂

Forward Kodi/XBMC video information to hyperion on Raspberry Pi

My current network setup allows me only to use small bandwidth connections between the living room (that’s where my Raspberry Pi is used as my Mediacenter) and office (my NAS). However, my Macbook is fast enough and can access the NAS wirelessly, so that I often use it as a replacement for the hardwired Raspberry Pi.

However, I cannot use my Hyperion Ambilight setup behind the TV in combination with the Macbook, because its only connected to the Raspberry Pi. But yesterday I’ve found this plugin which enables the Kodi setup on my Macbook to connect to the Hyperion Server on my Raspberry Pi over network.

  1. Download the zip file with the content of the git repository.
  2. Start Kodi on the Macbook and install it using the add on manager. You can point to the zip file directly without the need to unzip it first.
  3. Configure the installed plugin to connect to the ip of your Hyperion server.
  4. Start a video and be amazed that the lights on your TV will work wirelessly 😉

Update OpenElec 4.2.1 to 5.0.0 on a Raspberry Pi

XBMC is no more, it was replaced by KODI. The OpenElec team updated its media center distribution to version 5.0.0 which includes KODI. So it was time to update my RaspberryPi and its really easy:

  1. Backup your current installation with the OpenElec Backup tool.
  2. Move your backup to a secure location. You can access the backup tar file via SMB from the backup share.
  3. Download the 5.0.0 release image for Raspberry Pi.
  4. Place the tar file in the update share of your OpenElec installation.
  5. Reboot your Raspberry Pi.
  6. It should be rebooting a few times.

After these steps you should be greeted with the new KODI logo.


Kodi start screen

And you’re done, its really easy as a Pi 😉

How to use client certificates with Synology VPN Server and OpenVPN

The holidays are near and I want to have access to my files on my Synology NAS, while I’m visiting my family. That’s why I’m showing you today how to configure the official Synology VPN server to use OpenVPN with client certificates instead of username/password.

 

1. Start with a custom root CA

First of all you need your own self-signed root CA. A useful tool is XCA but you can also do this from the terminal.

2. Create a certificate for your DiskStation

Create a new Certificate for your DiskStation. Be aware to use the assigned DNS name, otherwise your browser will complain when you try to connect to the web interface of the DiskStation.

3. Configure the DiskStation to use the server certificate

I’m using DSM 5. There’s a nice new Security setting in the system settings. You can define and upload a certificate there:

Import CertificateThe Private Key and Certificate fields are straight forward. However, the intermediate certificate is the tricky part I forgot. This is the certificate of your self signed root CA. Only with this additional certifacte the trust chain is complete.

4. Trusting the root CA

The next step depends on your computers OS. I’m using Mac OS where I can easily add the root CA certificate as an always trusted certificate.

5. Reload the web interface of your DiskStation

After you’ve set the certificate, the web interface should have been reloaded. Eventually you’ve been warned by your browser about a security issue (you did not trusted your root CA, therefore the web page was untrusted). After a reload and the instructions from step 4, this warning should go away. If you take a look at the certificate tab of the DiskStation’s security setting, you will see that your new server certificate is active.

6. Install the VPN Server

Install the VPN Server from Synology’s Package Center. Its configuration is done from the start menu.

7. Configure the VPN Server

Enable OpenVPN from the Settings of the VPN Server. For more details see Synology’s instructions.

8. Connect via SSH to your DiskStation

Disable user authentication on the DiskStation and enable the certificate based authentication (code taken from this wiki) in this file: /usr/syno/etc/packages/VPNCenter/openvpn/openvpn.conf

 

9. Configure your client

I’m only using iOS devices and Macs. Therefore this is again a little biased 🙂 The installation of the clients for Mac and Windows is explained on Synology’s page. iOS is explained on this page (only in german but with screenshots). The initial configuration can be downloaded from the OpenVPN settings page from the DiskStation web interface. The extracted zip file contains the servers official certificates but needs to be modified to add support for the client certificates. Text is taken again from same wiki as above.

 

The DiffieHellmann Parameters (dh) can also be created with XCA. I would recommend 2048, since 4096 takes ages to generate.

10. Give it a try

Now you can test your VPN connection on your devices. It should not ask for a password, instead it should use the my.crt and my.key you’ve set in the configuration.