mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Tellstick config validation
This commit is contained in:
parent
43a94995c2
commit
d3fb69783d
@ -4,12 +4,16 @@ Support for Tellstick lights.
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.tellstick/
|
||||
"""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import tellstick
|
||||
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
|
||||
from homeassistant.components.tellstick import (DEFAULT_SIGNAL_REPETITIONS,
|
||||
ATTR_DISCOVER_DEVICES,
|
||||
ATTR_DISCOVER_CONFIG)
|
||||
|
||||
PLATFORM_SCHEMA = vol.Schema({vol.Required("platform"): tellstick.DOMAIN})
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
@ -4,11 +4,15 @@ Support for Tellstick switches.
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.tellstick/
|
||||
"""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import tellstick
|
||||
from homeassistant.components.tellstick import (ATTR_DISCOVER_DEVICES,
|
||||
ATTR_DISCOVER_CONFIG)
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
|
||||
PLATFORM_SCHEMA = vol.Schema({vol.Required("platform"): tellstick.DOMAIN})
|
||||
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
@ -6,6 +6,7 @@ https://home-assistant.io/components/Tellstick/
|
||||
"""
|
||||
import logging
|
||||
import threading
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import bootstrap
|
||||
from homeassistant.const import (
|
||||
@ -39,6 +40,14 @@ TELLSTICK_LOCK = threading.Lock()
|
||||
# Used from entities that register callback listeners
|
||||
TELLCORE_REGISTRY = None
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: vol.Schema({
|
||||
vol.Optional(ATTR_SIGNAL_REPETITIONS,
|
||||
default=DEFAULT_SIGNAL_REPETITIONS):
|
||||
vol.Coerce(int),
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
||||
def _discover(hass, config, found_devices, component_name):
|
||||
"""Setup and send the discovery event."""
|
||||
@ -52,8 +61,7 @@ def _discover(hass, config, found_devices, component_name):
|
||||
bootstrap.setup_component(hass, component.DOMAIN,
|
||||
config)
|
||||
|
||||
signal_repetitions = config[DOMAIN].get(
|
||||
ATTR_SIGNAL_REPETITIONS, DEFAULT_SIGNAL_REPETITIONS)
|
||||
signal_repetitions = config[DOMAIN].get(ATTR_SIGNAL_REPETITIONS)
|
||||
|
||||
hass.bus.fire(EVENT_PLATFORM_DISCOVERED,
|
||||
{ATTR_SERVICE: DISCOVERY_TYPES[component_name],
|
||||
|
Loading…
x
Reference in New Issue
Block a user