Documenation?

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Post Reply
JefferMC
Posts: 11
Joined: Sat Jun 06, 2020 7:34 am

Documenation?

Post by JefferMC »

Is there a document that outlines the available HTTP requests you can make to the device that return data instead of web pages? I've learned of:

http://hdhomerun.local/discover.json (GET)
http://hdhomerun.local/status.json (GET)
http://hdhomerun.local/lineup.json (GET)

I thought I saw some documentation about an interface the diagnostics program uses (not the above), but I can't seem to find that, and prefer the JSON anyway.

JefferMC
Posts: 11
Joined: Sat Jun 06, 2020 7:34 am

Re: Documenation?

Post by JefferMC »

Found it:

https://info.hdhomerun.com/info/http_api

The INFO host isn't easy to discover/reach.

EDIT: Actually, this doesn't document all of the ones in my first post. So, is there a more complete API list?

rpcameron
Posts: 976
Joined: Fri Mar 25, 2016 9:55 am
x 4

Re: Documenation?

Post by rpcameron »


JefferMC
Posts: 11
Joined: Sat Jun 06, 2020 7:34 am

Re: Documenation?

Post by JefferMC »

Thanks. This isn't complete either. I think I wandered in here to find discover. I guess it's a work in progress. :)

rpcameron
Posts: 976
Joined: Fri Mar 25, 2016 9:55 am
x 4

Re: Documenation?

Post by rpcameron »

In general, the documentation isn't very good, and it is spread all around. They've said they're going to put everything together, and it hasn't quite happened yet in any comprehensive manner.

Honestly, the best way to figure out the API is by examining the source of their Kodi plugin, as the Python isn't too difficult to figure out. Also, other source repositories will probably help, too.

djp952
Posts: 1289
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 10

Re: Documenation?

Post by djp952 »

You are welcome to browse this source file, if you search for "api.hdhomerun.com" you can get (what I think is) a complete list of the things you can do with the API, less one function that cannot be used by third-party applications. That particular module isn't as easy to follow as the python add-on code will be, it's a small piece of a much bigger application, but I'm happy to help explain anything that needs explanation. Just drop me a line!

https://raw.githubusercontent.com/djp95 ... tabase.cpp

I do a fairly good job of keeping up with API changes as they happen, but nobody's perfect :)

JefferMC
Posts: 11
Joined: Sat Jun 06, 2020 7:34 am

Re: Documenation?

Post by JefferMC »

Thanks djp952, I'll have a look.

Online
nickk
Silicondust
Posts: 16245
Joined: Tue Jan 13, 2004 9:39 am
x 78

Re: Documenation?

Post by nickk »

Also feel free to ask questions here - we will help with API concepts and questions.

Nick

JefferMC
Posts: 11
Joined: Sat Jun 06, 2020 7:34 am

Re: Documenation?

Post by JefferMC »

Okay... one thing I'm looking to do is do routine monitoring. I'm going to query and capture the Signal/Symbol Strength/Quality measures on a regular basis for review. First tool I'm going to use (prior to upgrading my internal monitoring to Graphite) is MRTG, and it routinely captures boot time. I don't see anyway to get that currently other than grab the log page (/logs) and hope the initial NTP log entry hasn't scrolled off the top.

jasonl
Expert
Posts: 15376
Joined: Sun Oct 28, 2007 9:23 pm
x 12

Re: Documenation?

Post by jasonl »

The HDHomeRun device doesn't have a battery and therefore has no way to keep a clock running while unpowered and thus it does not know the time when it powered up. A PRIME device with a CableCARD connected to a functional cable system will receive the time from the cable system, and other devices will set their time when they sync with the Silicondust channel lineup server, but those times may or may not be anywhere near the time the device powered up. Just as an example, if you get a big storm that knocks out a bunch of powerlines, the power might come back on at your house days before it gets restored at your cable/phone company's office.

djp952
Posts: 1289
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 10

Re: Documenation?

Post by djp952 »

Something I always thought would be pretty cool for signal/stream metrics via the modern HTTP/MPEG-TS interfaces would be to simply insert TS packets that provide the real-time signal/stream statistics. AFAIK, to get the current signal stats you need to query the device via the legacy libhdhomerun library, which requires a lot of polling inefficiency not to mention that if you're live streaming via RECORD you have no good way to know exactly which tuner to even query in the first place.

Decoders would ignore the PID like they do the metadata already sent by RECORD today, and 188 bytes is probably more than enough to convey the information every second or so. One extra TS packet every second wouldn't cause any noticeable bandwidth increase (a mere 660KiB/hour) either. Software capable of intercepting and parsing this PID could simply store off the values as they come in, and if the user wants to know them, they are already there, extremely close to real-time, and accurate.

It could also be beneficial to have these metrics embedded in recorded MPEG-TS streams (which they would be if the tuner created them, right?), I'd think it would make troubleshooting slightly easier in that the technicians can analyze the stream data and see if there was a signal quality issue around the time of the reported incident.

signcarver
Expert
Posts: 9327
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 10802091 131B34B7 13231F92 1070A18E 1073ED6F 15300C36
x 26

Re: Documenation?

Post by signcarver »

Though i agree with such being added to the stream, for many status.json can be of help... nickk even mentioned in another thread of including bps in a future update but my reaction to that is people really don't need such as the bit rate is variable enough it won't really show what they want it for.

JefferMC
Posts: 11
Joined: Sat Jun 06, 2020 7:34 am

Re: Documenation?

Post by JefferMC »

jasonl wrote: Thu Jun 11, 2020 5:16 pm The HDHomeRun device doesn't have a battery and therefore has no way to keep a clock running while unpowered and thus it does not know the time when it powered up. A PRIME device with a CableCARD connected to a functional cable system will receive the time from the cable system, and other devices will set their time when they sync with the Silicondust channel lineup server, but those times may or may not be anywhere near the time the device powered up. Just as an example, if you get a big storm that knocks out a bunch of powerlines, the power might come back on at your house days before it gets restored at your cable/phone company's office.
Yes, but it could (and probably does) know uptime, i.e. time since boot, and once it has obtained time via NTP, it can calculate absolute boot time. Until the initlal NTP record leaves the log, I can do that from the log. Not saying it necessarily should, I'm saying that just because it doesn't have a battery doesn't mean that it can't.

Post Reply