So my equipment is old as dirt. I'll own up to that - but the json API is the same to my eye. Here's the output of my living room STB:
pi@homebridge:~/scripts/directv$ curl http://172.16.30.79:8080/info/getOptions | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5873 100 5873 0 0 20607 0 --:--:-- --:--:-- --:--:-- 20679
{
"options": [
{
"command": "/info/getLocations",
"description": "List of available client locations. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
}
]
},
{
"command": "/info/getSerialNum",
"description": "STB serial number. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": false,
"name": "clientAddr",
"type": "string"
}
]
},
{
"command": "/info/getVersion",
"description": "Set-top-box and SHEF information. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
}
]
},
{
"command": "/info/mode",
"description": "Set-top-box mode. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": false,
"name": "clientAddr",
"type": "string"
}
]
},
{
"command": "/remote/processKey",
"description": "Process a key request from the remote control. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": false,
"name": "clientAddr",
"type": "string"
},
{
"isRequired": false,
"name": "hold",
"type": "string"
},
{
"isRequired": true,
"name": "key",
"type": "string"
}
]
},
{
"command": "/serial/processCommand",
"description": "Process a command request from remote control. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": true,
"name": "cmd",
"type": "hex"
}
]
},
{
"command": "/tv/getProgInfo",
"description": "Program information of specified channel at current or specific time. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "minor",
"type": "int"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": true,
"name": "major",
"type": "int"
},
{
"isRequired": false,
"name": "clientAddr",
"type": "string"
},
{
"isRequired": false,
"name": "time",
"type": "long"
}
]
},
{
"command": "/tv/getTuned",
"description": "Information about the currently viewed program. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": false,
"name": "videoWindow",
"type": "string"
},
{
"isRequired": false,
"name": "clientAddr",
"type": "string"
}
]
},
{
"command": "/tv/tune",
"description": "Tune to a channel. Warning: This command may change or be disabled in the future.",
"formControls": [],
"urlParameters": [
{
"isRequired": false,
"name": "wrapper",
"type": "string"
},
{
"isRequired": false,
"name": "minor",
"type": "int"
},
{
"isRequired": false,
"name": "callback",
"type": "string"
},
{
"isRequired": true,
"name": "major",
"type": "int"
},
{
"isRequired": false,
"name": "source",
"type": "int"
},
{
"isRequired": false,
"name": "clientAddr",
"type": "string"
}
]
}
],
"status": {
"code": 200,
"commandResult": 0,
"msg": "OK.",
"query": "/info/getOptions"
}
}
Each of my 4 (yes, 4) STBs has their own IP address and respond almost identically. They're listening on port 8080 (from what I can tell, this is what the directv-remote module defaults to as well). I've tried setting with and without geni, and I've only been trying to get one working, as I am about 99% sure you didn't count on a situation with multiple STBs with their own IP addresses.
{
"platform": "Directv",
"name": "DTV",
"ip_address": "172.16.30.79",
"exclude_geni": false,
"min_channel": 1,
"max_channel": 575
}
Relaunch homebridge, and it will cause this error (tried with and without specifying port number, same results):
[10/19/2020, 10:59:35] Plugin 'homebridge-directv' tried to register with an incorrect plugin identifier: 'homebridge-directv-location'. Please report this to the developer!
[10/19/2020, 10:57:11] [DTV] Initializing Directv platform...
[10/19/2020, 10:57:11] [DTV] Fetching DTV locations.
10/19/2020, 10:57:11] Loading 10 accessories...
[10/19/2020, 10:58:39] [DTV] Finding DTV Locations (accessories)...
[10/19/2020, 10:58:39] TypeError: Cannot read property 'length' of undefined
at /usr/local/lib/node_modules/homebridge-directv/index.js:48:40
at /usr/local/lib/node_modules/homebridge-directv/node_modules/directv-remote/index.js:264:21
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/homebridge-directv/node_modules/directv-remote/index.js:311:17)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
[10/19/2020, 11:01:20] [DTV] Failed to find any DTV Locations (accessories) - Check IP address in config.json!
[10/19/2020, 10:58:39] Got SIGTERM, shutting down Homebridge...
Ignore the timestamps. This is a patchwork copy and paste out of my logs. There's better ways to do it, but I need more coffee.
What appears to be happening is that the directv-remote module is attempting to pull this:
pi@homebridge:~/scripts/directv$ curl http://172.16.30.79:8080/info/getLocations | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 195 100 195 0 0 1772 0 --:--:-- --:--:-- --:--:-- 1772
{
"locations": [
{
"clientAddr": "0",
"locationName": "LIVING ROOM"
}
],
"status": {
"code": 200,
"commandResult": 0,
"msg": "OK.",
"query": "/info/getLocations"
}
}
It's at the very top of the file. The module validates the IP address by pulling exactly what I just pulled, and clearly it pulls valid json back and so far as I can tell, it should be found. I'm completely baffled. I was hoping if I opened an issue with this, your familiarity with how this thing ticks might ring some bells as to what could be so far off here as to break things outright. My gut says that it is failing due to using the default port of 80 instead of 8080, but that doesn't immediately add up, because if you look at the very top of the directv-remote module, you have this bit:
var options = {
hostname: IP_ADDRESS,
port: 8080,
path: '/info/getLocations'
};
I'm at a point now where I'm likely to run a tcpdump and see if I can capture precisely what is getting sent to my STB, but this is just feels ridiculous. Got any suggestions?