grzegorz914 / homebridge-xbox-tv

Homebridge plugin for Microsoft Game Console, publish as independent external platform accessory.
MIT License
164 stars 15 forks source link

Forking and implementing a bash command at "On" #159

Closed 10w73 closed 1 year ago

10w73 commented 1 year ago

As a rookie python dev I'm not that good with java script related stuff. I want to fork it and implement a bash command when the Xbox is supposed to start (since I got it in shutdown mode for energy saving puposes).

irsend -# 3 SEND_ONCE xboxOne KEY_ON

Would somebody pls explain me how to do that? And in a way that I easily can merge future updates, I never done that before here.

Thx in advance! :)

grzegorz914 commented 1 year ago

This command need separate infra rot transmitter to send command.

in node can be used:

const { exec } = require('child_process');

const command = 'irsend -# 3 SEND_ONCE xboxOne KEY_ON';
exec(command, (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.error(`stderr: ${stderr}`);
});
10w73 commented 1 year ago

Its working! I had to use a pipe and different commands to achieve it because my homebridge runs in a docker container but it is working. Great stuff.