Commit Graph

16 Commits (3b38de63ea92296b49eae196c8802837dae6f03d)

Author SHA1 Message Date
Frank Wickström 7faa94046c Proper Steam game names and small fixes (#11182)
* Use constant for offline state

* Use constant for no game name

* Rename trade and play constant their proper names

Trade and Play are not the correct names for the states. For instance
Play might be seens as the user is actually is playing, which is not
correct as there is no such state is returned from the Steam API.
Just having "trade" does not say much about what is happening and
might be misintepreted that the user is currently trading, which is not
correct either.

We instead use the names from the underlying library for naming the
states [1]

[1] 2e518ad84f/steam/user.py (L109)

* Get the proper game name if no extra info is given from the api

The third `current_game` parameter that was used before hold
extra information about the game that is being played. This might
contain the game name, it might also be empty. The correct way to
get the game name is to fetch it from the API depending on the
game id that might be returned in the `current_game` attribute if
the user is playing a game.

To not break existing implementations we keep the functionality
to first go with the extra information and only then fetch the proper
game name.

* Refactor getting game name to its own function

This cleans up the code and removed "ugly" else statements
from the sensor and makes the game fetching easier to read.

* Let state constant values be lower snake case

* Return None instead of 'None' when no current game exists

* Initialize steam app list only once to benefit form caching

* Return None as state attributes if no current game is present
2017-12-20 22:32:33 -05:00
Derek 1e1d593ef7 Changed returned attribute from "Game" to "game" (#9945)
I noticed the steam component "game" attribute is capitalized. This should be lowercase if I'm not mistaken.

From:
        return {'Game': self._game}
To:
        return {'game': self._game}

Not sure if i'm doing this correctly... apologizes if I'm not!
2017-10-18 18:27:02 +02:00
Fabian Affolter f513f6271e Do not call update() in constructor (#8878)
* Do not call update() in constructor

* Fix lint issues
2017-08-08 20:21:33 +02:00
Fabian Affolter a4f1f6e724 Update docstrings (#7374)
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstring

* Update docstrings

* Update docstrings

* Fix lint issues

* Update docstrings

* Revert changes in dict
2017-05-02 09:18:47 -07:00
Robbie Trencheny 9e9c6d0184 Make states constants 2017-03-09 19:55:18 -08:00
Rowan 09ff9cb08e Updated to catch timeout error 2017-03-02 14:58:35 +00:00
Paulus Schoutsen ee5f228309 Make services yield (#4187)
* Make services yield

* Disable pylint abstract-method check

* add input_select

* add input_slider

* change to async vers.

* fix lint

* yield on add_entities as other components does
2016-11-03 18:32:14 -07:00
Fabian Affolter 6f45906eda Migrate to voluptuous (#3174) 2016-09-03 20:21:59 -06:00
Fabian Affolter 8bff97083c Fix PEPE257 issues 2016-03-08 16:46:34 +01:00
Rowan Hine 393df2da49 Update steam_online.py 2016-02-25 17:46:51 +00:00
Rowan Hine a54986159c Update Steam sensor to show currently played game 2016-02-25 17:05:00 +00:00
Paulus Schoutsen 57ac6cd76f Merge branch 'extract-entity-picture' into dev
Conflicts:
	homeassistant/components/sensor/steam_online.py
2016-02-24 22:00:58 -08:00
Fabian Affolter 5406028ace Modify docstrings to match PEP257 2016-02-24 10:47:35 +01:00
Paulus Schoutsen 967a751da1 Add entity_picture property 2016-02-23 22:41:24 -08:00
Rowan Hine f8240a9cda Changed to use dictionary 2016-02-23 18:02:48 +00:00
Rowan Hine 532d807771 Add Steam sensor 2016-02-23 09:35:27 +00:00