Python homeassistant.helpers.config_validation.entity_ids() Examples
The following are 1
code examples of homeassistant.helpers.config_validation.entity_ids().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
homeassistant.helpers.config_validation
, or try the search function
.
Example #1
Source File: vacuum.py From HomeAssistantConfig with MIT License | 5 votes |
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)