Releases: custom-cards/button-card
Releases · custom-cards/button-card
3.4.0-0
New Features
- Support for configuring the card size for the auto-layout feature of lovelace using
card_size
. Default value is still 3, but you can now override it. Lovelace multiplies the value by about 50px for the auto layout feature.type: custom:button-card entity: switch.my_switch card_size: 42
- Support for displaying a tooltip while hoovering the card for 1.5s using the
tooltip
parameter. It supports javascript templates. You can also apply any CSS style to the tooltip (either in the mainstyles
config object or in any of thestate
entry).ortype: custom:button-card entity: switch.my_switch tooltip: | [[[ return entity.state ]]] styles: tooltip: - color: '[[[ return entity.state === "on" ? "red" : "green" ]]]'
type: custom:button-card entity: switch.my_switch tooltip: | [[[ return entity.state ]]] state: - value: 'on' styles: tooltip: - color: red - value: 'off' styles: tooltip: - color: green
3.3.7-0
3.3.6
3.3.5
Bugfixes
- The ripple effect and the hold effect are back (Fix #325)
- Font-awesome icons were not sized correclty (Fix #328)
Other
-
For dark cards, it can be useful to change the feedback color when clicking the button. The ripple effect uses a
mwc-ripple
element so you can style it with the CSS variables it supports.For example:
styles: card: - --mdc-ripple-color: blue - --mdc-ripple-press-opacity: 0.5
3.3.4
3.3.3
3.3.2
3.3.1
Breaking Change
triggers_update
is a new field that enables you to define which entities should trigger an update of the card itself (this rule doesn't apply for nested cards incustom_fields
as they are always updated with the latest state. This is expected and fast!). Before 3.3.0, if you were using javascript[[[ ]]]
templates, the card would update itself everytime ANY entity was updated in HA introducing a lot of load on the browser.
If you don't have javascript[[[ ]]]
templates in your config, you don't need to do anything, else read further.
If unset, the card will parse your code and look for entities that it can match (it only matchesstates['ENTITY_ID']
) so:In this second case, you have 2 options:return states['switch.myswitch'].state // will match switch.myswitch // but const test = switch.myswitch return states[test].state // will not match anything
- Set the value of
triggers_update
toall
(This was the behavior of button-card < 3.3.0)triggers_update: all
- Set the value of
triggers_update
to a list of entities. When any of the entities in this list is updated, the card will be updated. The logic is the same as the internal home-assistant* templates
integration (see here for example):type: custom:button-card entity: sensor.mysensor # No need to repeat this one in the triggers_update, it is added by default triggers_update: - switch.myswitch - light.mylight
- Set the value of
New Features
- Supports defining multiple button
template
:The button templates will be applied in the order they are defined:type: custom:button-card template: - template1 - template2
template2
will be merged withtemplate1
and then the local config will be merged with the result. You can still chain templates together (ie. definetemplate
in a button-card template. It will follow the path recursively). - The card will display an error on screen instead of just disappearing from your layout when an error occurs. If it is an error in your javascript templates, it will display an error card with
ButtonCardJSTemplateError
and display the beginning of your template so that you can identify it:
BugFixes
- The button might not have been clickable in some cases when the
action
of a*_action
was a template. - Nested cards should be updated properly now when there is a state change.
- Fixes when a timer entity was defined and the button was in a vertical-stack/horizontal-stack
- Fix for button-card using templates not working in Lovelave panels when casting (Fix #315)
Other stuff
- A lot of refactor in the code, I hope I didn't break too much things 😄