Ok, I have a circumstance with Templates and Merging States that confuses me a bit. This is specifically dealing with Merging States that are based on the same value.
Based on my current template, when an entity is 'on' I apply a specific theme to the corresponding button. However, when that entity is a Fan, I also want to apply spin: true. Because of the way state merging behaves (and my template), the end result will always be spinning icons for all entities when turned on.
My current work around is to leverage two different templates where the only difference is spin: true but I feel like that sort of defeat the purpose of templates. What do you folks think?
Hereâs the Template YAML in case anyone is curious or needs clarification on what Iâm describing.
Here you go. I use nested templates to achieve this look, although it appears I need to update the templates to be more in line with recent changes to button-card.
Iâve tried that, but it put the icon to the left and left lots of space between the icon and label (which was surprising to me, given the description of layout: icon_label, stating they are concatenated)
anyway, Iâve tried some more and end up now with what I had in mind designing this set of buttons. Not yet confident this is all necessary, seems overly complicated for such a simple button, but is works now. Posting for reference, and example to others struggling with the css for grid and items to display. If you spot any detail that can be improved on, donât hesitate.
Whats beyond me is why the padding for the card is necessary to have the icon show. Would have thought padding made available space in the button even smaller?
which is more or less setting an on color and an off color for all parts, with a juxtaposed border color.
Tried to set the color in the card style first, but that would not work for all parts, so ended up describing them verbose, for each single item individually.
thanks for confirming. And it would have to go under
styles:
card:
- color: '#F0C209' ## good for border, state, name and label
- background-color: '#555B65'
- box-shadow: '0px 0px 2px 1px' ##<<---- no more border color either, when using the color: ?
icon:
- color: '#F0C209'
Haha, functional for navigation purposes only. The Harmony Hub isnât recognized as a connected controller for gameplay purposes. It basically sends the same commands as the Xbox One Media Remote.
This way we could have the more-info dialog pop up before releasing the button.
When you are on mobile it is hard to see the ripple underneath the finger so its hard to known when you can release it.
With color_type: card, color outside of styles and outside of state acts on the background color of the card when state is on
With color_type: icon (which is the default), color outside of styles and outside of state acts on the color of the icon when on
Based on this info above, if defined in states, it acts accordingly based on the matching state (either on the background or the icon).
So you could see this as a shortcut for simplicity when you donât have crazy styles in place.
If you have some complex styles in case, I would suggest to avoid using color outside of styles.
If you think the documentation needs refinement, PRs against the dev branch are welcome
I donât think itâs a good idea, youâre trying to fix a problem by introducing a feature. hold action works exactly the same as the core HA one, it waits for 500ms before deciding if itâs a hold action or a simple click. Maybe the blue ripple needs to be bigger when you hold?
haha, no I wouldnât dare to suggest such a thingâŚthanks for the extra explanation/confirmation. I think I had my flukes where a main config color: was not set to card, in this case auto or the color_type was set. That changed behavior of course, but I hadnât noticedâŚ
to be precise, when in default (acting on icon) is not only acts on icon, but also on state, name and label. And border color (or box-shadow).
Before, other cards, eg Tiles, this card color setting would also act on icon. Which was rather nice. Wouldnât you care to consider adapting that? Seems logical to have an overall color setting act on, well, all
it would make many configs much simpler, not needing a dedicated line for icon color.
@RomRider Is it possible to use button_templates in yaml mode?
I read somewhere in this thread someone mentioned about âincludesâ but I couldnât find that.
I have this in âui-lovelace.yamlâ but it didnât work. I have placed âbutton_card_templates.yamlâ file under âwww/custom-lovelaceâ folder.
File â/config/deps/lib/python3.7/site-packages/pyupdate/ha_custom/custom_cards.pyâ, line 32, in construct_include
with open(filename, ârâ, encoding=âutf-8â, errors=âignoreâ) as localfile:
FileNotFoundError: [Errno 2] No such file or directory: â/local/custom-lovelace/button_card_templates.yamlâ
donât know if this against all UX guidelines these days, but can we animate the buttons to mimic pushing it? Ive tried a few things found on the web, but no succes so far. Canât tell if it looks ridiculous because of it âŚ