Skip to content
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

Multiple Entities Control #7

Open
ChevronTango opened this issue Feb 2, 2025 · 5 comments
Open

Multiple Entities Control #7

ChevronTango opened this issue Feb 2, 2025 · 5 comments

Comments

@ChevronTango
Copy link

The default Entities card has a form element that allows for adding multiple entities into a single card. Would it be possible to also add this control into the formbuilder?

Image
@marcokreeft87
Copy link
Owner

Isn't it already in there? I think so but can't check right now

@ChevronTango
Copy link
Author

Isn't it already in there? I think so but can't check right now

I don't believe so. Only the single entity form element, but not one for adding the multiple entities. I did however find https://gist.github.com/JonahKr/f29d7b3e65c6707313ab4d421be9c8e7 which looks like it could be integrated with this to add that functionality. I'm going to try it in my own project first to see how it works.

@marcokreeft87
Copy link
Owner

Ah you're right. I will take a look at it when I have some time

@ChevronTango
Copy link
Author

I had a go at writing something myself and it turned into quite the battle. I mostly got it working with one major exception, a few of the UI components don't load in because they are lazy loaded. I managed to get most of them in, but a couple I never got working, so there's a few little hacks in the UI to hide them.

https://github.com/ChevronTango/ha-tfl-status-card/tree/dev/initial/src

I tried where possible to wrap your code so as to make things as easy as possible when porting to your repo. I don't think I can easily create a merge request, but hopefully what I have demonstrates it's possible, and not too difficult to implement.

three main files are

  • entity-row-form.ts which extends your code with more functionality to accommodate this feature
  • entities-row-editor.ts which contains the code for the selector, pulled from ha frontend but modified to our needs
  • load-ha-form.js a hack for getting the ha-entity-picker to load.

and you can look at index-editor to see how I was calling it.

Image

@marcokreeft87
Copy link
Owner

Great work. I currently don't have much time for it because I can't work from home anymore.
Will try to get it into my repo when I can.

Since its a npm package, I'm sure anyone who uses it is handy enough to use your code for a while instead :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants