Old Dishwasher, New Tricks

We have an old, but reliable, Bosch dishwasher. It doesn’t have any smart controls or integration, just some basic knobs and buttons on the front panel. It does, however, have one handy trick; it will resume a wash following a power interruption. Adding a smart plug, a template sensor, and an automation allows me to effectively pause the dishwasher when it is started during the peak power tariff period, and restart it when power is cheaper.

First of, a template sensor:

template:
  - sensor:
    - name: 'Dish Washer'
      unique_id: sensor.dishwasher
      state: >
        {% if is_state('switch.dishwasher', 'off') %}
          paused
        {% elif states('sensor.dishwasher_effective_current')|float(0) <= 0.02 %}
          off
        {% elif states('sensor.dishwasher_effective_current')|float(0) <= 0.05 %}
          on
        {% elif states('sensor.dishwasher_effective_current')|float(0) > 0.05 %}
          running
        {% else %}
          failed
        {% endif %}
      icon: mdi:dishwasher

This is combined with a simple automation:

alias: Switch:Dishwasher:Pause-on-peak
triggers:
  - trigger: state
    entity_id:
      - sensor.dishwasher
    to:
      - running
conditions:
  - condition: state
    entity_id: sensor.electricity_tariff
    state:
      - Peak
actions:
  - action: switch.turn_off
    target:
      entity_id: switch.dishwasher
  - wait_for_trigger:
      - trigger: state
        entity_id:
          - sensor.electricity_tariff
        from:
          - Peak
  - action: switch.turn_on
    target:
      entity_id: switch.dishwasher
mode: single

Now, when someone starts the dishwasher during the Peak tariff, the current draw rises above 0.05A and the template sensor shifts to “running”. This in turn triggers the automation, which switches off the smart plug and waits until the tariff changes from Peak. A similar approach could be applied to other appliances, provided they will automatically resume operation when power is restored.

1 Like

What does the condition do?

It seems to be true all the time?

1 Like

Good pickup @Hellis81 - it should have had:

    state:
      - Peak

The wait_for_trigger won’t survive a HA restart.

Did you consider a trigger on the tariff and then set the switch based on that?

1 Like

@busman I hadn’t considered the implications of a restart. I do run a pair of HA instances in a high-availability cluster, and could probably just rely on one or either of them to turn on the switch.

Having said that, it is definitely more sensible to just turn on the switch whenever the tariff changes from Peak, whether the dishwasher is paused or not.

(I originally just turned off the switch during Peak to prevent the dishwasher from being started outright, but that leads to me forgetting to put it on).

Based on @busman ‘s comment, the automations are now:

alias: Switch:Dishwasher:Pause-on-peak
triggers:
  - trigger: state
    entity_id:
      - sensor.dishwasher
    to:
      - running
conditions:
  - condition: state
    entity_id: sensor.electricity_tariff
    state:
      - Peak
actions:
  - action: switch.turn_off
    target:
      entity_id: switch.dishwasher
mode: single

and

alias: Switch:Dishwasher:Off-peak
description: Turn on the dishwasher after Peak tariff.
triggers:
  - entity_id:
      - sensor.electricity_tariff
    from: Peak
    trigger: state
conditions: []
actions:
  - action: switch.turn_on
    target:
      entity_id: switch.dishwasher
mode: single

I’d probably do both, I guess. Good to be able to turn it on whenever you want. Then trigger when power goes up to check the tariff and then to “pause” it. But also toggle it based on when the tariff changes.

Then you probably need a helper to say the dishwasher is running since the tariff change might happen when the dishwasher is not using much power. Ugh, simple things often are not so simple. :wink:

I think using triggers for, well, triggers makes things a lot cleaner. (Although I tend to put all my related triggers in the same automation.)

1 Like

It’s probably a bad idea to shut off power to the dishwasher with the plug like that. You are creating a power surge to the dishwasher’s circuitry with every off/on cycle.