Skip to content

Instantly share code, notes, and snippets.

@Snipercaine
Created July 3, 2018 13:39
Show Gist options
  • Save Snipercaine/8d18d6762971e4be676af59d67a12475 to your computer and use it in GitHub Desktop.
Save Snipercaine/8d18d6762971e4be676af59d67a12475 to your computer and use it in GitHub Desktop.
#sensor:
- platform: xbox_live
api_key: xxxxxxxxxxxxxxxxxxxxxx
xuid:
- 25xxxxxxxxxx17 #DrZzs
- 25xxxxxxxxxx02 #Zerp
- 25xxxxxxxxxx58 #BearBait
#sensor:
- platform: history_stats
name: Zach Xbox
entity_id: sensor.zerp
state: 'Online'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
- platform: history_stats
name: Jackson Xbox
entity_id: sensor.bearbait
state: 'Online'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
- platform: history_stats
name: DrZzs Xbox
entity_id: sensor.dr_zzs
state: 'Online'
type: time
start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().weekday() * 86400 }}'
end: '{{ now() }}'
history_graph:
gr1:
name: Xbox
entities:
- sensor.zerp
- sensor.bearbait
- sensor.dr_zzs
hours_to_show: 168
refresh: 3600
#notify:
- name: drzzs_xbox
platform: rest
resource: https://xboxapi.com/v2/messages
method: POST_JSON
headers:
Content-Type: application/json
X-Auth: b53xxxxxxxxxxxxxxxx4050
data:
to:
- 25xxxxxxxxxuid17
#automation:
- alias: DrZzs Xbox 2hr warning
hide_entity: true
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.drzzs_xbox
to: 'on'
for:
minutes: 120
action:
- service: notify.drzzs_xbox
data:
message: "You've been playing for 2 hours bud. Time to take a break."
- alias: Zach Xbox 3hr text
hide_entity: true
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.i_am_zerp
to: 'on'
for:
minutes: 180
action:
service: notify.ios_justin_iphone7
data:
title: "Zach Xbox" #customizable
message: "Zach's been on the Xbox for 3 hours" #customizable
@ScottinOkla
Copy link

Any way to shutdown the Xbox with a 2 minute warning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment