mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Merge pull request #1398 from GreenTurtwig/steam
Update Steam sensor to show currently played game
This commit is contained in:
commit
782713ee4f
@ -49,6 +49,10 @@ class SteamSensor(Entity):
|
|||||||
def update(self):
|
def update(self):
|
||||||
"""Update device state."""
|
"""Update device state."""
|
||||||
self._profile = self._steamod.user.profile(self._account)
|
self._profile = self._steamod.user.profile(self._account)
|
||||||
|
if self._profile.current_game[2] is None:
|
||||||
|
self._game = 'None'
|
||||||
|
else:
|
||||||
|
self._game = self._profile.current_game[2]
|
||||||
self._state = {
|
self._state = {
|
||||||
1: 'Online',
|
1: 'Online',
|
||||||
2: 'Busy',
|
2: 'Busy',
|
||||||
@ -58,6 +62,11 @@ class SteamSensor(Entity):
|
|||||||
6: 'Play',
|
6: 'Play',
|
||||||
}.get(self._profile.status, 'Offline')
|
}.get(self._profile.status, 'Offline')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_state_attributes(self):
|
||||||
|
"""Returns the state attributes."""
|
||||||
|
return {'Game': self._game}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def entity_picture(self):
|
def entity_picture(self):
|
||||||
"""Avatar of the account."""
|
"""Avatar of the account."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user