def async_services_json(hass): """Generate services data to JSONify.""" descriptions = yield from async_get_all_descriptions(hass) return [{ "domain": key, "services": value } for key, value in descriptions.items()]
def test_async_get_all_descriptions(hass): """Test async_get_all_descriptions.""" group = hass.components.group group_config = {group.DOMAIN: {}} yield from async_setup_component(hass, group.DOMAIN, group_config) descriptions = yield from service.async_get_all_descriptions(hass) assert len(descriptions) == 1 assert "description" in descriptions["group"]["reload"] assert "fields" in descriptions["group"]["reload"] logger = hass.components.logger logger_config = {logger.DOMAIN: {}} yield from async_setup_component(hass, logger.DOMAIN, logger_config) descriptions = yield from service.async_get_all_descriptions(hass) assert len(descriptions) == 2 assert "description" in descriptions[logger.DOMAIN]["set_level"] assert "fields" in descriptions[logger.DOMAIN]["set_level"]
def test_async_get_all_descriptions(hass): """Test async_get_all_descriptions.""" group = loader.get_component(hass, 'group') group_config = {group.DOMAIN: {}} yield from async_setup_component(hass, group.DOMAIN, group_config) descriptions = yield from service.async_get_all_descriptions(hass) assert len(descriptions) == 1 assert 'description' in descriptions['group']['reload'] assert 'fields' in descriptions['group']['reload'] logger = loader.get_component(hass, 'logger') logger_config = {logger.DOMAIN: {}} yield from async_setup_component(hass, logger.DOMAIN, logger_config) descriptions = yield from service.async_get_all_descriptions(hass) assert len(descriptions) == 2 assert 'description' in descriptions[logger.DOMAIN]['set_level'] assert 'fields' in descriptions[logger.DOMAIN]['set_level']
def test_async_get_all_descriptions(hass): """Test async_get_all_descriptions.""" group = loader.get_component(hass, 'group') group_config = {group.DOMAIN: {}} yield from async_setup_component(hass, group.DOMAIN, group_config) descriptions = yield from service.async_get_all_descriptions(hass) assert len(descriptions) == 1 assert 'description' in descriptions['group']['reload'] assert 'fields' in descriptions['group']['reload'] logger = loader.get_component(hass, 'logger') logger_config = {logger.DOMAIN: {}} yield from async_setup_component(hass, logger.DOMAIN, logger_config) descriptions = yield from service.async_get_all_descriptions(hass) assert len(descriptions) == 2 assert 'description' in descriptions[logger.DOMAIN]['set_level'] assert 'fields' in descriptions[logger.DOMAIN]['set_level']
def get_services_helper(msg): """Get available services and fire complete message.""" descriptions = yield from async_get_all_descriptions(self.hass) self.send_message_outside(result_message(msg['id'], descriptions))
def async_services_json(hass): """Generate services data to JSONify.""" descriptions = yield from async_get_all_descriptions(hass) return [{"domain": key, "services": value} for key, value in descriptions.items()]
def get_services_helper(msg): """Get available services and fire complete message.""" descriptions = yield from async_get_all_descriptions(self.hass) self.send_message_outside(result_message(msg['id'], descriptions))