mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Migrate to voluptuous (#3174)
This commit is contained in:
parent
34ba4d3e09
commit
6f45906eda
@ -4,12 +4,24 @@ Sensor for Steam account status.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.steam_online/
|
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.helpers.entity import Entity
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
|
REQUIREMENTS = ['steamodd==4.21']
|
||||||
|
|
||||||
|
CONF_ACCOUNTS = 'accounts'
|
||||||
|
|
||||||
ICON = 'mdi:steam'
|
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
|
# 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))
|
steamod.api.key.set(config.get(CONF_API_KEY))
|
||||||
add_devices(
|
add_devices(
|
||||||
[SteamSensor(account,
|
[SteamSensor(account,
|
||||||
steamod) for account in config.get('accounts', [])])
|
steamod) for account in config.get(CONF_ACCOUNTS)])
|
||||||
|
|
||||||
|
|
||||||
class SteamSensor(Entity):
|
class SteamSensor(Entity):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user