by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 21 06:21
    csmith0289 commented #6
  • Apr 20 22:02
    Twiggled commented #6
  • Apr 20 21:40
    Twiggled commented #6
  • Apr 20 05:51
    csmith0289 commented #6
  • Apr 18 01:32
    Twiggled opened #6
  • Feb 20 10:33
    mgarland1988 commented #8
  • Feb 20 00:41
    YG-UK commented #8
  • Feb 20 00:05
    mgarland1988 commented #13
  • Feb 19 23:58
    mgarland1988 opened #8
  • Feb 07 12:35
    csmith0289 closed #5
  • Feb 07 12:35
    csmith0289 commented #5
  • Feb 06 08:26
    brunoais commented #5
  • Feb 06 08:25
    brunoais commented #5
  • Nov 21 2019 13:04
    brunoAlmeida-sky opened #17
  • Jan 21 2019 22:21
    csmith0289 edited #5
  • Jan 21 2019 19:21
    csmith0289 edited #5
  • Jan 21 2019 19:21
    csmith0289 opened #5
  • Jan 20 2019 09:57
    csmith0289 closed #4
  • Jan 20 2019 09:57
    csmith0289 commented #4
  • Jan 20 2019 09:49
    csmith0289 opened #4
Dal Hundal
@dalhundal
so, to fix your issue - do a git pull on the v1-dev branch to get the changes I made in the last few days
then
(you might need to re-do an npm install because I've changed some of the dependencies)
then change that chunk of code to:
box.channelList.init().then(function() {
    box.setChannel(101).then(function() {
        process.exit(0);
    });
});
that'll ensure it has downloaded the channel list before you try to do the channel change
howzat?
john01925
@john01925
I'll give it a blast Dal cheers!
john01925
@john01925
Hi Dal - Wish I knew the syntax better :worried: Took me while to get it to run but it throws an error

var SkyPlusHD = require('../..');

var findABox = SkyPlusHD.findBox(process.argv[2] || undefined);

findABox.then(function(box) {
console.log();
console.log("Found a SkyPlusHD box!");
console.log(" IP:",box.ip);

box.channelList.init().then(function() {
box.setChannel(101).then(function() {
process.exit(0);
});
});
});

findABox.catch(function(err) {
console.log("Failed to find SkyPlusHD box",err);
});

the error is :

C:\SKYHD\sky-plus-hd-1-dev\tools\monitor>node 101.js
Unhandled rejection TypeError: Cannot read property 'init' of undefined
at C:\SKYHD\sky-plus-hd-1-dev\tools\monitor\101.js:10:16
at tryCatcher (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebird\js\main\util
.js:26:23)
at Promise._settlePromiseFromHandler (C:\SKYHD\sky-plus-hd-1-dev\node_module
s\bluebird\js\main\promise.js:489:31)
at Promise._settlePromiseAt (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebir
d\js\main\promise.js:565:18)
at Async._drainQueue (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebird\js\ma
in\async.js:128:12)
at Async._drainQueues (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebird\js\m
ain\async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\SKYHD\sky-plus-hd-1-dev
\node_modules\bluebird\js\main\async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:358:17)

Figures its the Unhandled rejection TypeError: Cannot read property 'init' of undefined
john01925
@john01925
Sorry that's not particularly legible
var SkyPlusHD = require('../..');

var findABox = SkyPlusHD.findBox(process.argv[2] || undefined);

findABox.then(function(box) {
    console.log();
    console.log("Found a SkyPlusHD box!");
    console.log("        IP:",box.ip);

box.channelList.init().then(function() {
    box.setChannel(101).then(function() {
        process.exit(0);
        });
    });
});



findABox.catch(function(err) {
    console.log("Failed to find SkyPlusHD box",err);
});
This message was deleted
the error is :

C:\SKYHD\sky-plus-hd-1-dev\tools\monitor>node 101.js
Unhandled rejection TypeError: Cannot read property 'init' of undefined
    at C:\SKYHD\sky-plus-hd-1-dev\tools\monitor\101.js:10:16
    at tryCatcher (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebird\js\main\util
.js:26:23)
    at Promise._settlePromiseFromHandler (C:\SKYHD\sky-plus-hd-1-dev\node_module
s\bluebird\js\main\promise.js:489:31)
    at Promise._settlePromiseAt (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebir
d\js\main\promise.js:565:18)
    at Async._drainQueue (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebird\js\ma
in\async.js:128:12)
    at Async._drainQueues (C:\SKYHD\sky-plus-hd-1-dev\node_modules\bluebird\js\m
ain\async.js:133:10)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\SKYHD\sky-plus-hd-1-dev
\node_modules\bluebird\js\main\async.js:15:14)
    at processImmediate [as _immediateCallback] (timers.js:358:17)
Dal Hundal
@dalhundal
It's complaining because you're calling box.channelList.init() and box.channelList is undefined. So it seems like you're not using the latest code. Did you do a git pull on the v1-dev branch to get the latest stuff?
I made changes in the last few days so the stuff you checked out before is not up to date
Dal Hundal
@dalhundal
John - I assume the pull request you just sent me is in error??!
john01925
@john01925
yes sorry :(
Dal Hundal
@dalhundal
No prob - I just closed it :-)
john01925
@john01925

OMG Dal its only gone amd worked my friend!
AWESOME Amigo !

Guess what, I'm also a total nube at Git so had to do a quick crash course :smile:
It still seemed to pull down the wrong code with :
git clone https://github.com/dalhundal/sky-plus-hd.git c:/JRSKY01

BTW I often see this error and can't repeat the script for a while.


C:\SKYJR002\tools\monitor>node 101
Failed to find SkyPlusHD box [Error: Timeout searching for service urn:schemas-n
ds-com:service:SkyRC:2]
Unhandled rejection Error: Timeout searching for service urn:schemas-nds-com:ser
vice:SkyRC:2
    at null._onTimeout (C:\SKYJR002\lib\sky-plus-hd_finder.js:56:12)
    at Timer.listOnTimeout (timers.js:110:15)

Would extending the timeout somewhere help with that?

Dal Hundal
@dalhundal
I'll have to check it out - can't remember where I'm setting the timeout. generally speaking though the timeout is probably a decent value. The examples I've given aren't really geared up to quickly connect, run a command and then exit. They're more aimed at connecting to the box, staying connected and then waiting for commands.
That said, its not undo-able for it to quickly connect and run a command then exit - its just not the focus of what I've been doing
john01925
@john01925
Well its great anyway :clap: Hopefully I can use this to change channel and control the box with my Homeseer 3 setup. Just need to do some reading.
john01925
@john01925
They're more aimed at connecting to the box, staying connected and then waiting for commands.
Can it be accessed and used like this now Dal?
Just wondering which script it is that does that...
Dal Hundal
@dalhundal
^ the tools/cli example does that, though probably not in the way that you want. It waits for commands to be typed into the shell. The mqtt example I was going through with Lee above waits for commands to be published using the MQTT protocol. You could do something similar for any interface - accept commands by HTTP requests / running a script / pressing a button / twitter.
Lee Collings
@leecollings
Hey Dal, I don't suppose there's any news on my situation? I appreciate it's probably going to start getting quite difficult for you, with two different issues going on here.
Dal Hundal
@dalhundal
Hi lee - no nothing yet - I haven't really had the time to spend on this. That said, I can see that it's probably useful if I put something solid together that addresses both of your issues. Essentially, you're both after the same thing - some sort of interface to quickly send a command to the box and exit - which means having some sort of service running in the background that has previously connected to the box and kept the connection open. I could start doing that next to tide some people over, though the core code doesn't even deal with things like losing connection to the box yet so it'll be quite bodgy. Loose connection to the box? Need to manually restart the service. All of this is doable, its just a question of getting around to it and priorities.
Lee Collings
@leecollings
Do you reckon that would have be something custom written then? Or would this still being use node.JS and the forever service?
Dal Hundal
@dalhundal
It's all doable using nodejs, and whatever method you fancy of keeping it running in the background - forever is just one way. F
For what it's worth, I don't think it's worth you posting that around because like I said the problem isn't with forever. Code 0 just means our script exited without an error. (In Linux, non zero codes indicate an error, 0 means all good). But that doesn't mean there wasn't a problem because our script mqtt.js is just thrown together with no attention at all to trying to report errors. It's fixable, but it's not what I'm doing right now
If I get time I'll make it work on my Pi and post the results
Lee Collings
@leecollings
Hey Dal, any update yet?
Dal Hundal
@dalhundal
Nope - I'm not focusing on the mqtt stuff
waternexus
@waternexus
Any news on what's happening?
Dal Hundal
@dalhundal
Yep - I don't have time to work on it at the moment :-(
Feel free to pitch in though :-)
Dal Hundal
@dalhundal
Hey all - I have two new simpler modules up on github / npm which should cover many of your use cases.
http://github.com/dalhundal/sky-remote - sends remote control commands to a sky box (the same as the buttons on the remote control - including power). Just needs the IP of the box you want to control, and is fast.
http://github.com/dalhundal/sky-remote-cli - a command line interface to the above - great to use on the command line / from other scripts etc. As simple as calling "sky-remote-cli 192.168.0.40 pause"
Should cover alot of what people want without the complexity of the the sky-plus-hd module (though I still intend to develop that)
@leecollings @waternexus @john01925 - hope that comes in handy
Negan99
@Negan99
Excellent work Dal & much appreciated as I could never get the previous module to work correctly.
I have 2 questions
1) Is there any way to check to see whether the Sky box is in standby or if it's turned on? This would prevent me from turning it off by accident.
2) If not then is the code that you have shown for the Sky button correct? If I press that on my remote & the box is in standby it turns on but using it from the CLI it doesn't. When I checked in the js file you show both the TV & Sky buttons as having code 127 which doesn't see right.
john01925
@john01925
Wow that is fantastic, great work. I too had given up with the old version but this is brilliant :smile:
Dal Hundal
@dalhundal

Hey @Negan99

1) No, this module can't tell you whether the box is on or not - it's very much a one way street - you can send commands to the box but there is no feedback at all from the box about its status or whether it could perform the command. All you can tell is whether you managed to send the command or not. Its pretty much like a real life Sky remote control in that respect. To know whether the box is on or not, would need to do some stuff the other module was doing I suspect (they are completely different in how the communicate with the box)

2) I'm not sure about the Sky button, to be honest I'm not sure if I tried using it. The TV button shouldn't be in the code at all - I need to remove it. If you think about it, your sky box cannot control your TV - which is why there are no codes for volume buttons either.

@john01925 :-)
john01925
@john01925
Yep the SKY button doesn't seem to work. The SKY button normally always switches the box ON or returns to normal from a within any sub menu. Everything else however looks good.
Negan99
@Negan99
Out of interest where did the codes come from? Would it be a case of trial & error if we were to look for a different code should the Sky button prove to be incorrect?
john01925
@john01925
Think I found it. 241 works on my box. If you replace the 'sky: 127,' with 'sky: 241,' in sky-remote.js you get the correct operation of the Sky button. That means you can power ON from standby and return to normal viewing from all sub menus.