本文整理汇总了Python中homeassistant.helpers.config_validation.entity_ids方法的典型用法代码示例。如果您正苦于以下问题:Python config_validation.entity_ids方法的具体用法?Python config_validation.entity_ids怎么用?Python config_validation.entity_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类homeassistant.helpers.config_validation
的用法示例。
在下文中一共展示了config_validation.entity_ids方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_platform
# 需要导入模块: from homeassistant.helpers import config_validation [as 别名]
# 或者: from homeassistant.helpers.config_validation import entity_ids [as 别名]
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Neato vacuum."""
dev = []
for robot in hass.data[NEATO_ROBOTS]:
dev.append(NeatoConnectedVacuum(hass, robot))
if not dev:
return
_LOGGER.debug("Adding vacuums %s", dev)
add_entities(dev, True)
def neato_custom_cleaning_service(call):
"""Zone cleaning service that allows user to change options."""
for robot in service_to_entities(call):
if call.service == SERVICE_NEATO_CUSTOM_CLEANING:
mode = call.data.get(ATTR_MODE)
navigation = call.data.get(ATTR_NAVIGATION)
category = call.data.get(ATTR_CATEGORY)
zone = call.data.get(ATTR_ZONE)
robot.neato_custom_cleaning(
mode, navigation, category, zone)
def service_to_entities(call):
"""Return the known devices that a service call mentions."""
entity_ids = extract_entity_ids(hass, call)
entities = [entity for entity in dev
if entity.entity_id in entity_ids]
return entities
hass.services.register(DOMAIN, SERVICE_NEATO_CUSTOM_CLEANING,
neato_custom_cleaning_service,
schema=SERVICE_NEATO_CUSTOM_CLEANING_SCHEMA)