Want to add Runtime to Mushroom entity card

Good morning,
I have some mushroom entity cards set up for appliances in my home.

I’d like to add a runtime to the card, so in the above screenshot, I have my washer and dry in my laundry room. Each appliance has a Shelly 1 PM in the outlet, which allows me to monitor the power and know if the appliance is active or not.

I’ve set up sensors to tell me if the appliance is running or is idle.

- sensor:
  - name: "Dryer"
    state: >
      {% if states("sensor.dryer_switch_0_power")|float == 0  %}
        Off
      {% elif states("sensor.dryer_switch_0_power")|float <= 2 %}
        Standby
      {% else %}
        Drying
      {% endif %}
    icon: >
      {% if states("sensor.dryer_switch_0_power") == "off"  %}
      mdi:tumble-dryer-alert
      {% elif states("sensor.dryer_switch_0_power")|float <= 2  %}
      mdi:tumble-dryer-off
      {% else %}
      mdi:tumble-dryer
      {% endif %}

  - name: "Washing Machine"
    state: >
      {% if states("sensor.washer_switch_0_power")|float == 0  %}
        Off
      {% elif states("sensor.washer_switch_0_power")|float <= 2 %}
        Standby
      {% else %}
        Washing
      {% endif %}
    icon: >
      {% if states("sensor.washer_switch_0_power") == "off"  %}
      mdi:washing-machine-alert
      {% elif states("sensor.washer_switch_0_power")|float <= 2  %}
      mdi:washing-machine-off
      {% else %}
      mdi:washing-machine
      {% endif %}

The mushroom card is based upon those sensors, and will tell me the state of those sensors.


type: horizontal-stack
cards:
  - type: custom:mushroom-entity-card
    entity: sensor.dryer
    tap_action:
      action: none
    hold_action:
      action: none
    double_tap_action:
      action: none
  - type: custom:mushroom-entity-card
    entity: sensor.washing_machine
    tap_action:
      action: none
    hold_action:
      action: none
    double_tap_action:
      action: none

What I’d like to add, is a runtime since start, and ideally for it to be next to the sensors state, with a dash in between. So, for example, I want to have a timer counting up from when the Washer changed from Standby to Washing. Eventually I may add cycles (spin, drain, etc) to the sensor, so I really just want the Standby to Washing to be the trigger, and Anything to Standby to stop the timer.

What is the best way to go about this?

2 Likes

Did you figure that out? I’m trying doing something exactly like that.
I was experimenting with the Tile Card. I just start.

type: tile
entity: light.kitchen
vertical: false
show_entity_picture: false
hide_state: false
state_content: last_changed
card_mod:
  style:
    ha-tile-info$: |
      .secondary:after {
        visibility: visible;
        content: ' | Running for {{ (as_timestamp(now()) - as_timestamp(states.light.kitchen.last_changed)) | timestamp_custom('%H:%M', False) }}'
      }