mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Make states constants
This commit is contained in:
parent
09ff9cb08e
commit
9e9c6d0184
@ -27,6 +27,13 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
vol.All(cv.ensure_list, [cv.string]),
|
vol.All(cv.ensure_list, [cv.string]),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
STATE_ONLINE = 'Online'
|
||||||
|
STATE_BUSY = 'Busy'
|
||||||
|
STATE_AWAY = 'Away'
|
||||||
|
STATE_SNOOZE = 'Snooze'
|
||||||
|
STATE_TRADE = 'Trade'
|
||||||
|
STATE_PLAY = 'Play'
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
@ -72,12 +79,12 @@ class SteamSensor(Entity):
|
|||||||
else:
|
else:
|
||||||
self._game = self._profile.current_game[2]
|
self._game = self._profile.current_game[2]
|
||||||
self._state = {
|
self._state = {
|
||||||
1: 'Online',
|
1: STATE_ONLINE,
|
||||||
2: 'Busy',
|
2: STATE_BUSY,
|
||||||
3: 'Away',
|
3: STATE_AWAY,
|
||||||
4: 'Snooze',
|
4: STATE_SNOOZE,
|
||||||
5: 'Trade',
|
5: STATE_TRADE,
|
||||||
6: 'Play',
|
6: STATE_PLAY,
|
||||||
}.get(self._profile.status, 'Offline')
|
}.get(self._profile.status, 'Offline')
|
||||||
self._name = self._profile.persona
|
self._name = self._profile.persona
|
||||||
self._avatar = self._profile.avatar_medium
|
self._avatar = self._profile.avatar_medium
|
||||||
|
Loading…
x
Reference in New Issue
Block a user