Skip to content

Commit

Permalink
Merge pull request hunterjm#21 from hunterjm/develop
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
hunterjm authored Oct 4, 2018
2 parents 2d91285 + 45565dd commit a3d6fe0
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
2 changes: 1 addition & 1 deletion xboxone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ RUN apk add --no-cache jq gcc musl-dev python3-dev libffi-dev openssl-dev python
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
rm -r /root/.cache

RUN pip3 install xbox-smartglass-rest==0.9.5
RUN pip3 install xbox-smartglass-rest==0.9.6

CMD [ "/run.sh" ]
51 changes: 46 additions & 5 deletions xboxone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,50 @@ The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.

1. [Add our Hass.io add-ons repository](https://github.com/hunterjm/hassio-addons) to your Hass.io instance.
1. Install the "Xbox One" add-on.
1. Start the "Xbox One" add-on.
1. Check the logs of the "Xbox One" add-on to see if everything went well.
1. Surf to your Hass.io instance and use port `5557`
2. Install the "Xbox One" add-on.
3. Start the "Xbox One" add-on.
4. Check the logs of the "Xbox One" add-on to see if everything went well.
5. Surf to your Hass.io instance and use port `5557`
(e.g. `http://hassio.local:5557`).
1. Authenticate with Xbox Live by going to [/auth/oauth](http://hassio.local:5557/auth/oauth)
6. Authenticate with Xbox Live by going to [/auth/oauth](http://hassio.local:5557/auth/oauth)
and following the directions.

## Manual Installation
1. Enter your home assistant python virtual-environment.
2. Execute `pip install xbox-smartglass-rest`.
3. Create a service to autostart the server (e.g. for Systemd).
4. Enable / start the service.
5. Copy `xboxone.py` to `<hass config path>/custom_components/media_player/xboxone.py`.
6. Proceed with __Installation__ step 5.

### Systemd service example

File location: `/etc/systemd/system/xbox-smartglass-rest@homeassistant.service`

__NOTE:__ This assumes running the service as user `homeassistant`.
If you want to run the server with a different user, change
the filename to: `xbox-smartglass-rest@<username>.service`!

Edit `ExecStart` to your needs!

```
#
# Service file for systems with systemd to run Xbox One SmartGlass REST server.
#
[Unit]
Description=Xbox One SmartGlass REST for %i
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/path/to/bin/inside/venv/xbox-rest-server
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
```

## Home Assistant Configuration

Expand Down Expand Up @@ -62,6 +99,10 @@ media_player:

The LiveID of your Xbox One. It can be found in `/device` endpoint. Once this addon is up and running [click here](http://hassio.local:5557/device).

### Option: `ip_address`

The IP Address of your Xbox One. Useful if your xbox lives on a separate subnet.

### Option: `name`

The friendly name for this Xbox which will appear in Home Assistant.
Expand Down
4 changes: 2 additions & 2 deletions xboxone/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Xbox One",
"version": "1.0.0",
"version": "1.1.0",
"slug": "xboxone",
"description": "Control your Xbox One from your Home Assistant device",
"url": "https://github.com/hunterjm/hassio-addons/tree/master/xboxone",
Expand All @@ -11,4 +11,4 @@
"map": ["config:rw"],
"options": {},
"schema": {}
}
}
8 changes: 7 additions & 1 deletion xboxone/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
mkdir -p /config/custom_components/media_player
cp -f xboxone.py /config/custom_components/media_player/xboxone.py

# Persistent tokens on reboot
touch /config/.xbox-token.json
mkdir -p /root/.local/share/xbox/
ln -s /config/.xbox-token.json /root/.local/share/xbox/tokens.json


# Run the server
xbox-rest-server
xbox-rest-server
Loading

0 comments on commit a3d6fe0

Please sign in to comment.