Add service to change visibility of a group (#3998)

This commit is contained in:
Pierre Ståhl
2016-10-30 01:54:26 +02:00
committed by Paulus Schoutsen
parent 3f6a5564ad
commit 33e46b484f
7 changed files with 106 additions and 9 deletions

View File

@@ -86,17 +86,18 @@ class EntityComponent(object):
discovery.async_listen_platform(
self.hass, self.domain, component_platform_discovered)
def extract_from_service(self, service):
def extract_from_service(self, service, expand_group=True):
"""Extract all known entities from a service call.
Will return all entities if no entities specified in call.
Will return an empty list if entities specified but unknown.
"""
return run_callback_threadsafe(
self.hass.loop, self.async_extract_from_service, service
self.hass.loop, self.async_extract_from_service, service,
expand_group
).result()
def async_extract_from_service(self, service):
def async_extract_from_service(self, service, expand_group=True):
"""Extract all known entities from a service call.
Will return all entities if no entities specified in call.
@@ -108,7 +109,7 @@ class EntityComponent(object):
return list(self.entities.values())
return [self.entities[entity_id] for entity_id
in extract_entity_ids(self.hass, service)
in extract_entity_ids(self.hass, service, expand_group)
if entity_id in self.entities]
@asyncio.coroutine