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

Add custom buttons to template-card #1422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

martindybal
Copy link
Contributor

@martindybal martindybal commented May 7, 2024

Description

Related Issue

This PR fixes or closes issue: fixes #
#887
#1421

Motivation and Context

As I mentioned in the last issue, I was a bit limited by the template card in some scenarios. It would be really great if I could have a quick action directly on my dashboard.

How Has This Been Tested

I tested it locally on my HA instance. I also created a sample in the dev box at /lovelace-mushroom-showcase/5.

image

Types of changes

  • 🚀 New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have tested the change locally.
  • I followed the steps if I add a new language .

@martindybal martindybal force-pushed the feature/template-card-custom-buttons branch from 9c1c433 to be52ce6 Compare May 13, 2024 11:32
@BBE-FR
Copy link

BBE-FR commented May 31, 2024

For information, up to what level are the button customisable ?
For example can we like with a template chip:

  • define dynamic icon/color ?
  • define tap, hold and double tap actions ?
    If yes that is exactly what I wanted to create a room card !

Whatever the customization, Many Thanks @martindybal and I hope it goes up to release !

@martindybal
Copy link
Contributor Author

@BBE-FR Thank you very much for your feedback and support!

Regarding your questions:

Dynamic icon/color: This is not supported in the current PR, but can be easily added if needed.
Tap, hold and double tap actions: Only tap actions are currently supported, but again, they can be implemented if desired.

Before I proceed with these additions, I need to hear from @piitaya if he wants to finish this PR.

Thanks for your suggestions.

@piitaya
Copy link
Owner

piitaya commented Jun 2, 2024

Hi 🙂
I like the idea but if we implement this, I think it must be an array instead of 4 elements.

Also I have concerns to bring new features like this to Mushroom because the gap between Mushroom and tile card become less important with HA updates. Many features request (icon tap action, card features, inverted cover slider, etc...) to Mushroom are improvements done to the tile card so it become hard to do the work in double.

I have some options but I didn't decided about the best solution :

  1. Implement all Mushroom features to tile card and deprecate Mushroom usage
  2. Implement all Mushroom features to tile card except template features. Mushroom will become a kind of "advanced tile card" with template support and advanced features.
  3. Freeze Mushroom dev and maintain it to avoid regression with HA updates.

The problem with adding this option is that it will encourage people to not use tile card and it can lead to more breaking changes in the future if we want to fully merge Mushroom with Home Assistant.

@BBE-FR
Copy link

BBE-FR commented Jun 2, 2024

@piitaya I imagine that the question is hard...

Option 1 would be Nice...

The lack of template card and chips are the only real things that make me stay with mushroom... without template its difficult to go back to tiles...

For the rest tiles are sligtly less customisable but its enought for 99% of time...

@jhemak
Copy link

jhemak commented Jun 2, 2024

+1 for Option 1 ... I would love to switch over to Tile Card 100% but am a heavy user of template and chip.

@martindybal
Copy link
Contributor Author

martindybal commented Jun 3, 2024

@piitaya I fully understand. The reason for 4 elements is layout, but it's not a problem to use an array with limited size. I'm just not sure about the UI editor.

I have no problem helping with the development of the Tile Card. I've switched to it myself in a few scenarios with mushrooms. My main reason for sticking with Mushrooms is

  1. Horizontal layout
    • I added card_mod
  2. Better tap and hold action management
    • hold_action doesn't work above the icon. It uses icon_tap_action even with hold.
  3. Features like animated icons

I'm using combination of Mushrooms and tile card for all my room like this
image

@BBE-FR
Copy link

BBE-FR commented Jun 27, 2024

@piitaya
Do we have any chance to have templates in tile cards the same way as in mushroom ( template defining icon, color, primary and secondary information) ?

If not planed it might be worth to release this feature, I think there is a long lasting request for this kind of function in the mushroom Community. Y think we are numerous to use stack in to fuse template cards (or other mushroom when template is not mandatory) with chips to create additional buttons.
Like in my personal exemple there: #55 (comment)

If planned, there is an HACS project to allow to use controls: https://github.com/Nerwyn/service-call-tile-feature this could be embeded into the "template tile" to allow to define buttons into this future "advanced templatable tile". But it would be nice to make it as simple to use as a tile or mushroom feature (with GUI support).

@BBE-FR
Copy link

BBE-FR commented Jun 27, 2024

@BBE-FR Thank you very much for your feedback and support!

Regarding your questions:

Dynamic icon/color: This is not supported in the current PR, but can be easily added if needed. Tap, hold and double tap actions: Only tap actions are currently supported, but again, they can be implemented if desired.

Before I proceed with these additions, I need to hear from @piitaya if he wants to finish this PR.

Thanks for your suggestions.

I used chips instead of button with stack in in my cards in order to keep the mushroom look and to have the ability to define the button through graphical interface (including full control of the icons/colors through the template chips)...
Description can be found here: #55 (comment)

@martindybal Your proposal is already a great improvement and I fully support this. If at the end you manage to have the same capacity than chips, that would be 100% marvelous to me !

@martindybal
Copy link
Contributor Author

@BBE-FR I'm waiting for a reply from @piitaya

@martindybal
Copy link
Contributor Author

@piitaya can you please comment? Does it make sense to continue on this or would TileCard be the future?

@piitaya
Copy link
Owner

piitaya commented Jul 8, 2024

Sorry for the late reply, I was busy these days.
I'm not sure tile card will have templating features because it's too complex for most users and it can lead to performance issue if there are many templates.
However, I do agree that Mushroom should become an "advanced tile card" with many features, And of course, these features should be edited with a GUI.

For now, I would say we close this PR and I will work on a "advanced" version of the card but I have no deadline to share... However, I personally only use Mushroom card for the template card so I would love to move forward 😅

@antonio1475 antonio1475 mentioned this pull request Aug 2, 2024
@BBE-FR
Copy link

BBE-FR commented Sep 3, 2024

I will work on a "advanced" version of the card but I have no deadline to share... However, I personally only use Mushroom card for the template card so I would love to move forward

This might be a way to advance on the subject:
instead of updating endlessly mushrooms or risking to have too much breaking changes as stated here: #1259 (comment)

One option could be:

  • to create a new "advanced tile" custom card in HACS (possibly called called toadstool ??) that would basically be a tile card structure and look, but with full control on icon and templating.
  • to let the mushroom as it is, without new functionalities, and only maintain it, as long as feasible.
  • This card (or card family) could then, evolve to implement new functionalities (like buttons, sliders, etc, with same design as the tile card, but fully controllable by the user).

I think that otherwise, there will always be pros and cons to stay with mushroom "classical" cards and some will never migrate to tiles.

My personal example is as follow:
I am willing to go full Tiles (despite I prefer the interface of mushroom with collapsible controls and selectors) but restrained by the lack of:

  • template card (more than 75% of my mushroom cards)
  • chips (that can be placed anywhere and not just "on top")

With the latest badges (especially if they can be placed on top of sections) I could get rid of chips and use only Tiles. The last real functional blocking point for me is templating capability in Tile or Tile-like card...

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

Successfully merging this pull request may close these issues.

4 participants