Skip to content

Add Blueprint Editor #25646

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

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open

Conversation

jpitlor
Copy link

@jpitlor jpitlor commented May 29, 2025

Proposed change

I wanted to add an editor for Blueprints, similar to Automations and Scripts. Essentially, this creates a page that has an editor for blueprintObject.metadata.input, then embeds the existing automation/script editor.

There was a WTH forum post asking for this. I'm not sure if there were any formal feature requests/roadmap plans, but truthfully this is mostly inspired by my own desire for this feature to exist.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

I don't think any particular configuration is needed to test this, especially since HA comes with a couple blueprints out of the box.

Additional information

Additionally, I have concerns about the size of this MR. I think it's quite large. If it should be broken up, I'd love to do that. I just need guidance on the best strategy. However, there are parts of this feature I left out explicitly because of the size:

  • a /show route
  • Adding support for !inputs in visual selectors
  • Selector Configuration Implemented, thanks to feedback from karwosts!
  • Validation/testing (of the blueprints, not the code)

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works. I did not do this because it doesn't seem like there's a way to test UI components. At least, I didn't see anything in the test directory. Let me know if there's something I can look at!

If user exposed functionality or configuration variables are added/changed:

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jpitlor

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant bot added cla-needed WTH Issues & PRs generated from the "Month of What the Heck?" labels May 29, 2025
@home-assistant home-assistant bot marked this pull request as draft May 29, 2025 19:08
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@jpitlor jpitlor marked this pull request as ready for review May 29, 2025 19:13
@home-assistant home-assistant bot dismissed their stale review May 29, 2025 19:13

Stale

Comment on lines 4552 to 4553
"edit_ui": "UI Editor",
"edit_yaml": "YAML Editor",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need sentence-casing on these strings and a bunch more below.

"edit_ui": "UI editor",
"edit_yaml": "YAML editor",

"delete_confirm_title": "Delete input",

"change_id": "Change input ID",

"default": "Default value",

"add_description": "Add description",
"add_author": "Add author",
"add_minimum_version": "Add minimum version"

"label": "Minimum version",

I may have missed another one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do! I'll double check all of the ones I added. Is the general guidance to use sentence casing on everything? Or are there any exceptions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Home Assistant uses sentence-casing in general. It helps translators like me to see what can be translated and what is a (capitalized) name or abbreviation that we should keep in translations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense! Thanks for pointing it out. I'll try to get to this some time today

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at all the changes, and the nine you pointed out were the only ones I saw. Fixed!

@jpitlor
Copy link
Author

jpitlor commented Jun 20, 2025

Remembered to make sure it built, but forgot to lint locally! There were a couple errors in files I didn't touch, so I just left those as they are!

@silamon
Copy link
Contributor

silamon commented Jun 22, 2025

I've done a test run on this one and it work pretty well but I'm a bit thinking about how it will be used by home assistant users that don't manage the original blueprint.

The definition behind blueprints is that people can share them and other people can import them to use them in their home assistant installation. If there are updates to the blueprint, you can redownload it from the location you've initially downloaded them. If the user thinks that the blueprint doesn't fit their use-case completely and wants to modify it, they must take control and get a regular automation or script they can modify.

The blueprint editor introduced here, is just extending the regular blueprint area. The gap between people that develop blueprints and people that use blueprints is pretty close. People that don't manage the blueprint will just start editing the blueprint in the handy editor, having a modified version to their likings which will overwrite the original blueprint straightaway without warning, and they won't know anymore after a few months and they'll lose their changes when the blueprint will be updated by them.

TLDR; I think this nice blueprint editor may be a better fit under the developer tools.

@silamon silamon added the Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Jun 22, 2025
@jpitlor
Copy link
Author

jpitlor commented Jun 24, 2025

Thanks for taking a look! Yeah that's completely fair - I didn't even realize you could update blueprints, so I agree that the developer tools is probably a better fit for this. I would still be satisfied - an editor in the developer tools is still better than no editor.

I can move it there, although I'm out of town this week, so it probably won't happen until some time next week

@jpitlor
Copy link
Author

jpitlor commented Jul 5, 2025

Thanks for the patience - I'm just now getting time to make progress on this again

@silamon as I'm moving the editor to the developer tools, I'm trying to think of how it should be used and I'd love to have your input since you know how people use this feature better than I do.

I'm assuming a UI editor that spits out the corresponding YAML to create a blueprint and then copy it over to GitHub (or wherever people put their blueprints) has a high likelihood of being valuable, especially since it mimics the purpose of the template tab.

I'm also assuming the ability to add your own blueprints may be valuable, as maybe people want to create their own blueprint, but they don't want to go through the effort of hosting them somewhere. Does this break any part of the blueprint page if the blueprint doesn't have an associated URL for updates?

And then there's the ability to edit existing blueprints - should I just leave this part out, or should I put it in with some warning dialog to add friction and make sure people know what they're doing?

@silamon
Copy link
Contributor

silamon commented Jul 11, 2025

That need some thinking. Since I'm just a voluntary reviewer I may wait for feedback from the Nabu Casa team.

@jpitlor
Copy link
Author

jpitlor commented Jul 13, 2025

That's fair - I'm just going to add all three until someone tells me otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) wait for backend WTH Issues & PRs generated from the "Month of What the Heck?"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants