Samsung EcoBubble - Display energy by month and current state in "one" card

I want to break down what I did to get to the last step (mostly in French but you should get to the point).

Prerequistes: SmarThings integration up and running

First, create some utility meters

utility_meter:
  lave_linge_energy_monthly:
    source: sensor.lave_linge_energy
    cycle: monthly
  lave_linge_energy_daily:
    source: sensor.lave_linge_energy
    cycle: daily
  lave_linge_energy_weekly:
    source: sensor.lave_linge_energy
    cycle: weekly

Second, create some templates to display the current status, time and more (I’m aware that it is old style, I was young, please forgive me, one day I’ll come back to those and simplify)

sensor:
  - platform: template
    sensors:
      samsung_prog_state:
        friendly_name: 'Etape du programme'
        value_template: >-
          {% set statuses = { 'weightSensing':'Détection du poids', 'wash':'Lavage', 'rinse':'Rinçage', 'spin':'Essorage', 'finish':'Terminé' } %}
          {% set status = states('sensor.lave_linge_washer_job_state') %}
          {{ statuses[status] if status in statuses.keys() }}
        availability_template: >-
          {{ iif(is_state('sensor.lave_linge_washer_job_state', 'none') or is_state('sensor.lave_linge_washer_job_state', 'unavailable'), 'false', 'true') }}
      samsung_machine_state:
        friendly_name: 'Machine à laver'
        value_template: >-
          {% if is_state('sensor.lave_linge_washer_machine_state', 'run') %}
            Marche
          {% elif is_state('sensor.lave_linge_washer_machine_state', 'pause') %}
            Pause
          {% else %}
            Arrêt
          {% endif %}
        icon_template: >-
          {% if is_state('sensor.lave_linge_washer_machine_state', 'run') %}
            mdi:power-plug-outline
          {% elif is_state('sensor.lave_linge_washer_machine_state', 'pause') %}
            mdi:pause
          {% else %}
            mdi:power-plug-off-outline
          {% endif %}
      samsung_washing_time:
        friendly_name: 'Fin du programme'
        device_class: timestamp
        value_template: >-
          {{ states('sensor.lave_linge_washer_completion_time') }}
        availability_template: >-
          {{ iif(is_state('sensor.lave_linge_washer_job_state', 'none') or is_state('sensor.lave_linge_washer_job_state', 'unavailable'),'false','true') }}

Finally, everything is there to do the card:
It is a vertical-stack-in-card, a custom card that is available in HACS

To ease my work, I always start with a vertical-stack as it is UI compatible:

  1. Glance card
type: glance
title: Samsung EcoBubble
entities:
  - entity: sensor.samsung_machine_state
    name: État
  - entity: sensor.samsung_washing_time
    icon: mdi:clock-outline
    name: Fin estimée
  - entity: sensor.samsung_prog_state
    icon: mdi:debug-step-over
    name: Étape

image

  1. statistics-graph
chart_type: bar
period: month
days_to_show: 365
type: statistics-graph
entities:
  - entity: sensor.lave_linge_energy_monthly
    name: ' '
stat_types:
  - state

If, like me, you dont like the legend of the statistics-graph card, use card-mod to remove this part (you can find the full card above)

card_mod:
  style:
    .content statistics-chart $ ha-chart-base $: |
      .chartLegend {
        display: none;
      }

image

  1. Another glance for the energy summary
type: glance
entities:
  - entity: sensor.lave_linge_energy_daily
    name: Aujourd'hui
    icon: mdi:calendar-today
  - entity: sensor.lave_linge_energy_weekly
    name: Cette semaine
    icon: mdi:calendar-week
  - entity: sensor.lave_linge_energy_monthly
    name: Ce mois-ci
    icon: mdi:calendar-month

image

Then, to convert the vertical-stack into the vertical-stack-in-card, edit the card in yaml and replace type: vertical-stack with type: custom:vertical-stack-in-card