dhleong / ps4-waker

Wake your PS4 over LAN (with help from the Playstation App)
MIT License
451 stars 40 forks source link

How to perform "search" from nodejs? Please help me with scripting #160

Closed AlexBGoode closed 2 years ago

AlexBGoode commented 3 years ago

Hello

Cannot figure out how to call Detector of any relevant code from my node-red flow. Tried many variants around

var dev = require('ps4-waker');
var ps4 = new dev.Device();
// var ps4 = new dev.Device(detectOpts = {timeout: 15, autoLogin: false});
console.log( ps4.getDeviceStatus() );

with no success

In the best case, I get

UnhandledPromiseRejectionWarning: Error: Could not detect any matching PS4 device ...

However, the command line execution works well this way: # npx ps4-waker search { "type": "device", "statusLine": "200 Ok", "statusCode": "200", "status": "Ok", ... }

dhleong commented 3 years ago
dev.Device(detectOpts = {timeout: 15, autoLogin: false});

I'm not familiar with this syntax; I think maybe it should just be:

dev.Device({timeout: 15, autoLogin: false});

But the real reason you're having trouble is almost certainly that timeout is in milliseconds, not seconds, so you're not giving it enough time. Try 15000, for example—the default value is 10000.

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.