My new dishwasher is connectable via Home Connect so I thought I’d have a go at creating a card for it. I haven’t done anything much with HomeAssistant for some time, and have hardly any experience with cards at all. I managed to cobble together something that works, but I could do with some advice on improving it. Code so far is:
type: custom:vertical-stack-in-card
cards:
- type: picture
image: /local/images/dishwasher-top.jpg
tap_action:
action: none
hold_action:
action: none
- type: entities
card_mod:
style: |
ha-card {
background-color: transparent;
box-shadow: none;
--ha-card-border-width: 0px;
}
entities:
- entity: none
type: custom:template-entity-row
- entity: switch.dishwasher_power
name: Power
- entity: binary_sensor.dishwasher_door
name: Door
- entity: sensor.dishwasher_operation_state
name: State
- entity: sensor.dishwasher_program_progress
type: custom:template-entity-row
name: Progress
state: |
{{ states(
"sensor.dishwasher_program_progress")
}}%
- entity: sensor.dishwasher_remaining_program_time
type: custom:template-entity-row
name: Finishing time (approx)
state: |
{% if states("sensor.dishwasher_remaining_program_time")
!= "unavailable" %}
{{ as_timestamp(states(
"sensor.dishwasher_remaining_program_time"))
| timestamp_custom("%H:%M") }}
{%else%} N/A {%endif%}
- entity: none
type: custom:template-entity-row
- entity: none
type: custom:template-entity-row
- type: picture
image: /local/images/dishwasher-base.jpg
tap_action:
action: none
hold_action:
action: none
card_mod:
style: |
ha-card {
background: #aaaba9;
background-image: -webkit-linear-gradient(
right, #8f8f8d, #edebe8, #8f8f8d);
box-shadow: none;
}
… and it renders like this:
My main question is about how best to handle the cleaning programmes. They are are exposed as a series of switches e.g. switch.dishwasher_program_eco50
, switch.dishwasher_program_intensiv70
etc. and I don’t want to show each of those as separate controls on the card. Is it possible to create some sort of drop-down list containing each available programme name so that one can be selected, and then have a button that willl activate the chosen switch when pressed?
Secondly, I’m using some blank entities simply as space-fillers. Is there a better way to do that?
Any other tips, suggestions or comments welcome.