I’d like to add a button on the entity card for my covers in order to start an automation (set the cover to its “sun” position = ~20% opened).
What’s the best way to proceed?
I’d like to add a button on the entity card for my covers in order to start an automation (set the cover to its “sun” position = ~20% opened).
What’s the best way to proceed?
I was just looking for the same. This one here comes close: GitHub - jcwillox/lovelace-paper-buttons-row: Adds highly configurable buttons that use actions and per-state styling.
Thanks a lot, exactly what I was looking for!
Here’s my result using extend_paper_buttons_row
:
Code:
type: entities
entities:
- entity: cover.shutter_kitchen
secondary_info: position
name: Kitchen
extend_paper_buttons_row:
extra_styles: |
paper-button:hover {
background-color: #242424;
}
buttons:
- tooltip: Open cover to sun position
icon: mdi:weather-sunset-down
styles:
button:
color: var(--primary-text-color)
margin-right: 4px
tap_action:
action: call-service
service: script.open_kitchen_shutter_to_sun_position
Hello @otiel
thank you for your code. Works fine for me, too. But have you managed to get the extra symbol greyed out, when the cover is at the sunset position?
Yes, I found out how to make it work. For your example you could try:
buttons:
- tooltip: Open cover to sun position
icon: mdi:weather-sunset-down
styles:
button:
color: var(--primary-text-color)
margin-right: 4px
tap_action:
action: call-service
service: script.open_kitchen_shutter_to_sun_position
styles:
button:
color: >-
{% if is_state_attr('cover.shutter_kitchen', 'current_position', 20) %}
lightgrey
{% endif %}
… assuming the position-attribute for your cover is “current_position” … Maybe you have to change this.