From a54986159cdf5c9de1a09fad5469bef4e985fe3c Mon Sep 17 00:00:00 2001 From: Rowan Hine Date: Thu, 25 Feb 2016 17:05:00 +0000 Subject: [PATCH 1/2] Update Steam sensor to show currently played game --- homeassistant/components/sensor/steam_online.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/homeassistant/components/sensor/steam_online.py b/homeassistant/components/sensor/steam_online.py index d0f2e8b8c22..e65ffb20533 100644 --- a/homeassistant/components/sensor/steam_online.py +++ b/homeassistant/components/sensor/steam_online.py @@ -49,6 +49,7 @@ class SteamSensor(Entity): def update(self): """Update device state.""" self._profile = self._steamod.user.profile(self._account) + self._game = self._profile.current_game[2] self._state = { 1: 'Online', 2: 'Busy', @@ -58,6 +59,13 @@ class SteamSensor(Entity): 6: 'Play', }.get(self._profile.status, 'Offline') + @property + def device_state_attributes(self): + """Returns the state attributes.""" + if self._game == None: + self._game = 'None' + return {'Game': self._game} + @property def entity_picture(self): """Avatar of the account.""" From 393df2da49c9c13a8f1b21c8ab01fa654d075059 Mon Sep 17 00:00:00 2001 From: Rowan Hine Date: Thu, 25 Feb 2016 17:46:51 +0000 Subject: [PATCH 2/2] Update steam_online.py --- homeassistant/components/sensor/steam_online.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/steam_online.py b/homeassistant/components/sensor/steam_online.py index e65ffb20533..3ba7b2a0d92 100644 --- a/homeassistant/components/sensor/steam_online.py +++ b/homeassistant/components/sensor/steam_online.py @@ -49,7 +49,10 @@ class SteamSensor(Entity): def update(self): """Update device state.""" self._profile = self._steamod.user.profile(self._account) - self._game = self._profile.current_game[2] + if self._profile.current_game[2] is None: + self._game = 'None' + else: + self._game = self._profile.current_game[2] self._state = { 1: 'Online', 2: 'Busy', @@ -62,8 +65,6 @@ class SteamSensor(Entity): @property def device_state_attributes(self): """Returns the state attributes.""" - if self._game == None: - self._game = 'None' return {'Game': self._game} @property