Hey Marc,
Here it comes
It is a precondition that you ha installed custom:button-card
The device representing my dishwasher is called opvaskemaskine so you need to replace that in my code by the name of your machine
Then here is some code to be placed in the switch section of your configuration.yaml. if you don’t have a switch section already you can creat that by adding the line
Switch:
Then add the following code right after:
##################################################################################################################
#################### VWashing machinne ####################
##################################################################################################################
- platform: template
switches:
opvaskemaskine_program_chosen:
value_template: >
{{
is_state('switch.opvaskemaskine_program_intensiv70', 'on') or
is_state('switch.opvaskemaskine_program_auto2', 'on') or
is_state('switch.opvaskemaskine_program_eco50', 'on') or
is_state('switch.opvaskemaskine_program_nightwash', 'on') or
is_state('switch.opvaskemaskine_program_kurz60', 'on') or
is_state('switch.opvaskemaskine_program_glas40', 'on') or
is_state('switch.opvaskemaskine_program_quick45', 'on') or
is_state('switch.opvaskemaskine_program_machinecare', 'on')
}}
############ The following program entities are not used ##############
# is_state('switch.opvaskemaskine_program_auto1', 'on') or
# is_state('switch.opvaskemaskine_program_auto3', 'on') or
# is_state('switch.opvaskemaskine_program_autohalfload', 'on') or
# is_state('switch.opvaskemaskine_program_expresssparkle65', 'on') or
# is_state('switch.opvaskemaskine_program_glasscare', 'on') or
# is_state('switch.opvaskemaskine_program_intensiv45', 'on') or
# is_state('switch.opvaskemaskine_program_intensivpower', 'on') or
# is_state('switch.opvaskemaskine_program_magicdaily', 'on') or
# is_state('switch.opvaskemaskine_program_maximumcleaning', 'on') or
# is_state('switch.opvaskemaskine_program_normal45', 'on') or
# is_state('switch.opvaskemaskine_program_normal65', 'on') or
# is_state('switch.opvaskemaskine_program_quick65', 'on') or
# is_state('switch.opvaskemaskine_program_steamfresh', 'on') or
# is_state('switch.opvaskemaskine_program_super60', 'on') or
turn_on:
turn_off:
opvaskemaskine_ready_for_program_activation:
value_template: >
{{ is_state('switch.opvaskemaskine_power', 'on') and
is_state('binary_sensor.opvaskemaskine_door', 'off') and
is_state('switch.opvaskemaskine_program_chosen', 'off')}}
turn_on:
turn_off:
opvaskemaskine_program_active:
value_template: >
{{ is_state('switch.opvaskemaskine_program_chosen', 'on') and
is_state('binary_sensor.opvaskemaskine_door', 'off')}}
turn_on:
turn_off:
then create a lovelace card and replace its code by the following
cards:
- card:
type: vertical-stack
cards:
- type: button
tap_action:
action: toggle
entity: switch.opvaskemaskine_power
icon_height: 40px
show_name: false
- cards:
- entity: switch.opvaskemaskine_program_intensiv70
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_auto2
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_eco50
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_nightwash
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_kurz60
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_glas40
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_quick45
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
- entity: switch.opvaskemaskine_program_machinecare
hold_action:
action: more-info
icon_height: 40px
show_icon: true
show_name: true
tap_action:
action: toggle
type: button
type: grid
columns: 4
square: false
conditions:
- entity: switch.opvaskemaskine_ready_for_program_activation
state: 'on'
type: conditional
- card:
type: 'custom:button-card'
aspect_ratio: 3/4
entity: binary_sensor.opvaskemaskine_door
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.opvaskemaskine_power
show_entity_picture: true
name: ' '
show_state: false
size: 130%
custom_fields:
power: |
[[[
if (states['switch.opvaskemaskine_power'].state == 'on')
return `<ha-icon
icon= "mdi:power"
style="width: 40px; height: 40px; color: red;">
</ha-icon>`
else
return `<ha-icon
icon= "mdi:power"
style="width: 40px; height: 40px; color: gray;">
</ha-icon>`
]]]
finish_time: |
[[[
if (states['switch.opvaskemaskine_program_active'].state == 'on')
{
var hour = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(11,2));;
hour = hour + 1;
if (hour > 23)
hour = hour - 23;
var minute = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(14,2));
var second = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(17,2));
if (second > 30)
minute = minute + 1;
if (minute > 59)
{
minute = minute - 59;
hour = hour + 1;
}
return hour + ':' + minute;
}
else
return '';
]]]
program: |
[[[
if (states['binary_sensor.opvaskemaskine_door'].state == 'on')
return '';
else if (states['switch.opvaskemaskine_program_intensiv70'].state == 'on')
return `<ha-icon
icon= "mdi:pot"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Intensiv 70°C (S 7 6 2:20)`
else if (states['switch.opvaskemaskine_program_auto2'].state == 'on')
return `<ha-icon
icon= "mdi:format-color-text"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Auto 45-65°C (A 6 5 2:30)`
else if (states['switch.opvaskemaskine_program_eco50'].state == 'on')
return `<ha-icon
icon= "mdi:cash-multiple"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Eco 50°C ( N 4 4 3:15)`
else if (states['switch.opvaskemaskine_program_nightwash'].state == 'on')
return `<ha-icon
icon= "mdi:ear-hearing-off"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Silence 50°C (N 4 4 3:55)`
else if (states['switch.opvaskemaskine_program_kurz60'].state == 'on')
return `<ha-icon
icon= "mdi:coffee"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Kort 60°C (N 5 5 1:20)`
else if (states['switch.opvaskemaskine_program_glas40'].state == 'on')
return `<ha-icon
icon= "mdi:glass-wine"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Glas 40°C (N 5 3 1:40)`
else if (states['switch.opvaskemaskine_program_quick45'].state == 'on')
return `<ha-icon
icon= "mdi:flash"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Lyn 45°C ( L 4 3 0:30)`
else if (states['switch.opvaskemaskine_program_machinecare'].state == 'on')
return `<ha-icon
icon= "mdi:calendar-star"
style="width: 100px; height: 100px; color: blue;">
</ha-icon></br>Maskinpleje`
else
return '';
]]]
progress: |
[[[
if (states['switch.opvaskemaskine_program_active'].state == 'on')
{
var prog = 0;
var totalprog = parseInt(states['sensor.opvaskemaskine_program_progress'].state);
var out ='|';
for (prog = 0; prog < totalprog/3; prog++)
{
out = out +'|';
}
for (prog = 0; prog < (100 -totalprog)/3; prog++)
{
out = out +' ';
}
return out + ': ' +totalprog + ' %';
}
else
return '';
]]]
styles:
custom_fields:
power:
- position: absolute
- top: 6%
- left: 7%
- color: red
- font-size: 30px
finish_time:
- position: absolute
- top: 6%
- left: 40%
- color: red
- font-size: 30px
program:
- position: absolute
- top: 30%
- left: 25%
- color: blue
- font-size: 20px
progress:
- position: absolute
- top: 60%
- left: 25%
- color: blue
- font-size: 20px
state:
- value: 'on'
entity_picture: >-
https://www.auktionshuset.dk/thumbs/1280x720/images/RVz0ALE6Wr/M15jalp0J2/a346b1ad4716e12e31a5ce2130fa0a892486614d.jpeg
- value: 'off'
entity_picture: >-
https://dahvid.dk/media/catalog/product/cache/a7e8e8c913fe4b81adc7fa066f0855c2/a/e/aeg_opvaskemaskine_ffb53640zw_1.jpg_aitseo/0/siemens-opvaskemaskine-sn478s36ts.jpg
conditions:
- entity: switch.opvaskemaskine_ready_for_program_activation
state: 'off'
type: conditional
type: vertical-stack
That is it.
Try it and let me know how far you come, and if you have any challenges or need to do minor modifications
If you are not living in central Europe you will need to modify the finsh time by adding/subrtracting another number of hours from UTC time. I’ll guide you if this is the case.
Good luck