当前位置: 首页>>代码示例>>Python>>正文


Python PLATFORM_SCHEMA.extend方法代码示例

本文整理汇总了Python中homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA.extend方法的典型用法代码示例。如果您正苦于以下问题:Python PLATFORM_SCHEMA.extend方法的具体用法?Python PLATFORM_SCHEMA.extend怎么用?Python PLATFORM_SCHEMA.extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA的用法示例。


在下文中一共展示了PLATFORM_SCHEMA.extend方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: async_setup_platform

# 需要导入模块: from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA [as 别名]
# 或者: from homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA import extend [as 别名]
_LOGGER = logging.getLogger(__name__)

ARMED = 'armed'

CONF_HOME_MODE_NAME = 'home_mode_name'
CONF_AWAY_MODE_NAME = 'away_mode_name'

DEPENDENCIES = ['arlo']

DISARMED = 'disarmed'

ICON = 'mdi:security'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_HOME_MODE_NAME, default=ARMED): cv.string,
    vol.Optional(CONF_AWAY_MODE_NAME, default=ARMED): cv.string,
})


@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
    """Set up the Arlo Alarm Control Panels."""
    data = hass.data[DATA_ARLO]

    if not data.base_stations:
        return

    home_mode_name = config.get(CONF_HOME_MODE_NAME)
    away_mode_name = config.get(CONF_AWAY_MODE_NAME)
    base_stations = []
    for base_station in data.base_stations:
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:33,代码来源:arlo.py

示例2: setup_platform

# 需要导入模块: from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA [as 别名]
# 或者: from homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA import extend [as 别名]
    STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY,
    EVENT_HOMEASSISTANT_STOP)
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['simplisafe-python==1.0.5']

_LOGGER = logging.getLogger(__name__)

DEFAULT_NAME = 'SimpliSafe'
DOMAIN = 'simplisafe'
NOTIFICATION_ID = 'simplisafe_notification'
NOTIFICATION_TITLE = 'SimpliSafe Setup'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_PASSWORD): cv.string,
    vol.Required(CONF_USERNAME): cv.string,
    vol.Optional(CONF_CODE): cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})


def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the SimpliSafe platform."""
    from simplipy.api import SimpliSafeApiInterface, get_systems
    name = config.get(CONF_NAME)
    code = config.get(CONF_CODE)
    username = config.get(CONF_USERNAME)
    password = config.get(CONF_PASSWORD)

    simplisafe = SimpliSafeApiInterface()
    status = simplisafe.set_credentials(username, password)
    if status:
开发者ID:JiShangShiDai,项目名称:home-assistant,代码行数:34,代码来源:simplisafe.py

示例3: setup_platform

# 需要导入模块: from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA [as 别名]
# 或者: from homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA import extend [as 别名]
STATES = {
    'ARM': STATE_ALARM_ARMED_AWAY,
    'DAY HOME': STATE_ALARM_ARMED_HOME,
    'DISARM': STATE_ALARM_DISARMED,
    'HOME': STATE_ALARM_ARMED_HOME,
    'TRIGGERED': STATE_ALARM_TRIGGERED,
    'UNKNOWN': STATE_UNKNOWN,
}

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST): cv.string,
    vol.Required(CONF_PASSWORD): cv.string,
    vol.Required(CONF_USERNAME): cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
    vol.Optional(CONF_REPORT_SERVER_CODES): vol.All(cv.ensure_list),
    vol.Optional(CONF_REPORT_SERVER_ENABLED,
                 default=DEFAULT_REPORT_SERVER_ENABLED): cv.boolean,
    vol.Optional(CONF_REPORT_SERVER_PORT, default=DEFAULT_REPORT_SERVER_PORT):
        cv.port,
})


def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Egardia platform."""
    from pythonegardia import egardiadevice

    name = config.get(CONF_NAME)
    username = config.get(CONF_USERNAME)
    password = config.get(CONF_PASSWORD)
    host = config.get(CONF_HOST)
开发者ID:fripsy,项目名称:home-assistant,代码行数:33,代码来源:egardia.py

示例4: setup_platform

# 需要导入模块: from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA [as 别名]
# 或者: from homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA import extend [as 别名]
CONF_EVENT_AWAY = "event_arm_away"
CONF_EVENT_HOME = "event_arm_home"
CONF_EVENT_NIGHT = "event_arm_night"
CONF_EVENT_DISARM = "event_disarm"

DEFAULT_EVENT_AWAY = "alarm_arm_away"
DEFAULT_EVENT_HOME = "alarm_arm_home"
DEFAULT_EVENT_NIGHT = "alarm_arm_night"
DEFAULT_EVENT_DISARM = "alarm_disarm"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    vol.Optional(CONF_CODE): cv.string,
    vol.Optional(CONF_EVENT_AWAY, default=DEFAULT_EVENT_AWAY): cv.string,
    vol.Optional(CONF_EVENT_HOME, default=DEFAULT_EVENT_HOME): cv.string,
    vol.Optional(CONF_EVENT_NIGHT, default=DEFAULT_EVENT_NIGHT): cv.string,
    vol.Optional(CONF_EVENT_DISARM, default=DEFAULT_EVENT_DISARM): cv.string,
    vol.Optional(CONF_OPTIMISTIC, default=False): cv.boolean,
})

SERVICE_PUSH_ALARM_STATE = "ifttt_push_alarm_state"

PUSH_ALARM_STATE_SERVICE_SCHEMA = vol.Schema({
    vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
    vol.Required(ATTR_STATE): cv.string,
})


def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up a control panel managed through IFTTT."""
开发者ID:arsaboo,项目名称:home-assistant,代码行数:32,代码来源:alarm_control_panel.py

示例5: timedelta

# 需要导入模块: from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA [as 别名]
# 或者: from homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA import extend [as 别名]
    STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_UNKNOWN)
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['concord232==0.15']

_LOGGER = logging.getLogger(__name__)

DEFAULT_HOST = 'localhost'
DEFAULT_NAME = 'CONCORD232'
DEFAULT_PORT = 5007

SCAN_INTERVAL = timedelta(seconds=1)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
    vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
})


def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Concord232 alarm control panel platform."""
    name = config.get(CONF_NAME)
    host = config.get(CONF_HOST)
    port = config.get(CONF_PORT)

    url = 'http://{}:{}'.format(host, port)

    try:
        add_devices([Concord232Alarm(hass, url, name)])
    except requests.exceptions.ConnectionError as ex:
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:33,代码来源:concord232.py

示例6: no_application_protocol

# 需要导入模块: from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA [as 别名]
# 或者: from homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA import extend [as 别名]

def no_application_protocol(value):
    """Validate that value is without the application protocol."""
    protocol_separator = "://"
    if not value or protocol_separator in value:
        raise vol.Invalid(
            'Invalid host, {} is not allowed'.format(protocol_separator))

    return value


PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Required(CONF_HOST): vol.All(cv.string, no_application_protocol),
    vol.Required(CONF_PASSWORD): cv.string,
    vol.Required(CONF_USERNAME): cv.string,
    vol.Optional(CONF_CODE): cv.positive_int,
    vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})


def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up an iAlarm control panel."""
    name = config.get(CONF_NAME)
    code = config.get(CONF_CODE)
    username = config.get(CONF_USERNAME)
    password = config.get(CONF_PASSWORD)
    host = config.get(CONF_HOST)

    url = 'http://{}'.format(host)
    ialarm = IAlarmPanel(name, code, username, password, url)
开发者ID:home-assistant,项目名称:home-assistant,代码行数:32,代码来源:alarm_control_panel.py


注:本文中的homeassistant.components.alarm_control_panel.PLATFORM_SCHEMA.extend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。