Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

DirecTV – API JSON Service

Posted on January 3, 2018January 3, 2018 By David Kittell

If you have your DirecTV Unit plugged into your network at home you could run a couple fun commands.

#!/bin/sh

#  DirecTV.sh
#
#
#  Created by David Kittell on 1/3/18.
#

# Variables - Start
unitIP="<IP ADDRESS>"
# Variables - Stop

# Get Unit Serial Number
json=$(curl -s -X GET http://${unitIP}:8080/info/getSerialNum)
#echo ${json}
serialNum=$(echo ${json} | jq ".serialNum" | sed 's/"//g')
echo "Unit Serial Number: ${serialNum}"

# Get IDs and Version
json=$(curl -s -X GET http://${unitIP}:8080/info/getVersion)
#echo ${json}
accessCardId=$(echo ${json} | jq ".accessCardId" | sed 's/"//g')
receiverId=$(echo ${json} | jq ".receiverId" | sed 's/"//g')
version=$(echo ${json} | jq ".version" | sed 's/"//g')
systemTime=$(echo ${json} | jq ".systemTime" | sed 's/"//g')

unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
  systemTimeHR=$(date -d @${systemTime} '+%Y-%m-%d %I:%M:%S %p')
elif [[ "$unamestr" == 'FreeBSD' ]]; then
  systemTimeHR=$(date -r ${systemTime} '+%Y-%m-%d %I:%M:%S %p')
elif [[ "$unamestr" == 'Darwin' ]]; then
  systemTimeHR=$(date -r ${systemTime} '+%Y-%m-%d %I:%M:%S %p')
fi

echo "Unit Version: ${version}"
echo "Unit IDs:\n     Access Card ID: ${accessCardId}\n     Reciever ID: ${receiverId}"

echo "Unit DateTime: ${systemTimeHR}"
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code JSON UNIX UNIX Shell Scripts

Post navigation

Previous post
Next post

Related Posts

PowerShell – Script for adding/removing/viewing entries to the hosts file.

Posted on March 7, 2019

As a web developer you often have to use a host file, this script helps assist a safe and fast change with little effort. # # Powershell script for adding/removing/showing entries to the hosts file. # # Known limitations: # – does not handle entries with comments afterwards ("<ip> <host>…

Read More

Show Windows Version On Desktop

Posted on November 9, 2013October 26, 2015

WARNING: Backup the computer you try these scripts on before you run these. Windows Registry Editor Version 5.00 [[HKEY_CURRENT_USERControl PanelDesktop] "PaintDesktopVersion"=dword:00000000 Originally Posted on November 9, 2013Last Updated on October 26, 2015 All information on this site is shared with the intention to help. Before any source code or program…

Read More

Android Contacts – Working With Duplicates

Posted on March 26, 2014October 26, 2015

While this line is not necessary it’s a good idea to limit to this initially until you are ready to run on a larger scale. AND data1 LIKE "%<Organization Name>%" SELECT _id ,raw_contact_id ,data1 ,data4 ,data5 FROM data WHERE mimetype_id IN ( SELECT _id FROM mimetypes WHERE mimetype LIKE "%organization%"…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes