Plex on Radxa Rock

Plex is a great home media server with clients for iOS, OS X, Windows, web and even some TV sets. For my Radxa Rock home server, an ARM V7 build of Plex server is needed. Fortunately Plex has recently started to offer an ARM V7 build for some Synology NAS devices, which can be repackaged to work on other ARM V7 devices such as the Radxa Rock and the Raspberry Pi 2. I won’t go more into detail here as an excellent guide for installing Plex Home Server on Debian Jessie based distros can be found at htpcguide.

To make your Plex server available on the go, you can either use UPNP to let it configure itself or forward some ports manually. I prefer the latter option, as I don’t like the idea of basically anything being able to expose hosts on my networks. Here are some hints for a FritzBox:

portfreigabeFritzbox
configurationPlexMediaServer

Deactivate the LEDs of your Radxa Rock

The Rock’s frequently blinking lights can be an annoying source of light pollution. Here is how to turn most of them off. However, the ethernet and wifi leds can only be soldered them out.

On the newer images, the 3 Rock’s LEDs are configured as LED class devices, so edit rc.local

and set them to none using this snippet:

For the older images, the LEDs have to be set via the GPIOs:

make sure that you add those lines before the exit 0 statement in rc.local.

Persistent names for usb-serial devices

Many usb-serial devices appear as /dev/ttyUSBX or /dev/ttyACMX in the system, the link changing every time several of these devices are plugged in. This is unsatisfying if you want to access these devices from a script. One solution is to use a UDEV ruleset to make a symbolic link for each device. Here is how to do it.

Determine vendor and product id of the usb-serial device:

Determine serial number of the device:

Create a UDEV ruleset that makes a symbolic link for each device:

sudo nano /etc/udev/rules.d/99-usb-serial.rules

and add and adapt to your needs:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="DAE0011W", SYMLINK+="1wire"

after replugging the device, there will be a symbolic link ‚1wire‘ be created for your device.

Lautsprecher in Fhem einbinden

Hier ein kleines Tutorial wie ein Lautsprecher an einem Radaa Rock oder Raspberrypi in fhem eingebunden werden kann. Zuerst die alsa und Utilities installieren:

In der fhem.cfg einen Lautsprecherdummy und ein Notify darauf anlegen:

In der 99_myUtils.pm eine entsprechende Funktion anlegen:

Im fhem root ein Verzeichnis „media“ erstellen, gewünschte Wave Dateien einfügen und fhem zuordnen:

Eine Wave-Datei kann nun folgendermaßen abgespielt werden:

Access TimeCapsule from Radxa Rock

Eventually you will want some more memory on your Radxa Rock than the integrated 8 GB NAND or the micro SD-Card. Here is how to tap the vast memory resources of a TimeCapsule.

Then test the fstab entry:

If it mounts correctly you are set. Else try mounting with verbose information:

Do not reboot until you verified that everything works correctly or you will be unable to boot (which is quite hard to recover if you boot from NAND).

If you need German umlaut support you can set the iocharset to utf8:

However this will fail on the most recent debian based rock images with:

mount error(79): Can not access a needed shared library
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

because the nls_utf8.ko module is missing.

Fhem über UMTS updaten

Wegen den längeren Latenzzeiten von UMTS im Vergleich zu DSL scheitert ein Fhem Update über UMTS/3G typischerweise mit der Fehlermeldung:
Can't get controlfile from http://fhem.de/fhemupdate4/svn/controls_fhem.txt

Ein Erhöhung des Timeouts in den HttpUtils brachte bei mir leider keine Abhilfe. Alternativ dazu kann das Fhem per SVN upgedatet werden. Dazu falls nötig zuerst Subversion installieren, Fhem per shutdown herunterfahren und den aktuellen trunk auschecken:

Ein Update kann nun in Zukunft ganz einfach per SVN durchgeführt werden:

Automatically update linux systems

Keeping your computer systems up to date has always been important. But now that word has gotten out that big brother is scanning whole countries networks and actively probes their ports keeping systems up to date is the least should do. Who knows if they are not installing backdoors as well, as a precautionary measure of course 🙂 So at least make it harder for them by keeping your system patched, it can be as easy as installing and running unattended-upgrade:

Now edit /etc/apt/apt.conf.d/10periodic:

and add/edit the following lines:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";

Now you can select which updates to run by uncommenting some lines in /etc/apt/apt.conf.d/50unattended-upgrades:

I usually allow security and normal updates but reject proposed and backports.

dblog auf Fhem einrichten

Mit der Zeit sammeln sich selbst in kleinen und mittleren Fhem Installationen viele Messwerte in den verschiedenen Logdateien. Dies ist nicht unübersichtlich sondern erschwert auch die nachträgliche Auswertung. Daher bietet es sich an, diese Messwerte gleich in einer Datenbank zu speichern. Dazu gibt es das Modul dblog dessen Einrichtung hier kurz skizziert werden soll.

Update fhem und falls erwünscht das charting frontend:
update
update thirdparty http://svn.code.sf.net/p/fhem/code/trunk/fhem/www/frontend frontend

Installiere sqlite und Perl plugins:

Alternativ könnten auch MySQL oder PostgreSQL verwendet werden, dazu müssten dann natürlich die entsprechenden Perl Module installiert werden.

und fügen Sie folgende Tabellen hinzu:

CREATE TABLE history (TIMESTAMP TIMESTAMP, DEVICE varchar(32), TYPE varchar(32), EVENT varchar(512), READING varchar(32), VALUE varchar(32), UNIT varchar(32));

CREATE TABLE current (TIMESTAMP TIMESTAMP, DEVICE varchar(32), TYPE varchar(32), EVENT varchar(512), READING varchar(32), VALUE varchar(32), UNIT varchar(32));

CREATE TABLE frontend (ID INTEGER PRIMARY KEY, TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP, TYPE TEXT, NAME TEXT, VALUE TEXT);

mit .tables können Sie überprüfen ob die drei Tabellen (current, history, frontend) korrekt angelegt wurden, mit .exit können sie die Datenbankshell wieder schließen.

Stellen Sie sicher dass Fhem Schreibzugriff auf die Datenbank hat:

Editieren Sie die db.conf:

und fügen Sie folgendes hinzu:

%dbconfig= (
connection => "SQLite:dbname=/opt/fhem/fhem.db",
user => "",
password => ""
);

SSH Access with certificates

To easily access all your computers you may want to authenticate yourself with certificates.

On a Mac, first install the missing ssh-copy-id:

Then you can copy your public key to the ssh hosts you frequently need by:

You may get this warning if the host already is in known hosts:
Warning: the RSA host key for 'panda' differs from the key for the IP address '10.152.196.248'
Offending key for IP in /Users/tatsch/.ssh/known_hosts:19
Matching host key in /Users/tatsch/.ssh/known_hosts:24
Are you sure you want to continue connecting (yes/no)? yes

If that happens, simply delete the offending lines by

and ctrl + K to delete the whole line

Bluetooth on Radxa Rock

Because of some kernel memory allocations not aligned to 4 bytes, bluetooth until now did not work on radxa. Fortunately rapidkaju has found a fix:

Now you should be able bring up your bluetooth device:

see its detailed status:

to make the rock discoverable:

to scan the environment for discoverable devices:

Once you found something you like to connect to:

and have a look at the connections:

Then you can pair with: