sgnl / nodeku

discover and control Roku devices with NodeJS

Home Page:https://medium.com/@sgnl/nodeku-control-your-roku-with-node-js-d8b8c87cdba6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Roku TV is not discovered with SSDP

Glavin001 opened this issue · comments

Running the following always times out

const Nodeku = require('nodeku')

console.log('Looking for devices...');
Nodeku()
  .then(device => {
    console.log(`Device found at: ${ device.ip() }`)
    // 'xxx.xxx.xxx.xxx:8060'
    return device.apps()
  })
  .then(apps => {
    apps.forEach(app => console.log(app))
    // [{ id, name, type, version }, ...]
  })
  .catch(err => {
    console.error(err.stack)
  })

Logs

Error: Could not find any Roku devices. Time spent: 10 seconds

Info

Roku TV
Roku version: 7.7.0

Related to #7

Are you able to successfully ping your device from your computer (by getting it's IP from the device menus and using port 8060)?

Ping works:

❯ ping 192.168.1.28
PING 192.168.1.28 (192.168.1.28): 56 data bytes
64 bytes from 192.168.1.28: icmp_seq=0 ttl=64 time=1.960 ms
64 bytes from 192.168.1.28: icmp_seq=1 ttl=64 time=1.923 ms
64 bytes from 192.168.1.28: icmp_seq=2 ttl=64 time=1.735 ms
^C
--- 192.168.1.28 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.735/1.873/1.960/0.099 ms

And if I create a device manually -- without using SSDP discovery -- using my Roku's IP -- 192.168.1.28 -- I am able to send commands and it works.

I wonder there should be a feature to set the IP manually for cases like this.

regardless, I would love to be able to investigate the issue further. LMK if you come up with any more information or a solution @Glavin001.

Thanks for the report

I wonder there should be a feature to set the IP manually for cases like this.

I think the Device should definitely be exposed. If it is not already done by next weekend maybe you'll see a Pull Request coming your way 😉.


I've been trying to get SSDP to detect my Roku for a few days without success. At this point, I am giving up on SSDP and assuming the IP will need to be manually configured.

I had hoped I was missing something obvious about enabling SSDP support on Roku, however I did not find any articles to support this.

SSDP should be enabled by default. I've read that it could be a router setting, I was reading the thread this morning...

https://forums.roku.com/viewtopic.php?t=60236

You could use network diagnostic tools with Wire Shark to further debug but if it's quicker to expose the Device and get you up and running faster, that should be the route to take.

Thanks for the help, a PR would be 👌

@sgnl Do you have any guidelines for how you would like Device exposed directly? I can put together a PR but would rather not invest time in a method you are not interested in pursuing.

@sgnl specifically, would you consider breaking apart the module to export two functions Discover and Device as well as keys? This would unfortunately be a backwards-incompatible change as the module export is no longer directly a method that can be used to initiate discovery.

This would change the discovery to
var nodeku = require('nodeku');
nodeku.discover().then.(...);

Creating a new device by IP address would be:
let device = nodeku.Device('192.18.1.50');
device.keypress(nodeku.keys.HOME);

@barnabycourt @Glavin001

See the mentioned PR. Hopefully it's useful!

very "beta" because I haven't written any tests for it nor actually tested against my Roku device. With that caveat... SHOULD WORK 🐸

const Nodeku = require('nodeku');

const device = Nodeku.Device('127.0.0.1')
device.ip();

// or …
Nodeku.Discovery(timeoutNumberValueHere).then(device => device.ip())

// still valid cause it's essentially `.Discover()`
Nodeku().then(device => device.ip())

Just realized I didn't expose the "keys", I will have an update for that asap