LocalIP is not an IP address in discover request

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
gtb
Expert
Posts: 3935
Joined: Thu Oct 06, 2011 1:00 pm
Location: Sunnyvale, CA USA

LocalIP is not an IP address in discover request

Post by gtb » Mon Dec 10, 2018 8:52 am

While I do not think this is an officially sanctioned API (from the github docs), making a request to http://my.hdhomerun.com/discover returns a json object useful to determine the local devices. Included is the local IP address. However, for Storage Engines, the LocalIP is not an IP address, but the IP address with the port. The port is available (and of course necessary for a Storage Engine) in the BaseURL and the DiscoverURL. It should not be in the LocalIP. Please consider making the LocalIP actually be a valid IP. Thanks for your consideration.

Sample response below including tuner (LocalIP is an IP address) and a storage engine (LocalIP includes port) [FD: this list was edited to change device ids and ip addresses, so it might not be completely valid]

Code: Select all

[
    {
        "DeviceID": "11111111",
        "LocalIP": "10.0.1.10",
        "BaseURL": "http://10.0.1.10:80",
        "DiscoverURL": "http://10.0.1.10:80/discover.json",
        "LineupURL": "http://10.0.1.10:80/lineup.json"
    },
    {
        "StorageID": "11111111-1111-1111-1111-111111111111",
        "LocalIP": "10.0.0.11:4999",
        "BaseURL": "http://10.0.1.11:4999",
        "DiscoverURL": "http://10.0.1.11:4999/discover.json",
        "StorageURL": "http://10.0.1.11:4999/recorded_files.json"
    }
]

signcarver
Expert
Posts: 8127
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: LocalIP is not an IP address in discover request

Post by signcarver » Mon Dec 10, 2018 9:23 am

I would disagree here as some may decide to base their requests off such address(and not bother with base/discover/storage url etc and manually add what is needed. Over 99% of recording engines would need the port number to access them... in other words i feel the opposite and that all the others need not be there (though i guess i wouldn't mind just base)

MatthewLundberg
Posts: 43
Joined: Mon May 08, 2017 3:57 pm

Re: LocalIP is not an IP address in discover request

Post by MatthewLundberg » Mon Dec 10, 2018 9:31 am

Seems that they might be consistent about the values returned. The tuner devices don't return the port in that field.

gtb
Expert
Posts: 3935
Joined: Thu Oct 06, 2011 1:00 pm
Location: Sunnyvale, CA USA

Re: LocalIP is not an IP address in discover request

Post by gtb » Mon Dec 10, 2018 10:00 am

signcarver wrote:
Mon Dec 10, 2018 9:23 am
I would disagree here ...
I guess I believe the Internets RFCs definition of what an IP address is should take precedence (using the presumption that something named "LocalIP" means it is an IP address), but I will absolutely agree that SD can choose to ignore standards.

signcarver
Expert
Posts: 8127
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: LocalIP is not an IP address in discover request

Post by signcarver » Mon Dec 10, 2018 10:11 am

What I believed happened was originally only that field (LocalIP) was returned (this may have been going back to the samsung e series tv app) and as a result any "older" software that may have used it may have needed it for compatibility (but these probably never would support storage engines)

Post Reply