Add the Gamerscore and Tier of the account (#12867)

* Added the Gamerscore and Tier of the account.

The tier is the subscription type of the Xbox Live account, so Silver (which is now called Free) or Gold (paid).

* Don't add the gamerscore and tier inside of the loop, since they're always the same.
This commit is contained in:
Kevin Tuhumury 2018-03-04 02:38:51 +01:00 committed by Martin Hjelmare
parent ba20ffdde7
commit 2321603eb7

View File

@ -69,7 +69,9 @@ class XboxSensor(Entity):
if profile.get('success', True) and profile.get('code') is None:
self.success_init = True
self._gamertag = profile.get('gamertag')
self._gamerscore = profile.get('gamerscore')
self._picture = profile.get('gamerpicSmallSslImagePath')
self._tier = profile.get('tier')
else:
_LOGGER.error("Can't get user profile %s. "
"Error Code: %s Description: %s",
@ -92,6 +94,9 @@ class XboxSensor(Entity):
def device_state_attributes(self):
"""Return the state attributes."""
attributes = {}
attributes['gamerscore'] = self._gamerscore
attributes['tier'] = self._tier
for device in self._presence:
for title in device.get('titles'):
attributes[