Update: Using the OpenXbox project someone pointed me to the nodejs library they have developed. So I used that on on e a new version of this xbox app.
So what did I manage at this point:
Turn ON and OFF the console from Homey!!!
Flow trigger on running app change, meaning you can detect what APP/GAME is actually running on the console (now with appid, image and name tokens)!!
Send button commands (controller/media) to the console from workflow and device page.
Apps are translated to a proper name and artwork is downloaded and added to the now playing page (requires live id authentication).
Todo:
The Game name are returned in a not so nice name.
These are not part of the same store listings as the apps. Just need to find an endpoint for the games to make those work.
Although Iām not sure what I would use it for, I find it interesting.
Perhaps work around the lack for CEC support and turn on my TV automatically
Iāve tried the app as-is. I had a little trouble discovering my Xbox One X, even with manually entered IP. The Xbox Beta app that I use is able to discover my device even when going from Wi-Fi to wired, so perhaps itās using a different method.
Anyway, after a couple of attempts by manual IP, it worked for me.
Regarding the encryption: Iām far from an expert, but as you probably know, itās rather unforgiving. In the past Iāve messed up things like padding in ever so subtle ways that would stop things from working completely.
Perhaps it would be helpful to do a comparison in output from the C# code and your JavaScript code? That would mean you initialize with the same IV and such, then compare the final message to something you know to be correct. At least you might be able to narrow down the area of the code in which the problem may lie.
I canāt make any promises, but perhaps Iāll find some time to play with the C# implementation myself, see it working. That will probably increase my own understanding at this point, anyway.
Edit:
Several of the C# CLI commands donāt seem to be working for me either. PowerOff, LaunchTitle, etc. I either get a timeout, or no response at all.
Ok, thanks that is very interesting to hear.
Ill go check the python version myself and see if that does work. If not the documentation is probably out of date.
On the encryption; you are right it must be something like that. The problem lies that all implementations use 3rd party libraries for at least part of the encryption handling that are not available to node.js
So I found and tried a lot of different libraries that did something wright and ended up with one that seems to handle all right. But it is hard to confirm if they actually do it right or that I setup them up right. So many small variations in these elements
I know the unprotected part of the message I can handle with trust, I used that for the discovery and to process the response that now allow me to process the byte stream into x509 certifacte and get all the right info from the response (console name, liveid, device id etc) so that must be done right now.
I know I can encrypt en validated that when decryption with my info I end up with the same message content as I started with to encrypt.
But since I have no way in validating what the console exactly doesā¦
I also have been thinking about comparing from a working implementation, but in the encryption part it quickly turns into the scramble using some process unique random keys so they would be incomparable, as designed
And you are right, I am also not yet clear what I want to do with it though, but a fun challenge non the less I was thinking on a netflix light scene and a Plex light scene and a game scene. Stuff like that would be cool. But for me it just was troubling that most of my devices are now connected and managed by Homey and the king of the lot, my console collection, is ignored.
Tried to get the python working by installing a ubunto distro on my windows 10 device. Figured out how to update pyhton and pip and installed the xbox-smartglass-core module. Than figured out how to execute the tui. It made me authenticate first and presented me an empty screen (while my console was powered on) pressing the refresh kills the tui with an binding error on the udp listener.
Not sure what you mean with saving it. It used and than new ones are retrieved behind the scenes.
If you followed the instructions and used the authorize link succesfully you ended up in a blank screen with a URL that holds the token. Taking that token and storing putting it in the box should authorize the app.
The app is still beta so I do not clearly show that the app is authorized. Just test it out buy starting for example the Netflix app on your console. If the console device in homey is showing the netflix artwork than it was authorized properly. After that there is no need to ever reauthorize.
For the basic Xbox companion behaviour you do not need to do this step. Its only required to get the pretty running app info.
I really want to find a nicer way to get through this authorization process but have not found one. Best idea so far was to use a reverse proxy code to do this. But timeā¦
Small update to test with Nexus button fixed and updated to the new openxbox core package. It had a exception on protocol level cause the app the crash once in a while. They fixed that now, so hoping for some stability improvements here.
A new test version has been published to update it to SDK3.
It seems to have troubles with the Xbox series when it comes to the fancy features (showing the active app or button controls for example)
Yeah, currently, after you pair the xbox, everything works. But after a while not, so might be something with the tokens.
Will work on it asap, but for now: itās at least installable
I installed the application on my Homey Pro 2023, my xbox is well detected/added, if I simulate, I press the home button via the application it works. However I canāt turn the xbox on/off via the app, nothing happens when I send the command
I get it, but i have tried the different messages officially available that i know off, but none of tgem work reliable. Its on my list, ill give it another go sometime when time is available again.
Well i still donāt have a solution, but detection that was turned on works for my consoles flawlessly.
So having a flow like you want is using the when turned on event.
Also there is starting gaming event, tgats the one i use. When I launch a game it switches my lights into xbox green.
Soms stuff seemed to have stopped working. So I uninstalled the app and reinstalled. Upon configuring I get the message āError: Cannot read properties of null (reading āaddEventListenerā)ā Same as I had when I noticed something was wrong.