-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
base: dev
Are you sure you want to change the base?
Add Blueprint Editor #25646
Conversation
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.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
src/panels/config/blueprint/input/types/ha-blueprint-input-input.ts
Outdated
Show resolved
Hide resolved
src/translations/en.json
Outdated
"edit_ui": "UI Editor", | ||
"edit_yaml": "YAML Editor", |
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.
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.
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.
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?
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.
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.
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.
That makes sense! Thanks for pointing it out. I'll try to get to this some time today
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 looked at all the changes, and the nine you pointed out were the only ones I saw. Fixed!
Co-authored-by: Norbert Rittel <norbert@rittel.de>
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! |
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. |
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 |
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? |
That need some thinking. Since I'm just a voluntary reviewer I may wait for feedback from the Nabu Casa team. |
That's fair - I'm just going to add all three until someone tells me otherwise |
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
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:
/show
route!input
s in visual selectorsSelector ConfigurationImplemented, thanks to feedback from karwosts!Checklist
test
directory. Let me know if there's something I can look at!If user exposed functionality or configuration variables are added/changed: