Thanks for your help, without the quotes around value it works 100% fine now and I got exactly the results I wanted. The color_type: card support is also working flawlessly here. I am very happy!
And thanks also to @iantrich for getting the PR merged so fast
This was already my favorite custom card and this new feature makes it so much more powerful.
@RomRider, Thank you for taking the time to answer. I searched the docs and found many variations of service / action / data but not this one which works perfectly.
The ability to show one entity while controlling other entities gives this button card amazing power!
Iām facing one small problem with the button card: On my iOS devices the icon and the text displayed on the button are sometimes misaligned. They are not centered relative to the edges of the button. On my Macbook in Firefox everything is perfectly aligned. Does anyone know what the problem might be?
It would be only a minor inconvenience for us existing users but would make things more standardized and easier to understand, especially for new users. So I think itās worth doing.
@iantrich, ignore the previous PR, Iāve issued a new one with more stuff but some breaking changes (for a better future )
If you could have a look and let me know what you think please.
Breaking Changes
color_off is now deprecated, use state instead if you want to redefine the color when off
Instead of:
- type: "custom:button-card"
name: Switch
entity: switch.main
color: red
color_off: green
Use:
- type: "custom:button-card"
name: Switch
entity: switch.main
color: red
state:
- value: 'off'
color: green
Or:
- type: "custom:button-card"
name: Switch
entity: switch.main
state:
- value: 'off'
color: green
- value: 'on'
color: red
default_color is deprecated as it seems redundant with color (when light is not rgb). For rgb light, you can still define a specific color for the off state for example.
service has been deprecated in favor of tap_action, see below
action has been replaced by tap_action to mimic the default button card and allow for future options like hold_action
more_info renamed to more-info, more_info still works
service now takes the full service name light.turn_on
Add default entity icon support, Fix #53, add show_icon to decide whether to display the icon or not
Is font-size supposed to work in style? I have the following and changing font-size: 12px to font-size: 15px has no effect (in fact, it stays the same even if I remove it).
Iām okay with javascript (pure javascript) but Iām really bad at CSS, HTML and javascript combined Iām definitely already looking into hold_action but it might take a bit more time
Please hold on!
I have worked around this by using the core entity button with a state switch card. But it added over 1000 lines of code to achieve it. So I am in no hurry as it works fine now. But I would love to minimize my code when possible.