SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Linux > SageTV for unRAID/Docker

Notices

SageTV for unRAID/Docker Discussion related to SageTV for unRAID/Docker. Questions, issues, problems, suggestions, etc. relating to SageTV for unRAID/Docker should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-15-2016, 12:47 PM
mibsy mibsy is offline
Sage User
 
Join Date: Jul 2007
Posts: 57
UPNP Tuning some DISH receivers with gentuner

So I discovered that the DISH VIP 211/211k/222 receivers have UPNP channel changing available on the network ports (someone else documented it online for another PVR distribution). I found a bash script (upnpchannelchanger) that changes the channels at:

https://github.com/jheizer/UPnPChannelChanger

Then I customized the gentuner.IPSTB script to accommodate macro tuning. You must enter the receiver names and IPs into the MYRECEIVERS variable and enter the full path to the upnpchannelchanger script.

The gentuner.DISH contents is fairly straightforward and is as follows:
Code:
#!/bin/bash
#
# gentuner.DISH
# Derived from the gentuner.IPSTB sample
#
# See gentuner.README for details on gentuner
#
# This script proxies commands from the Generic Tuner Plugin
# to an IP enabled receiver(s) running UPNP tuning. 
# This was tested to work on DISH VIP 211k receivers and reported to work
# on DISH VIP 211 and VIP 222 receivers. It requires the upnpchannelchanger
# script written by Jon Heizer and can be found at:
# https://github.com/jheizer/UPnPChannelChanger
# It is maintained separate and the LICENSE is included in the script.
# The script wakes the system from sleep, sets the Inactivity timer to 
# 8 hours and macro tunes the channel. Two caveats to using this method:
#
# 1) It has hard coded IP(s) for the DISH receiver(s) that require updating 
# for your setup. Adjust the MYRECEIVERS variable with name:IP address. 
# You should probably hard code IP(s) wherever you run DHCP (router, etc).
#
# 2) The DISH receivers tune to the HD channels on the lower numbers 
# automatically when using IR. However, when using UPNP they do not.
# There are two options. First, remap the lower channel number via the 
# logical channel number to the higher HD channel or second, use the high
# HD channel numbers for your everyday tuning and viewing.
#

CMD=$1
REMOTE=$2
KEY=$3
CHANNEL=$3
#
# Place the path to the upnpchannelchanger executable 
#
UPNPTUNPATH="/opt/sagetv/gentuner/upnpchannelchanger"
#
# Enter your receivers and IP addresses one on each line surrounded on
# each side by a single ' (quote). Use a semi-colon : between the name and IP.
# The lines should look like this:
# 'Receiver1:192.168.10.10'
# 'Receiver2:192.168.10.11'
# etc.
#
MYRECEIVERS=(
     'Receiver1:192.168.10.10'
     'Receiver2:192.168.10.11'
     'Receiver3:192.168.10.12'
)

if [ "$CMD" = "KEYS" ]; then
    echo "not required"
elif [ "$CMD" = "SEND" ]; then
    echo "not required"
    exit 1
elif [ "$CMD" = "CAN_TUNE" ]; then
    echo "OK"
elif [ "$CMD" = "REMOTES" ] || [ "$CMD" = "TUNE" ]; then
    if [ "$CMD" = "REMOTES" ]; then
        for index in ${!MYRECEIVERS[@]}; do
        echo "${MYRECEIVERS[index]}" | cut -d":" -f1
    	done
    else
        for index in "${!MYRECEIVERS[@]}"; do
	TEMPVAR="$(echo "${MYRECEIVERS[$index]}" | cut -d":" -f1)"
            if [ "$TEMPVAR" = "$REMOTE" ]; then
		REMOTEIP="$(echo "${MYRECEIVERS[index]}" | cut -d":" -f2)"
            fi
        done 
	/bin/bash "$UPNPTUNPATH" "$REMOTEIP" "$CHANNEL"
    fi
else
    echo "Invalid usage."
    exit 1
fi
You would need to copy the gentuner.DISH to the /opt/sagetv/server directory as gentuner.

Read the comments in the script to understand the limitations. Configuration of the various receivers as remotes (once setup in the script) is accomplished through the gentuner plugin and the GUI. You can select the particular remote (Receiver1 for example). None of the other GUI gentuner options work until you exit out of the gentuner completely and go back in. Keys will not work and the other remote options are not really relevant since the UPNP channel tuning is macro tuning. Additionally the upnpchannelchanger script performs the wake from sleep, inactivity timeout set to 8 hours, and the delays.

Based on a read of the upnpchannelchanger license file, I could include it in my script, but I though for ease of upgrade and clearly giving credit to the creator, I'd leave it separate.

From my understanding, you may need to copy this gentuner script to the /opt/sagetv/server directory after upgrades, but I'm not certain. I'm sure someone can clarify.
Reply With Quote
  #2  
Old 10-15-2016, 06:09 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
This looks like it'd be a relatively simple thing to roll into a .java file to be built into sage (should actually be able to discover the devices even). Might have to dust off the old vip211k sitting on a shelf in the garage and see if I can get to the UPnP bits without a subscription. (Though it'd be easier if Sage's tunerplugin implementation was a little more java-extensible - it's tied to native libraries, instead of the 'Tuner' being an inheritable class. there's an override case for the DirectTV Serial control, which would be where I'd need to work from it looks like).
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room

Last edited by Fuzzy; 10-15-2016 at 06:29 PM.
Reply With Quote
  #3  
Old 10-15-2016, 06:17 PM
mibsy mibsy is offline
Sage User
 
Join Date: Jul 2007
Posts: 57
Quote:
Originally Posted by Fuzzy View Post
This looks like it'd be a relatively simple thing to roll into a .java file to be built into sage (should actually be able to discover the devices even). Might have to dust off the old vip211k sitting on a shelf in the garage and see if I can get to the UPnP bits without a subscription.
I thought about discovery, It isn't too hard if I'm not mistaken as the receiver provides a unique response on port 49200 (I think it has Echostar in the reply).

Something else I forgot to mention, there is a vip-channellist at that GIT URL. It pulls a list of all Authorized channels from the receiver, which would be really cool to pull in automagically as well. It could activate HBO freeviews and prevent enabling channels that are not subscribed to by the user.

I am not going to be any help with java...
Reply With Quote
  #4  
Old 10-15-2016, 06:37 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Instead of pinging the 49200 on every port looking for an echostar response, you can use actual UPnP Discovery, where they do respond with the box name and the serial. I foresee a tuning addition to sage that would show each of the connected box name/serial as 'REMOTES'
Code:
ViP211k R0100872578
Utilizing the channel list might be a bit more work - I mean, itmight be possible, but would be clunky. Currently, channel scans are the domain of the capturedeviceinput, which IS also the class that the tuning plugin is set up in, so it'd need code in there to detect that it doesn't do a scan another way, and that it is confitured to use the new dish network implementation, then it'd pass the 'scan' command to the DishNetworkUPnPTuner.java file that would pull the channellist from the box and pass it as the result of the scan request. not sure of negative impacts this might provide, and wouldn't be step one, that's for sure. Clunky, and not following other methods, but possible.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #5  
Old 10-15-2016, 06:44 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Can you provide the XML that the AuthChannels returns? (my non-activated box simply returns an empty <root></root> xml file). Wondering what sort of info is in there.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #6  
Old 10-15-2016, 07:40 PM
mibsy mibsy is offline
Sage User
 
Join Date: Jul 2007
Posts: 57
Quote:
Originally Posted by Fuzzy View Post
Can you provide the XML that the AuthChannels returns? (my non-activated box simply returns an empty <root></root> xml file). Wondering what sort of info is in there.
Just sent it via PM. I had to remove a few of the higher channels due to 25000 character limits.
Reply With Quote
  #7  
Old 10-15-2016, 07:45 PM
mibsy mibsy is offline
Sage User
 
Join Date: Jul 2007
Posts: 57
Quote:
Originally Posted by Fuzzy View Post
Instead of pinging the 49200 on every port looking for an echostar response, you can use actual UPnP Discovery, where they do respond with the box name and the serial. I foresee a tuning addition to sage that would show each of the connected box name/serial as 'REMOTES'
Code:
ViP211k R0100872578
Utilizing the channel list might be a bit more work - I mean, itmight be possible, but would be clunky. Currently, channel scans are the domain of the capturedeviceinput, which IS also the class that the tuning plugin is set up in, so it'd need code in there to detect that it doesn't do a scan another way, and that it is confitured to use the new dish network implementation, then it'd pass the 'scan' command to the DishNetworkUPnPTuner.java file that would pull the channellist from the box and pass it as the result of the scan request. not sure of negative impacts this might provide, and wouldn't be step one, that's for sure. Clunky, and not following other methods, but possible.
UPNP discovery sounds logical. I was going to play around with miranda.py to see how it worked, but wanted to focus on the tuning first. Makes a lot of sense.

I agree that the channel stuff is secondary to tuning. The network tuning does seem to be snappy. I just need to figure out why some of the lower channels that I mapped the logical channel number to the higher HD channel have started disappearing from my guide. They still show up enabled under the video source configuration screens but not under the guide.
Reply With Quote
  #8  
Old 10-16-2016, 12:56 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by mibsy View Post
I agree that the channel stuff is secondary to tuning. The network tuning does seem to be snappy. I just need to figure out why some of the lower channels that I mapped the logical channel number to the higher HD channel have started disappearing from my guide. They still show up enabled under the video source configuration screens but not under the guide.
A given 'channel' will only show up on the guide once. So if you have one lineup with MTV remapped to logical channel 24, and another lineup with it remapped to 489, only one of those entries will appear on the guide. I believe sage chooses the one from the lineup with the lowest 'providerID'. The fix is to remap the channel on all lineups (which is easiest to do in the Channel Manager UI - hit options from in the guide, and choose Channel Manager). The Remap button in there remaps the channel's logical number on all lineups that channel exists on.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #9  
Old 10-16-2016, 09:05 PM
mibsy mibsy is offline
Sage User
 
Join Date: Jul 2007
Posts: 57
Quote:
Originally Posted by Fuzzy View Post
A given 'channel' will only show up on the guide once. So if you have one lineup with MTV remapped to logical channel 24, and another lineup with it remapped to 489, only one of those entries will appear on the guide. I believe sage chooses the one from the lineup with the lowest 'providerID'. The fix is to remap the channel on all lineups (which is easiest to do in the Channel Manager UI - hit options from in the guide, and choose Channel Manager). The Remap button in there remaps the channel's logical number on all lineups that channel exists on.
You know, I've been a loyal Sage user for roughly 10 years and I continue to learn new things all the time. I had no idea that there were "options" on the Guide menu. I am doing as you suggest, but it is odd that I only have one lineup for all my DISH receivers. I have another lineup for just the HDHomeruns, but they don't overlap. So far so good. The Authorized Channel list XML file is helping me get the mappings just right.

Thanks a bunch for the reply and teaching me yet another feature.
Reply With Quote
  #10  
Old 10-16-2016, 09:07 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
there probably is overlap between your channels, as I'm betting Dish has your local channels as well, but at a much higher channel number.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #11  
Old 07-11-2021, 03:53 PM
n9cqs n9cqs is offline
Sage User
 
Join Date: Apr 2007
Posts: 69
THANK YOU from a Dish customer

I know that this thread is very old.... but I just found it this weekend, and I'm sure glad that I did. I've been a SageTV user since 2007... my first system was a Dell Optiplex 745 running Windows XP... I used IR blasters using USB-UIRT and LMGestion... used it until well after XP was out of usefulness, I kept it up... the thing that forced a change was that USB-UIRT quit. Odd how it happened... it would stop responding on one USB port, and when I would move it to another it would start working again... I chased it through the system until I ran out of ports (I even bought an add-on card to extend the machines usefulness). So I moved on to a Win7 machine that I built... everything worked well for quite some time until last year when the same thing started to happen. I ended up losing usb-uirt altogether. One of my DISH tuners was modified with R5000- and I limped along with that until this weekend.

THANKS again to the discovery of UPNP tuning. I got it going on a LINUX machine and the AV goes through the same Hauppauge HD-PVR.

Oh... by the way... HD-PVR devices work better when powering them with a step-down "BUCK" power device from a 12V power supply. I have an ASTRON power supply (with the big transformer and capacitors, etc) from my ham radio days... I've got three HD-PVR devices... all the bricks have long since died... but they work wonderfully with a 12V to 5V step-down off the Astron.

LONG LIVE SAGETV!!
Reply With Quote
  #12  
Old 07-11-2021, 08:24 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,199
There is a thread here on powering HD-PVRs from your PC as a PC power supply has a 5V line. Just splice into a molex connector and connect it to the barrel connector from your dead power supply and you are good to go.

Here is one of a few threads that describe this: https://forums.sagetv.com/forums/sho...2&postcount=19
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB-UIRT & Dish 612 and/or 722 Receivers - Do They Work? Savage1701 Hardware Support 0 10-26-2010 01:50 PM
USB-UIRT & Dish TV HD Receivers - Do They Get Along? Savage1701 Hardware Support 0 04-12-2010 11:15 AM
What do I need to add additional dish network receivers? btrcp2000 Hardware Support 0 08-18-2008 08:59 AM
Is there any serial/usb control for Dish receivers srcurtis Hardware Support 1 01-15-2008 10:45 AM
Problems with Dish Network, USB-UIRT, Dish 311 receivers e4gulf Hardware Support 8 05-31-2006 09:53 AM


All times are GMT -6. The time now is 10:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.