Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.blueprint.importer Namespace Reference

Classes

class  ImportedBlueprint
 
class  UnsupportedUrl
 

Functions

ImportedBlueprint _extract_blueprint_from_community_topic (str url, dict topic)
 
str _get_community_post_import_url (str url)
 
str _get_github_import_url (str url)
 
ImportedBlueprint fetch_blueprint_from_community_post (HomeAssistant hass, str url)
 
ImportedBlueprint fetch_blueprint_from_generic_url (HomeAssistant hass, str url)
 
ImportedBlueprint fetch_blueprint_from_github_gist_url (HomeAssistant hass, str url)
 
ImportedBlueprint fetch_blueprint_from_github_url (HomeAssistant hass, str url)
 
ImportedBlueprint fetch_blueprint_from_url (HomeAssistant hass, str url)
 
ImportedBlueprint fetch_blueprint_from_website_url (HomeAssistant hass, str url)
 

Variables

 COMMUNITY_CODE_BLOCK
 
 COMMUNITY_TOPIC_PATTERN
 
 COMMUNITY_TOPIC_SCHEMA
 
tuple FETCH_FUNCTIONS
 
 GITHUB_FILE_PATTERN
 
 WEBSITE_PATTERN
 

Detailed Description

Import logic for blueprint.

Function Documentation

◆ _extract_blueprint_from_community_topic()

ImportedBlueprint homeassistant.components.blueprint.importer._extract_blueprint_from_community_topic ( str  url,
dict  topic 
)
private
Extract a blueprint from a community post JSON.

Async friendly.

Definition at line 97 of file importer.py.

◆ _get_community_post_import_url()

str homeassistant.components.blueprint.importer._get_community_post_import_url ( str  url)
private
Convert a forum post url to an import url.

Async friendly.

Definition at line 76 of file importer.py.

◆ _get_github_import_url()

str homeassistant.components.blueprint.importer._get_github_import_url ( str  url)
private
Convert a GitHub url to the raw content.

Async friendly.

Definition at line 60 of file importer.py.

◆ fetch_blueprint_from_community_post()

ImportedBlueprint homeassistant.components.blueprint.importer.fetch_blueprint_from_community_post ( HomeAssistant  hass,
str   url 
)
Get blueprints from a community post url.

Method can raise aiohttp client exceptions, vol.Invalid.

Caller needs to implement own timeout.

Definition at line 143 of file importer.py.

◆ fetch_blueprint_from_generic_url()

ImportedBlueprint homeassistant.components.blueprint.importer.fetch_blueprint_from_generic_url ( HomeAssistant  hass,
str   url 
)
Get a blueprint from a generic website.

Definition at line 248 of file importer.py.

◆ fetch_blueprint_from_github_gist_url()

ImportedBlueprint homeassistant.components.blueprint.importer.fetch_blueprint_from_github_gist_url ( HomeAssistant  hass,
str   url 
)
Get a blueprint from a Github Gist.

Definition at line 182 of file importer.py.

◆ fetch_blueprint_from_github_url()

ImportedBlueprint homeassistant.components.blueprint.importer.fetch_blueprint_from_github_url ( HomeAssistant  hass,
str   url 
)
Get a blueprint from a github url.

Definition at line 161 of file importer.py.

◆ fetch_blueprint_from_url()

ImportedBlueprint homeassistant.components.blueprint.importer.fetch_blueprint_from_url ( HomeAssistant  hass,
str  url 
)
Get a blueprint from a url.

The returned blueprint will only be validated with BLUEPRINT_SCHEMA, not the domain
specific schema.

Definition at line 275 of file importer.py.

◆ fetch_blueprint_from_website_url()

ImportedBlueprint homeassistant.components.blueprint.importer.fetch_blueprint_from_website_url ( HomeAssistant  hass,
str   url 
)
Get a blueprint from our website.

Definition at line 228 of file importer.py.

Variable Documentation

◆ COMMUNITY_CODE_BLOCK

homeassistant.components.blueprint.importer.COMMUNITY_CODE_BLOCK
Initial value:
1 = re.compile(
2  r'<code class="lang-(?P<syntax>[a-z]+)">(?P<content>(?:.|\n)*)</code>', re.MULTILINE
3 )

Definition at line 25 of file importer.py.

◆ COMMUNITY_TOPIC_PATTERN

homeassistant.components.blueprint.importer.COMMUNITY_TOPIC_PATTERN
Initial value:
1 = re.compile(
2  r"^https://community.home-assistant.io/t/[a-z0-9-]+/(?P<topic>\d+)(?:/(?P<post>\d+)|)$"
3 )

Definition at line 21 of file importer.py.

◆ COMMUNITY_TOPIC_SCHEMA

homeassistant.components.blueprint.importer.COMMUNITY_TOPIC_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  "slug": str,
4  "title": str,
5  "post_stream": {"posts": [{"updated_at": cv.datetime, "cooked": str}]},
6  },
7  extra=vol.ALLOW_EXTRA,
8 )

Definition at line 37 of file importer.py.

◆ FETCH_FUNCTIONS

tuple homeassistant.components.blueprint.importer.FETCH_FUNCTIONS
Initial value:
1 = (
2  fetch_blueprint_from_community_post,
3  fetch_blueprint_from_github_url,
4  fetch_blueprint_from_github_gist_url,
5  fetch_blueprint_from_website_url,
6  fetch_blueprint_from_generic_url,
7 )

Definition at line 266 of file importer.py.

◆ GITHUB_FILE_PATTERN

homeassistant.components.blueprint.importer.GITHUB_FILE_PATTERN
Initial value:
1 = re.compile(
2  r"^https://github.com/(?P<repository>.+)/blob/(?P<path>.+)$"
3 )

Definition at line 29 of file importer.py.

◆ WEBSITE_PATTERN

homeassistant.components.blueprint.importer.WEBSITE_PATTERN
Initial value:
1 = re.compile(
2  r"^https://(?P<subdomain>[a-z0-9-]+)\.home-assistant\.io/(?P<path>.+).yaml$"
3 )

Definition at line 33 of file importer.py.