Migrate to voluptuous (#3174)
This commit is contained in:
parent
34ba4d3e09
commit
6f45906eda
1 changed files with 14 additions and 2 deletions
|
@ -4,12 +4,24 @@ Sensor for Steam account status.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.steam_online/
|
||||
"""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['steamodd==4.21']
|
||||
|
||||
CONF_ACCOUNTS = 'accounts'
|
||||
|
||||
ICON = 'mdi:steam'
|
||||
|
||||
REQUIREMENTS = ['steamodd==4.21']
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_API_KEY): cv.string,
|
||||
vol.Required(CONF_ACCOUNTS, default=[]):
|
||||
vol.All(cv.ensure_list, [cv.string]),
|
||||
})
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
@ -19,7 +31,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
steamod.api.key.set(config.get(CONF_API_KEY))
|
||||
add_devices(
|
||||
[SteamSensor(account,
|
||||
steamod) for account in config.get('accounts', [])])
|
||||
steamod) for account in config.get(CONF_ACCOUNTS)])
|
||||
|
||||
|
||||
class SteamSensor(Entity):
|
||||
|
|
Loading…
Add table
Reference in a new issue