OpenELEC + HDHomeRun + Tvheadend

Update March 2015 – Some of this info is out of date. Will update the info, and put a good guide on the wiki.

 

Intro

I’ve recently set up the OpenELEC (XBMC/Kodi based) entertainment centre with HDHomeRun as the TV tuner, and fed into the system with the Tvheadend backend and front end.

This is a quick guide to setting it up, and hopefully stop you from depriving yourself of sleep (like I did) as you bang away getting it sorted.

Props to: Code Bytes for getting me started!

Prerequisites

  • You’ve got XBMC/Kodi set up, and you have a skin that supports live TV.
  • You have your HDHomeRun plugged into your home network and with an antenna feed into it.

OK let’s do this.

Hardware

Don’t assume that the HDHomeRun signal is fine! These boxes need a strong signal to drive them – something stronger usually that what your TV needs to get a decent picture.

I had to take the antenna cable into an amplified splitter. Without it, I found that (in Australia) my channel 10 was a bit iffy, and ABC was poo, and community channel 31 couldn’t even be found.

The amp I got is a GME  Kingray 162.  It cost me about $50 from Dick Smith Electronics. It is an outdoor unit and supposed to be mounted on the antenna as close to the antenna as possible. I’m in a rented unit so don’t want to get on the roof and muck around with the antenna so I have it inside where the cable comes in. The lower down it is – the more noise you amplify. Still it did the trick for me, where it amplified the signal enough for the HDHomeRun to run clean and with digital – that’s all that matters. 🙂

Some tips

  • Always use the F-type screw in cables where possible and avoid the PAL/Bellings Lee adapters.
  • Experiment with cables. I found that for some reason, the cable that came with the HDHomeRun worked better that the new Dick Smith cable I bought.
  • Run the Windows software to gauge differences before and after amplification, and with different cables. Use the very best cable from amp to HDHomeRun.
  • Do a scan with the Windows software (or Mac software) and see that all is sweet before you start blaming XBMC/Kodi for your woes!

Add-Ons

Install these plugins. They are both in the OpenELEC standard repository.
HDHomeRun
TVHeadEnd

Config

HDHomeRun

Here’s the tricky bit, and where I banged my head for ages! The first thing you want to do is configure HDHomeRun to be setup as a working source of TV, so it looks to the Linux OS like it’s attached to the box and so the Tvheadend can use it!

Now I was screwing around with this late at night so I don’t know if some steps are necessary but when you test your setup you’ll know I guess.

Start by running the configuration for the “hdhomerun” add-on
System -> Add-ons -> Enabled  -> Program  -> hdhomerun

General
 -- Pre-wait time [sec]    "2"  [default]
    -- Post wait time [sec]   "1"  [default]
    -- Enable userhdhomerun logging   "on" [changed]
    -- Enable libhdhomerun logging   "on" [changed]
    -- Enable suspend/resume the driver "off" [default]
Tuner Settings
    -- Enable modifying settings    "yes"  [changed?]

Now hit the “Refresh tuners”… and your tuner should show up. Set it to DVB-T, use full names to whatever you like (I choose “off”), and set number of tuners to 2, if it has 2. Don’t disable….that would not be sensible.

It’s very important to enable the logging above, and I’ll explain why. You see, HDHomeRun has a userspace component and a kernel component. The “userhdhomerun” userspace program scans the network to find the devices on the network, and then the “libhdhomerun” sets up kernel devices in /dev

OpenELEC:~ # ls /dev/dvb/
 adapter0  adapter1
 OpenELEC:~ #

If things aren’t sweet, you won’t see those devices. Now these two programs have to run and setup the devices before Tvheadend runs, or you won’t see the devices to choose from the Tvheadend web interface, that I’ll get to later.

Fix for missing adapters

The HDHomeRun add-on wiki page it says, “This driver is started from tvheadend and vdr addon”. Well Tvheadend may do this once you’ve got HDHomeRun configured already, but I found in order to get the two HDHomeRun tuners to show up on the Tvheadend web interface in the initial step, then I had two options:

  • Install and enable “vdr” add-on, which I didn’t need; or
  • enable logging for “userhdhomerun” and “libhdhomerun”

I chose the latter. It seems that enabling logging starts those processes up before Tvheadend starts, which is what you want. If the adapters weren’t there and I ran “userhdhomerun” on the CLI, then the adapters would show up in /dev/dvb/ but Tvheadend wouldn’t use them, as they weren’t there when it scanned for /dev/dvb/ devices! I lost a lot of sleep because of this, and was fully relieved when enabling logging solved my issues! (but I still had a reboot issue… see below).

Playing with config files

\[kodi IP address without brackets\]Userdataaddon_datadriver.dvb.hdhomerun

In there, there should be the following files – all created by the setup tool

  • adapters.txt
  • dvbhdhomerun.conf
  • dvbhdhomerun.sample
  • settings.xml

I didn’t need to create any of those. If something goes wrong and you, for whatever reason, need to hack on this manually then grab the dvbhdhomerun.sample from /storage/.xbmc/addons/driver.dvb.hdhomerun/config and copy it into that network share. Then copy that file to the same network share and rename it “dvbhdhomerun.conf” which is the config file it’ll use. My conf file has some comments and the meat of it says:

[1110AE0D-0]
 tuner_type=DVB-T
 use_full_name=true
 [1110AE0D-1]
 tuner_type=DVB-T
 use_full_name=true
[libhdhomerun]
 enable=true
 logfile=/var/log/dvbhdhomerun_libhdhomerun.log

….. where 1110AE0D is the “Device ID” you’ll find printed on the device, and which can also be found by running “userhdhomerun” on the CLI.

My “adapters.txt” says
“Tue Nov 25 13:21:22 2014 Name of device: 1110AE0D-0 Tue Nov 25 13:21:22 2014 Name of device: 1110AE0D-1”

…which was created automatically for me.

TVheadend

Go to webpage of TVHeadend: http://[kodi IP address without brackets]:9981
Go to Configuration -> DVB Inputs -> TV Adapters

Select the first adapter.
Click “Add DVB Network by Location”
Choose your location
Click “Enabled”
Click “Save”

TVheadend now starts scanning for channels. You can monitor its progress in the pane to the right. When “Muxes awaiting initial scan” is zero, it’s done.
Click “Map DVB Services to Channels”.
The mapping will also take some minutes to complete depending on how many channels are present.

In the web config in Configuration -> TV Adapters: After all channels have been configured, disable “Autodetect Muxes” and “Idle Scanning“. Having these enabled completely destroyed the stream from TVHeadEnd, making the image look garbled and stuttering. It looked like a low bandwidth connection or bad signal.

Missing Channels?

I had an issue where the muxes for “Australia -> au_Melbourne” didn’t have the newly added “C31” community channel, and the changed SBS settings. Doh!

What I had to do was a full channel scan by deleting all the existing Multiplexes, then choosing the “Add DVB Network by Location” and choosing the “–Generic–” -> “auto_Australia”. This does a fairly exhaustive scan off all the muxes devoted to DVB in Australia – 100 at the moment! Grab a coffee and do something else for a good half an hour as it takes a while!

Then when done, over on the Multiplexes tab, select all the muxes with no IDs and delete them. I was left with:

  • Seven Network
  • SBS Melbourne
  • Nine Network Australia
  • Network TEN
  • ABC Melbourne
  • C31

…yay they are all there!

I ended up with 35 “services”. One was bogus in that it had no details at all. So we’re left with 34 services. A few of those were duplicates, so we’re left with 31 *actual* services. 5 of those are radio (ABC Jazz, Double J, SBS Radio 1, SBS Radio 2, and SBS Radio 3), and 26 free to air TV channels.  You don’t have to worry about removing those 3 duplicate TV channels – the front end seems to filter out the dupes.

You should now be able to go to the front end and filter out the garbage shopping channels, and rearrange your channel order.

Things Messed on Reboot?

I found that every time I rebooted, I had a message about there being no hardware found, and couldn’t play live TV. The fist was to go back into the HDHomeRun add-on settings and set the “Pre wait time [sec] from “2” to “7”, which gave HDHomeRun more time to initialise. I found “5” didn’t work, and “7” did. I didn’t try “6” but even if it did work, I prefer to give it that extra second to be on the safe side.

I also found I could untick the logging options on HDHomeRun which I’d setup earlier.

TVheadend Tweaks

Channel Cleanup

Go to the “Channel / EPG” and delete all the home shopping channels. I also deleted ABC3 (kids shows), and SBS3 (duplicate of another SBS channel).

Time shifting

Go to Recording / Timeshift, and enable this, and up the max size to something a lot bigger. I’ve gone with “10240” (i.e. 10 gigs) for now. Make sure you have a SSD drive for maximum smoothness. This will allow you to pause and rewind live TV.

Channel Icons

I found some great TV logos / Channel Icons for Australian stations here:
You need to make sure that the image file names are exactly the same name as channel names – including case. For ABC2 / ABC4 – that contains a “/” in the name so for that one you have to manually pressing  “C” on a keyboard attached to your OpenELEC box and then select “Choose Thumbnail”.

Future Versions

I have been reading the forums and see that OpenELEC and Kodi 14 are now in beta, with a final release probably available by early 2015. This has a much updated version of Tvheadend that includes direct support for HDHomeRun devices, and also promises a lot of improvements for TV/PVR functionality, so much of what I’ve written above will change.

Still, there’s a lot of code changes under the hood with all the XBMC to Kodi name changes, so I’d suggest backing up your complete system before making the jump! I personally will wait for a couple of point release versions of openELEC before making the jump to OpenELEC 5.x (based on Kodi 14.x).

2 comments

  1. You saved me hours on this.
    I had some problems to find the correct menus on tvheadend 3.9.2765, as it seemed to have changed by the time you wrote this article. (even if I’m still using openelec 4.x)
    but finally, it’s working all right.
    Thx a lot

    1. Hi there. Yeah I just had another read and I actually wrote this just before Kodi and TVH had some big updates, and so the setup is a bit different now. I’ll have to update these instructions. It might be a good candidate for a wiki I recently setup called http://wiki.gavowen.ninja/ which doesn’t have any real content there yet.

      Glad I could help!

Leave a Reply to gisam Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.