openxbox / xbox-smartglass-core-node Goto Github PK
View Code? Open in Web Editor NEWNodeJS port of xbox-smartglass-core-python
License: MIT License
NodeJS port of xbox-smartglass-core-python
License: MIT License
Create a first version of the connection to the Xbox (either anonymous or authenticated, authentication can also be implemented later)
how to use gamepad ingame?
We have some samples in the readme, but it would be nicer to have some scripts in a separate folder
xbox-smartglass-core-node/src/smartglass.js
Line 188 in fad2a69
I am using your awesome module in my project. Once in a while I get this exception that crashes the app. The error states that Error is not defined, and clearly it is not :)
Hope it can be fixed.
Suggest created a new Error object with the description as message and return that.
Hi guys,
I wanted to know if there's a way to ignore the ping from the server (without sending pong), every few seconds, and still maintain the connection.
As the API suggested, there are "packet which needs to be acknowledged".
I was wondering if there is a way to bypass the idea that a connection keeps to be alive by acknowledging these packets.
I tried to ignore the incoming packets but it just caused some weird side effects (connection closed, actions sent to the server got ignored, etc...).
I dunno if this is an option but maybe with the connection request to send "keep connection alive" or something.
Thanks!
Oz.
Code is heavily bugged and its a mess. Need to refactor the files
Hi,
I currently try to figure out how I can recognize, that the connection between my client and Xbox has been disconnected. Due to the examples, I should listen to the _on_console_status
, but it seems like it is never emitted. I am also listening to _on_timeout
which is also not emitted.
So what is the intended way to recognize a disconnect?
I've installed it on my PI3 setup however, it does not wake up my Xbox One S.
I set my live ID and IP address correctly
When I call the power_on function I see 3 arp messages sent out from the PI3 to the IP address I've set.
However, there's nothing else:
14:33:33.780660 ARP, Request who-has 192.168.254.37 tell 192.168.254.199, length 28
14:33:34.796301 ARP, Request who-has 192.168.254.37 tell 192.168.254.199, length 28
14:33:35.836292 ARP, Request who-has 192.168.254.37 tell 192.168.254.199, length 28
What is wrong ?
Implement:
Are there any plans on including game DVR command into this and enabling auth to Xbox live, to get real name of the current application and some more information?
Hi,
any possibility to Absolute Volume Control and Mute ON/OFF.
thanks
Hey there! I'm able to discover and interact with a currently powered on Xbox. However, when the Xbox is powered off, I'm unable to discover it or power it on with a given IP and liveid
. I wasn't able to find anything in the OpenXbox documentation or other repos indicating what I should check. I've already set my Xbox to have the 'Instant-On' mode instead of the 'Eco' mode.
Under the hood is this essentially a Wake On LAN packet?
Revamp the smartglass client to use events and more modular
It would be nice to also have promisified versions of the functions in the module itself.
To ensure the application is stable enough for other people we need to implement mocha tests and probably use a lot of other tools as well.
Tools to use:
Any plans to input text channel commands?
Is it possible to open a specific app or game via the smartglass API?
We currently use python for authentication to the console. Ideally we would have to replace this with native NodeJS code
The library fails to open the path to the python script and thus fails completely. A fix has already been created and will be pushed soon.
Are there potentially other things that need to be installed in order to properly install this package?
Looks like the issue is installing x509
. That repo doesn't look actively maintained and mentions this:
If you are suffering from hard to fix build issues, there is an alternative (pure javascript) implementation using emscripten: https://github.com/encharm/x509.js (based on node-x509, slightly different API)
https://github.com/Southern/node-x509
Install output:
pi@rbpi:~/xbox_power_on $ npm install xbox-smartglass-core-node --save
> [email protected] install /home/pi/xbox_power_on/node_modules/x509
> node-gyp rebuild
make: Entering directory '/home/pi/xbox_power_on/node_modules/x509/build'
CXX(target) Release/obj.target/x509/src/addon.o
In file included from ../../nan/nan_converters.h:67:0,
from ../../nan/nan.h:222,
from ../include/x509.h:7,
from ../src/addon.cc:5:
../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
../../nan/nan_converters_43_inl.h:18:51: warning: ‘v8::MaybeLocal<v8::Boolean> v8::Value::ToBoolean(v8::Local<v8::Context>) const’ is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
val->To ## TYPE(isolate->GetCurrentContext()) \
^
../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
X(Boolean)
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/v8-internal.h:14:0,
from /home/pi/.node-gyp/12.3.1/include/node/v8.h:25,
from /home/pi/.node-gyp/12.3.1/include/node/node.h:63,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:2524:63: note: declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
^
/home/pi/.node-gyp/12.3.1/include/node/v8config.h:322:3: note: in definition of macro ‘V8_DEPRECATE_SOON’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
In file included from ../../nan/nan_converters.h:67:0,
from ../../nan/nan.h:222,
from ../include/x509.h:7,
from ../src/addon.cc:5:
../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
../../nan/nan_converters_43_inl.h:37:57: warning: ‘v8::Maybe<bool> v8::Value::BooleanValue(v8::Local<v8::Context>) const’ is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
return val->NAME ## Value(isolate->GetCurrentContext()); \
^
../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
X(bool, Boolean)
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/v8-internal.h:14:0,
from /home/pi/.node-gyp/12.3.1/include/node/v8.h:25,
from /home/pi/.node-gyp/12.3.1/include/node/node.h:63,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:2562:51: note: declared here
V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
^
/home/pi/.node-gyp/12.3.1/include/node/v8config.h:307:3: note: in definition of macro ‘V8_DEPRECATED’
declarator __attribute__((deprecated(message)))
^~~~~~~~~~
In file included from ../../nan/nan_new.h:189:0,
from ../../nan/nan.h:223,
from ../include/x509.h:7,
from ../src/addon.cc:5:
../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
../../nan/nan_implementation_12_inl.h:356:37: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
return v8::StringObject::New(value).As<v8::StringObject>();
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5380:23: note: candidate: static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)
static Local<Value> New(Isolate* isolate, Local<String> value);
^~~
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5380:23: note: candidate expects 2 arguments, 1 provided
In file included from ../../nan/nan_new.h:189:0,
from ../../nan/nan.h:223,
from ../include/x509.h:7,
from ../src/addon.cc:5:
../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before ‘>’ token
return v8::StringObject::New(value).As<v8::StringObject>();
^
../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ‘)’ token
return v8::StringObject::New(value).As<v8::StringObject>();
^
In file included from /usr/include/c++/6/cassert:44:0,
from /home/pi/.node-gyp/12.3.1/include/node/node_object_wrap.h:26,
from ../../nan/nan.h:55,
from ../include/x509.h:7,
from ../src/addon.cc:5:
../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
assert(persistent().IsNearDeath());
^
../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
../../nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
assert(wrap->handle_.IsNearDeath());
^
../src/addon.cc: In function ‘void init(v8::Local<v8::Object>)’:
../src/addon.cc:16:53: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
Nan::New<FunctionTemplate>(verify)->GetFunction());
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^~~~~~~~~~~
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate expects 1 argument, 0 provided
../src/addon.cc:20:59: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
Nan::New<FunctionTemplate>(get_altnames)->GetFunction());
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^~~~~~~~~~~
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate expects 1 argument, 0 provided
../src/addon.cc:23:58: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
Nan::New<FunctionTemplate>(get_subject)->GetFunction());
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^~~~~~~~~~~
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate expects 1 argument, 0 provided
../src/addon.cc:26:57: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
Nan::New<FunctionTemplate>(get_issuer)->GetFunction());
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^~~~~~~~~~~
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate expects 1 argument, 0 provided
../src/addon.cc:29:57: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
Nan::New<FunctionTemplate>(parse_cert)->GetFunction());
^
In file included from /home/pi/.node-gyp/12.3.1/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../src/addon.cc:4:
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate: v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>)
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^~~~~~~~~~~
/home/pi/.node-gyp/12.3.1/include/node/v8.h:5947:46: note: candidate expects 1 argument, 0 provided
x509.target.mk:110: recipe for target 'Release/obj.target/x509/src/addon.o' failed
make: *** [Release/obj.target/x509/src/addon.o] Error 1
make: Leaving directory '/home/pi/xbox_power_on/node_modules/x509/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.14.98-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/xbox_power_on/node_modules/x509
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
I am sure this is a bad on my side, but in my implementation of your module I poll the console to see if it is on, and try to connect if it is. All works great and fine.
Once in a while the XBox goes into the half on mode during updates. This is detected by my code as on and then I connect. Still all works well but the console behaves like someone started using the console and will not power down any more by itself (since there is a user connected).
So my wish is that I can detect on connect, or before connecting, that the state is this update mode.
Did you test/play with this an can you point me into the right direction?
Howdy - I'm using xbox-smartglass-core-node as part of a HomeBridge-xbox-tv plugin, and periodically the plugin crashes. The crash tracebook comes from src/packet/packer.js, and the error log shows:
11/8/2020, 7:09:07 PM Error: [packet/packer.js] Packet format not found: 7b226d6163223a2234433a35353a43433a31393a42383a4546222c226273736964223a2237343a41433a42393a34373a32353a4446222c226368616e6e656c223a312c226970223a223139322e3136382e3135372e313634222c2273736964223a227468657374726f6d732e6f7267222c2272737369223a2d34312c2272656d6f74655f7465726d696e616c5f706f7274223a323030302c2274696d65223a313630343839313334373031312c2276657273696f6e223a22454d5745524b2d4a425f315f312d312e342e302e32372c20323032302d30352d32395432333a30363a32385a2c205a656e7472694f532d575a2d332e362e342e30222c2275756964223a2230363431333034313030303030303030343930303232303030463531333733313334333433323333227d
at loadPacketStructure (/home/hoobs/.hoobs/node_modules/xbox-smartglass-core-node/src/packet/packer.js:22:19)
at module.exports (/home/hoobs/.hoobs/node_modules/xbox-smartglass-core-node/src/packet/packer.js:35:21)
at EventEmitter. (/home/hoobs/.hoobs/node_modules/xbox-smartglass-core-node/src/events.js:15:19)
at EventEmitter.emit (events.js:310:20)
at Object. (/home/hoobs/.hoobs/node_modules/xbox-smartglass-core-node/src/smartglass.js:324:30)
at Socket.emit (events.js:310:20)
at UDP.onMessage [as onmessage] (dgram.js:924:8)
Any suggestions? This is on 0.6.5.
Hey, just started a new try to port from Python Rest Server to your nodejs WebAPI and Smartglass module. Discovery and connection works flawlessly, however after only a few seconds the process crashes with the following exception:
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 12. Received 16
--
at boundsError (internal/buffer.js:49:9)
at Buffer.readUInt32BE (internal/buffer.js:192:5)
at Object.readUInt32 (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/packet/structure.js:111:37)
at Object.unpack (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/packet/message.js:38:51)
at Object.unpack (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/packet/message.js:174:64)
at Object.unpack (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/packet/message.js:480:80)
at Object.unpack (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/packet/packer.js:49:30)
at EventEmitter. (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/events.js:19:32)
at EventEmitter.emit (events.js:198:13)
at Object. (/opt/iobroker/node_modules/iobroker.xbox/node_modules/xbox-smartglass-core-node/src/smartglass.js:324:30)
Hi Guys not having no luck with this one at all have updated to 0.4.0 then when I update plugin to 0.10.2 I am getting this constantly.....
raspberrypi homebridge[321]: (node:321) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 _on_timeout listeners added. Use emitter.setMaxListeners() to increase limit
Then if I turn an XBOX off/on once or twice im getting.......
[4/27/2019, 10:40:33 PM] TypeError: this._socket.send is not a function
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object._send (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/smartglass.js:221:26)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object. (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/smartglass.js:100:22)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object. (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/smartglass.js:144:25)
Apr 27 22:40:33 raspberrypi homebridge[321]: at EventEmitter.emit (events.js:194:15)
Apr 27 22:40:33 raspberrypi homebridge[321]: at EventEmitter. (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/events.js:50:23)
Apr 27 22:40:33 raspberrypi homebridge[321]: at EventEmitter.emit (events.js:189:13)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object. (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/smartglass.js:197:33)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Socket.emit (events.js:189:13)
Apr 27 22:40:33 raspberrypi homebridge[321]: at UDP.onMessage [as onmessage] (dgram.js:628:8)
Apr 27 22:40:33 raspberrypi homebridge[321]: [4/27/2019, 10:40:33 PM] Got SIGTERM, shutting down Homebridge...
Apr 27 22:40:33 raspberrypi homebridge[321]: [4/27/2019, 10:40:33 PM] TypeError: Cannot read property '_crypto' of undefined
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object.unpack (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/packet/simple.js:145:48)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object.unpack (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/packet/packer.js:48:30)
Apr 27 22:40:33 raspberrypi homebridge[321]: at EventEmitter. (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/events.js:9:28)
Apr 27 22:40:33 raspberrypi homebridge[321]: at EventEmitter.emit (events.js:189:13)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Object. (/usr/local/lib/node_modules/homebridge-smartglass/node_modules/xbox-smartglass-core-node/src/smartglass.js:197:33)
Apr 27 22:40:33 raspberrypi homebridge[321]: at Socket.emit (events.js:189:13)
Apr 27 22:40:33 raspberrypi homebridge[321]: at UDP.onMessage [as onmessage] (dgram.js:628:8)
Apr 27 22:40:38 raspberrypi systemd[1]: homebridgeXbox.service: Main process exited, code=exited, status=143/n/a
not sure what im doing wrong but sgClient.getManager('tv_remote').sendIrCommand('btn.vol_up').then(function(button){ console.log(button) }, function(error){ console.log(error) });
doesn't do anything
will there be a power-off feature as well ?
Hey,
thanks again for the great work. Back in the rest server days it was possible to record e.g. the last 60 seconds (or another defined time range, like -30 sec to -15 sec). Is this possible with smartglass or more likely the node-webapi? I haven't found the functionality in the providers. Also it seems like seek
for the media channel is not implemented yet, any chances to see this implemented?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.