Turn Xbox one on

Let HA turn xbox one ON.

I found this awsome script but I’m no programmer

Needed is
Xbox One IP Address
Xbox One Live Device ID

I have everything connected to my xbox. TV and home cinemaset. My xbox turns this on and off aswell. So this will be a great feature for me


I am not a programmer aswell, but you can already use it in Home Assistant.
I don’t know what your setup is, but i have an raspberry 2 and used the all in one installer to install Home Assistant.

So first thing you need to install is npm. I have installed it a while back. I don’t remember how i did install it. But i just found this command which should do the trick:
sudo npm install npm -g

next thing to do is install the script you found with the command:

sudo npm install -g xbox-on

When the install is finished it will look something like this:
pi@raspberrypi:~ $ sudo npm install -g xbox-on
/usr/bin/xbox-on -> /usr/lib/node_modules/xbox-on/cli.js
└─┬ [email protected]
├── [email protected]
└─┬ [email protected]
└── [email protected]

So the only thing you need to do right now is to create a command_line switch in home assistant by adding this to your configuration.yaml;

- platform: command_line
      command_on: '/usr/lib/node_modules/xbox-on/cli.js -i -l FDXXX1F0XXXXXDXC'
      command_off: ""

As you can see for the on command i used the path what was given during the installation (i made it bold for you)
it is followed by -i -l < your_live_device_id>

after a restart of Home Assistant you should see the switch.

I hope this helps you out and thank you for finding the script.


First of all thank you for replying

I’m not running in on a raspberry pi. I have a hyperv server core installed at home. I have it running in a VM
Im running it on the latest version of debian

The install commands are diffrent then you suggested

I did the following:

apt-get install npm

So the npm is installed

did the following command to install xbox-on
npm install -g xbox-on

This installed it correctly as you stated above

Swith is showing up. but now I have the following error

ERROR:homeassistant.components.switch.command_line:Command failed: /usr/lib/node_modules/xbox-on/cli.js -i -l {my live ID}

any suggestions?

Ok I did a reinstall of the xbox-on

Getting follwoing error. Seems it cannot find something. Now I need to figure out what en why

INFO:homeassistant.components.switch.command_line:Running command: /usr/lib/node_modules/xbox-on/cli.js -i -l {my id}
/usr/bin/env: node: No such file or directory

Can you run the command from the shell? Do you need to declare an interpreter for the script?

If I run it from shell

/usr/bin/env: node: No such file or directory

I only know a basic of linux. So I have no idea what you mean by declare an interpreter? but according to documentation the steps above should work

docs: https://github.com/arcreative/xbox-on

So that the shell understands how to interpret the script. Do you need:

node /usr/lib/node_modules/xbox-on/cli.js -i -l xxx

(node being the interpreter)

Good point.

So I opend up the source and the first line is
#!/usr/bin/env node

node is not there in the directory.

I have run the command
apt-get install node

It did install node

Now I can run it in the commandline without errors

Started up HA

Tried the switch again

getting the following error

ERROR:homeassistant.components.switch.command_line:Command failed: node /usr/lib/node_modules/xbox-on/cli.js -i -l [my id]

Even if I losse node in the command I get the same error

I’m a bit new to Linux, but I wonder if you’ve still got a path/environment issue where when the script gets executed, it doesn’t know where to find node.

I haven’t used platform:command_line

Have you tried shell_command?

  test: bash /home/pi/scripts/script.sh

Then you can trigger it from an automation with:
service: shell_command.test

For this error, see node.js - Cannot install packages using node package manager in Ubuntu - Stack Overflow

nodejs-legacy is a VERY old version of nodejs. Might be worth the time to use v6 instead of v0.12.x

Node provides commands to add v6 package for ubuntu/debian/raspbian, or select your OS here.

It is odd to me that you guys can download npm(node package manager), but cannot find node in your environment. Usually npm depends on node. Can anyone describe how they installed npm?

Try this, it worked for me:

After updating ha. It is working.

this one is easier to install GitHub - Schamper/xbox-remote-power: Python script to remotely turn on your Xbox One

Hello I´m very new to all of these I´m runing home assistant hass.io on pi3, is it possible to make this scrpts? If so how can I do it?

any luck with this?