UPDATED for 4.2.2
We're cutting the cord here. Playstation Vue has Big Ten Network in their mid-level package, so my wife, the OSU fan, has signed off on the endeavor. However, PSV only has 1 local station available in our area, so if I want to keep watching Sunday Night Football with my own instat replay, and recording Thomas & Friends and Bob the Builder for my 2 young sons, I needed a PVR. Now we already have 2 Pi3 Kodi's (OpenELEC) pulling from a NAS, but these Kodi's also double as RetroPie machines part of the time thanks to a customized NOOBs multi-boot setup, so they can't be TVH backends. What I needed was a dedicated backend TVH. Turns out getting it to work was a lot more painful than I thought, thanks to a good bit of old or bad information floating around various forums. So if someone comes along wanting to do what I did (more recently than 2 years ago), I figured I'd put it all down here.
Hardware:
Raspberry Pi 3 (for TVH backend)
HDHomeRun Connect (uses DHCP; no static IP - best you can do is map the MAC)
OTA Antenna
1.5 TB External HDD (with dedicated power supply)
2x Kodi/RetroPie Pi3 Appliances (TVH clients)
Note: All the above hardware is on the same subnet (for anyone who overnetworks their house like me), though I suspect only the TVH backend and HDHR need be.
Assumption1: HDHR is connected to the network and validated with the software from Silicon Dust's website.
1) Install OSMC + TVH.
I know it's a cop-out, but it's the only way I was ever able to get TVH to see the HDHR tuners. I must have reimaged the SD card a dozen times, and I even found a post here from people, whether on Raspbian or Ubuntu, having the same issue. I saw others responding to them that they didn't have any issues at all. If you're in the latter group, I tip my hat to you. But after 8 hours of installs, apt-gets, tweaks, reinstalls... OSMC was my escape hatch.
1a) Run the OSMC installer program on your local PC to prepare the SD card. I didn't use the prepared image, for the record.
1b) Boot the Pi 3 and run through the initial setup (you'll need a TV or monitor). Make sure to enable SSH. Login/password for everything (including TVH) will be osmc/osmc.
1c) Browse to the "App Store" and install Tvheadend.
1d) Verify that TVH is up and running by browsing to the Pi's IP address on port 9981
1e) Verify that the HDHR tuners are present under Configuration -> DVB Inputs
1f) Follow this easy video to scan your channels and get things set up initially (I've seen others link to it on this forum): https://www.youtube.com/watch?v=2Y-E4sQSb94
At this point you can unplug the monitor and move your Raspberry Pi to whatever corner of your house you like. It's a headless appliance at this point.
2) Configure the Episode Guide
This was another source of frustration, but less so than trying to get TVH to detect the tuners. You'll need to SSH into the TVH backend for much of this.
Note1: The link to tv_grab_file from that reddit post (2b) appears old. Use this instead:
https://github.com/Rigolo/tv-grab-file
Note2: You will need to manually edit line 7 of tv-grab-file to point to your generated xml file. It should read: "cat /home/osmc/zap2xml/xmltv.xml" or whatever path you specified in the zap2xml.conf.
2a) From ssh: sudo apt-get install xmltv-util cron
2b) Follow these steps:
https://www.reddit.com/r/raspberry_pi/comments/4th19b/problems_with_getting_tvheadend_to_work_with/d5i7l63/
IMPORTANT: Don't miss the part about "Installing Dependencies". I did. Oops.
2c) Reboot
2d) Under Configuration -> Channel/EPG -> EPG Grabber Modules, make sure module "Internal XMLTV: tv_grab_file..." is "Enabled"
2e) Under Configuration -> Channel/EPG -> EPG Grabber, make sure settings are as needed
2f) Under Configuration -> Channel/EPG -> EPG Grabber Channels, make sure the entries in the "Channels" have been populated correctly, or no broadcasts will load.
2g) Clicking "Save Configuration" should kick off a load. It will pick up the file that was generated when you ran runzap.sh as part of 2b.
2h) Under Configuration -> Channel/EPG -> Channels, I recommend mapping the channels manually by editing each one and setting a value for "EPG Source". Uncheck Auto EPG. Perhaps others have had better luck with the "Auto", but I didn't.
2i) Check the electronic Program Guide tab at the very top to see if it is populated. If not, try running the load again by clicking "Re-run Internal EPG Grabbers" from either the "EPG Grabber" or "EPG Grabber Modules" tabs. Check the System Log at the bottom of the browser window to make sure its picking something up.
If the feedback from the log indicates the grabber is finding channels but no broadcasts, then it could be your channels aren't set under EPG Grabber Channels or that the wrong channels have been designated for the entries on that screen. This can happen if there are multiple entries for the same channel. If channel info in the retrieved xmltv.xml changes (e.g. it gets a new ID), a new record is created for the same channel. The old record must be removed and the "Channels" property set for the new entries.
2j) Set up a cron task to run runzap.sh at midnight daily. Add the following line (no quotes): "0 0 * /home/osmc/runzap.sh"
3) Add External Drive (Optional)
I didn't want to tax my NAS with PVR duties, so I hooked up a 1.5 TB WD external HDD I'd had laying around. I recommend 7200 rpm.
Note1: For sizing purposes, I found that 1h of OTA 720p broadcasting takes up roughly 6 GB of space. 1080i shouldn't be much larger due to the interlacing of the higher resolution.
Note2: You can't use the /media directory in OSMC. It clears it out after each reboot and uses it for other temporary attached storage. In fact, your USB drive will be mounted automatically here when you first connect it here in an alphanumeric directory. If you put the external drive in the fstab, OSMC will leave it alone.
3a) From SSH, unmount the USB drive from the /media directory if it has been mounted there by OSMC with the following command: sudo umount /media/<some alphanumeric directory>
3b) Format the USB drive using fdisk (I'll leave out the details on that - I went with an ext4 file system though)
3c) sudo mkdir /mnt/usb
3d) Assuming your drive is /dev/sda, edit the /etc/fstab and add the following line at the bottom: /dev/sda1 /mnt/usb ext4 defaults 0 0
3e) sudo mount -a
3f) sudo mkdir /mnt/usb/data
3g) sudo mkdir /mnt/usb/timeshift
3h) sudo chmod 0777 /mnt/usb/data
3i) sudo chmod 0777 /mnt/usb/timeshift
3j) in TVH browser, under Configuration -> Recording -> Digital Video Recorder Profiles, add /mnt/usb/data to "Recording System Path" on the right-hand side under Recording File Options
3k) in TVH browser, under Configuration -> Recording -> Timeshift, add /mnt/usb/timeshift to "Storage Path" under Timeshift Options
4) Connect your client software. I'm using Kodi/LibreELEC so that's what these instructions are geared towards.
Note1: OpenELEC/LibreELEC 7.x, for some reason, unless the Guide is populated on the Kodi client, you won't be able to timeshift. The buffer files will be building up on your TVH backend, but the RW/FF buttons will be grayed out. Once your Episode Guide populates, this functionality opens up. It's a bug in Kodi v16/Jarvis that is supposedly fixed in v17/Krypton.
Note2: I had to restart Kodi to get the Guide to populate.
4a) Install client from Add-Ons -> PVR
4b) Configure the plugin. The selections are all pretty self-explanatory.
4c) Under Settings -> TV, select the "Enable" radio button
That's what worked for me. It's running like a champ now. I hope this helps others, and if I think of anything I missed or someone finds I've missed a step, please let me know.