Blueprint: descriptions + descriptive errors (#43899)

This commit is contained in:
Paulus Schoutsen 2020-12-03 16:44:18 +01:00 committed by GitHub
parent 78a69ef284
commit 262e77d969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
input:
@ -17,7 +18,7 @@ blueprint:
domain: light
no_motion_wait:
name: Wait time
description: Time to wait until the light should be turned off.
description: Time to leave the light on after last motion is detected.
default: 120
selector:
number:

View File

@ -1,5 +1,6 @@
blueprint:
name: Send notification when a person leaves a zone
name: Zone Notification
description: Send a notification to a device when a person leaves a specific zone.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml
input:
@ -26,6 +27,7 @@ trigger:
variables:
zone_entity: !input zone_entity
# This is the state of the person when it's in this zone.
zone_state: "{{ states[zone_entity].name }}"
person_entity: !input person_entity
person_name: "{{ states[person_entity].name }}"

View File

@ -124,7 +124,9 @@ def _extract_blueprint_from_community_topic(
break
if blueprint is None:
raise HomeAssistantError("No valid blueprint found in the topic")
raise HomeAssistantError(
"No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax."
)
return ImportedBlueprint(
f'{post["username"]}/{topic["slug"]}', block_content, blueprint
@ -204,7 +206,9 @@ async def fetch_blueprint_from_github_gist_url(
break
if blueprint is None:
raise HomeAssistantError("No valid blueprint found in the gist")
raise HomeAssistantError(
"No valid blueprint found in the gist. The blueprint file needs to end with '.yaml'"
)
return ImportedBlueprint(
f"{gist['owner']['login']}/{filename[:-5]}", content, blueprint