-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial blueprint support #42469
Conversation
Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with an integration ( |
for domain, domain_results in zip( | ||
domain_blueprints, | ||
await asyncio.gather( | ||
*[db.async_get_blueprints() for db in domain_blueprints.values()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will create one executor job per domain. Maybe that's ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I learn on Supervisor: jobs with doing IO on disk - Parallel is bad and make it slower (just hit the disk) / doing IO on network/pipe/memory/process - Parallel gives a real boost (just not hit our system)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that's ugly. We should do it in 1 call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not going to fix it for MVP, as we only support automation
right now.
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
|
||
|
||
@dataclass | ||
class ImportedBlueprint: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use attr and his nice slot=True
feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataclass is built-in and pretty much the same :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add frozen=True
here. Which is a similar feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For memory footprint, it would be better if we not need to extend the object at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This object will remain in memory for <1 second. From when it's imported till when it's send over the websocket API.
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Blueprint support is experimental and not recommended yet for production. Config will change between releases. Plan is to announce at the Home Assistant Conference.
Proposed change
Add support for blueprints in Home Assistant. Blueprints allows users that configure their automations via YAML to create reusable automations, reducing the amount of configuration necessary. Blueprints can easily be shared with others.
This is only the very basics plus a little bit more. I have a lot more plans for this but that will be for future PRs. I have created a document with the features I want to have added next. If you want to help, hit me up on Discord. Any blueprint PR that implements something not on that list will probably not be considered at this time.
Example blueprint in
config/blueprints/automation/balloob/test_event_service.yaml
:And then an example automation configuration to use it:
Do not post non-dev related questions on this PR please. They will be marked as spam. If you feel like expressing your emotion, use the emoji reaction button.
Type of change