Page 1 of 2

Ideas on why I can't edit DirecTV actions?

PostPosted: Sat Oct 25, 2014 12:10 pm
by ChopOMatic
The screencast linked below is the best way to understand what I'm seeing, but in a nutshell, when I click to EDIT ACTION SETTINGS for a DirecTV plugin action, I get the WaitWheel for 15-30 seconds, and nothing more.

http://www.screencast.com/t/xbs6otKJFfl

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Sat Oct 25, 2014 2:36 pm
by DaveL17
One possibility is if the IP address of your DirecTV receiver has changed.

Have you tried to add a new action?

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Sat Oct 25, 2014 2:39 pm
by ChopOMatic
The IP addy is correct. (Permanently assigned IP via the router.)

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Sun Oct 26, 2014 7:37 pm
by jay (support)
The spinning beachball means that the indigo server is having difficulty talking to the plugin. That usually means you have some plugin that's misbehaving. I'd start by disabling any 3rd party plugins and see if it changes anything. You can then narrow down the offending plugin.

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Tue Oct 28, 2014 7:30 pm
by ChopOMatic
Thanks, Jay. I'll look into that.

BTW, has anyone tinkered with getting feedback from DirecTV receivers to display on control pages? I know it's possible because I have a remote control app called Roomie on my iPad that displays a ton of info from the receiver, like My Recordings, the program guide, rating and such for what's currently playing, etc.

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Tue Oct 28, 2014 8:02 pm
by jay (support)
I vaguely recall some status commands in the API, but my goal was really just control. I do have a feature request in place to look at adding status (some day).

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Sat Dec 20, 2014 8:18 pm
by DaveL17
Jay said: I vaguely recall some status commands in the API, but my goal was really just control. I do have a feature request in place to look at adding status (some day).

Taking a break from a plugin project and before I knew what happened, I had this hammered out. This code just logs information reported by the receiver; you'll have to convert the code to write the information to variables or what have you. The only other thing that needs to be adjusted is to enter the IP of the unit in question (DTVIP).

Code: Select all
#! /usr/bin/env python2.5
# -*- coding: utf-8 -*-

import simplejson
import urllib2

DTVIP = "10.0.1.123"
url = "http://%s:8080/tv/getTuned?" % DTVIP
f = urllib2.urlopen(url)
simplejson_string = f.read()
f.close()
parsed_simplejson = simplejson.loads(simplejson_string)

#####  Log the Response #####
indigo.server.log("Query: %s" % parsed_simplejson['status']['query'])
indigo.server.log("Response: %s" % parsed_simplejson['status']['msg'])
indigo.server.log("HTTP Status Code: %s" % parsed_simplejson['status']['code'])
indigo.server.log("Command Result: %s" % parsed_simplejson['status']['commandResult'])
indigo.server.log("Program Title: %s" % parsed_simplejson['title'])
indigo.server.log("Episode Title: %s" % parsed_simplejson['episodeTitle'])
indigo.server.log("Call Sign: %s" % parsed_simplejson['callsign'])
indigo.server.log("Major Channel: %s" % parsed_simplejson['major'])
indigo.server.log("Minor Channel: %s" % parsed_simplejson['minor'])
indigo.server.log("Program Rating: %s" % parsed_simplejson['rating'])
indigo.server.log("DirecTV Station ID: %s" % parsed_simplejson['stationId'])
indigo.server.log("DirecTV Program ID: %s" % parsed_simplejson['programId'])
indigo.server.log("Is Recording: %s" % parsed_simplejson['isRecording'])
indigo.server.log("Is VOD: %s" % parsed_simplejson['isVod'])
indigo.server.log("Start Time: %s" % parsed_simplejson['startTime'])
indigo.server.log("Offset: %s" % parsed_simplejson['offset'])
indigo.server.log("Duration: %s" % parsed_simplejson['duration'])
indigo.server.log("Is Off Air: %s" % parsed_simplejson['isOffAir'])
indigo.server.log("Is PC Locked: %s" % parsed_simplejson['isPclocked'])
Here is sample output:
Code: Select all
  Script                          Query: /tv/getTuned?
  Script                          Response: OK.
  Script                          HTTP Status Code: 200
  Script                          Command Result: 0
  Script                          Program Title: Blackhawks @ Blue Jackets
  Script                          Episode Title: Chicago Blackhawks at Columbus Blue Jackets
  Script                          Call Sign: WGN
  Script                          Major Channel: 9
  Script                          Minor Channel: 65535
  Script                          Program Rating: No Rating
  Script                          DirecTV Station ID: 3223469
  Script                          DirecTV Program ID: 13697247
  Script                          Is Recording: False
  Script                          Is VOD: False
  Script                          Start Time: 1419120000
  Script                          Offset: 7718
  Script                          Duration: 9000
  Script                          Is Off Air: False
  Script                          Is PC Locked: 3
This has been tested with an HR-34. There is other information that the query might return depending on what the receiver is doing (i.e., playing a recording, playing a music channel, etc.) This was watching live programming.

Cheers,
Dave

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Sun Dec 21, 2014 9:06 pm
by ChopOMatic
Thanks, Dave. Can't wait to check it out.

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Sun Dec 21, 2014 9:30 pm
by DaveL17
ChopOMatic wrote:
Thanks, Dave. Can't wait to check it out.

Sure thing. Let me know if you have any questions.

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 4:53 pm
by ckeyes888
Looks very cool. Maybe post a bit of example code, for us Python challenged types, to write
a state to a variable?

Thanks,

Carl

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 6:06 pm
by DaveL17
Of course! Using the code above:

Code: Select all
#! /usr/bin/env python2.5
# -*- coding: utf-8 -*-

import simplejson
import urllib2

DTVIP = "10.0.1.123"
url = "http://%s:8080/tv/getTuned?" % DTVIP
f = urllib2.urlopen(url)
simplejson_string = f.read()
f.close()
parsed_simplejson = simplejson.loads(simplejson_string)

try:
   programTitle = parsed_simplejson['title']
   indigo.variable.updateValue(144522421, programTitle)
except:
   indigo.variable.updateValue(144522421, " ")
Change the IP address to your receiver (DTVIP) and the variable ID number to one that matches yours. Just repeat the last 5 lines for each value that you want to use.

Dave

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 6:24 pm
by ckeyes888
Love it, works perfectly!

Thanks a bunch!

Carl

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 6:29 pm
by DaveL17
My pleasure.
Dave

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 8:01 pm
by ckeyes888
When adding a few more states I'm finding very few will work.
In particular ['major'] to get the channel number.
Have you seen that as well?

Thanks,

Carl

Re: Ideas on why I can't edit DirecTV actions?

PostPosted: Mon Dec 22, 2014 8:35 pm
by DaveL17
Hi Carl - what are you seeing? The field that seems to choke the most often for me is the episode title, which is routinely 'None'. Please share your code and the output you're getting in return.

Dave