Action when laundry is done

I am trying to call a script when my laundry is done. What I have so far:

Everything seems to be working fine, except for the 5 minute delay on the last automation. What I want to achieve is that the last automation waits 5 minutes to be sure that the washingmachine is indeed done.

Does anyone see the mistake i made?

1 Like

To sure, the probleem is that the script is not waiting 5 minutes. It’s not being called at all.

Does this example help you at all?

- alias: 'Washer Done'
  trigger:
    platform: state
    entity_id: sensor.washer_pwrdn
    from: 'False'
    to: 'True'
    for:
      minutes: 3
  condition:
      condition: state
      entity_id: input_boolean.washer_switch
      state: 'on'
  action:
    - service: notify.pushbullet
      data:
        message: 'Robert, the washer is done.'
    - service: input_boolean.turn_off
      entity_id: input_boolean.washer_switch

Something like this

alias: Washmingmachine done notification
trigger:
  - platform: state
    entity_id: input_boolean.washingmachine_busy
    state: 'off'
    for:
      minutes: 5
action:
  - service: script.hue_flash

Thx guys! I’ll give it a go :slight_smile: I’ll let you know what my final solution will be!

I just realized that my “Done” notification doesn’t make much sense without the startup automation, so here’s the whole thing with the Dryer included as well.

I have two Aeotec Smart Plugs and I used the energy states to monitor things. I had to consider that the washer has pauses in it’s sequence that drop the power so I had account for that. I also had to account for the dryer load increasing when you open the door (the light) too.

I ended up creating two template sensors to count for those thresholds:

#
#   Automation Templates
#
#    True when washer power level is below 3.4 watts, high threshold of resting state
#    Default state is true
     washer_pwrdn:
       value_template: "{{ states('sensor.aeotec_smart_switch_6_power_10_8') | int < 3.4 }}"

#    True when Dryer power level is above 8.4 watts, showing dryer is in operation (as opposed to just having the door open)
#    Default state is false
     dryer_pwrup:
       value_template: "{{ states('sensor.aeotec_smart_switch_6_power_11_8') | int > 8.4 }}"

and these are used in the automations, now shown in full:

# Washer Notification Sequence

- alias: 'Washer Start'
  trigger:
    platform: state
    entity_id: sensor.washer_pwrdn
    from: 'True'
    to: 'False'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.washer_switch

- alias: 'Washer Done'
  trigger:
    platform: state
    entity_id: sensor.washer_pwrdn
    from: 'False'
    to: 'True'
    for:
      minutes: 3
  condition:
      condition: state
      entity_id: input_boolean.washer_switch
      state: 'on'
  action:
    - service: notify.pushbullet
      data:
        message: 'Robert, the washer is done.'
    - service: input_boolean.turn_off
      entity_id: input_boolean.washer_switch

# Dryer Notification Sequence

- alias: 'Dryer Start'
  trigger:
    platform: state
    entity_id: sensor.dryer_pwrup
    from: 'False'
    to: 'True'
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.dryer_switch

- alias: 'Dryer Done'
  trigger:
    platform: state
    entity_id: sensor.aeotec_smart_switch_6_power_11_8
    state: '0.0'
  condition:
    condition: state
    entity_id: input_boolean.dryer_switch
    state: 'on'
  action:
    - service: notify.pushbullet
      data:
        message: 'Robert, the dryer is done.'
    - service: input_boolean.turn_off
      entity_id: input_boolean.dryer_switch
5 Likes

Nice,
I might use something like that coupled with a BLE proximity sensor to tell who started the washer to notify them when their wash is done. That way I don’t have to bug everyone about it.

Just me alone, but this would be cool.

I’m currently adapting it so it will use Pushbullet only when I am away from home and run the notification through GHome when I’m not.

@turboc Your solution works like a charm, thanks!

I just implemented this, nice!

But it would be even nicer if we somehow could at a stopwatch so we could see running time, would that be possible?

I’ve been thinking about this too, using timestamps but haven’t had time to figure it out.

This could be done with IFTTT. You already have triggers to measure when the washer starts and stops, you could use this to automate timestamping on a Google Spreadsheet using IFTTT. Shouldn’t be too difficult :slight_smile:

1 Like

Not a bad solution, but I think we were both looking to do it within the framework of HA. But appreciate the idea; it may lead to something else. Thanks!

1 Like

Check this out

input_boolean:
  stopwatch:
    name: Stopwatch
    initial: off
  dummy:
    name: Dummy
    initial: off
    
automation:
  - alias: Stopwatch start
    trigger:
      platform: state
      entity_id: input_boolean.stopwatch
      state: "on"
    action:
      - service: input_boolean.toggle
        entity_id: input_boolean.dummy
          
  - alias: Stopwatch stop
    trigger:
      platform: state
      entity_id: input_boolean.stopwatch
      state: 'off'
    action:
      - service: input_boolean.toggle
        entity_id: input_boolean.dummy
          
  - alias: Stopwatch update
    trigger:
      platform: time
      seconds: '/1'
    condition:
      condition: state
      entity_id: input_boolean.stopwatch
      state: 'on'
    action:
      service: input_boolean.toggle
      entity_id: input_boolean.dummy
          
sensor:
  - platform: template
    sensors:
      stopwatch:
        friendly_name: "Stopwatch"
        value_template: >
          {% if is_state('input_boolean.stopwatch', 'on') %}
            {{ (now() - states.automation.stopwatch_start.attributes.last_triggered).total_seconds() | int }}
          {% elif is_state('sensor.stopwatch', 'unknown') %}
            0
          {% else %}
            {{ states('sensor.stopwatch') }}
          {% endif %}
        unit_of_measurement: 'sec'
        entity_id:
          - automation.stopwatch_start
          - automation.stopwatch_update
          - automation.stopwatch_stop
        
group:
  stopwatch:
    name: Stopwatch
    entities:
      - input_boolean.stopwatch
      - sensor.stopwatch

That creates a sensor to display the number of seconds since input_boolean.stopwatch was turned on. I’m sure someone could come up with a custom component that works better, but it was interesting that this is possible with just the components currently available.

6 Likes

This is very cool - thanks for sharing it!

I took a different approach due to the fact that my automation went crazy every now and then. I took:

sensor:

  • platform: statistics
    name: statistics op wasmachine value
    entity_id: sensor.energy_washing_machine

And for the automation part
automation:

  • alias: ‘Wasmachine notify’
    trigger:
    platform: numeric_state
    entity_id: sensor.statistics_op_wasmachine_value_mean
    below: 2
    action:
    • service: notify.pushbullet
      data:
      title: “'Wasmachine”
      message: “De wasmachine is klaar”
1 Like

This is very useful, I’ve implemented it with the washing machine monitoring code (so starting the washing machine starts the timer) :slight_smile:

Is there any way to format it from ‘2614 seconds’ to ‘26 mins 14 sec’?




Also, any way to take the final time taken and place it into a notification? (just format it to show in the notification)

Sure is. Just change the value template to something like

value_template: >
   {% if is_state('input_boolean.stopwatch', 'on') %}
    {{ relative_time(states.automation.stopwatch_start.attributes.last_triggered) }}
  {% elif is_state('sensor.stopwatch', 'unknown') %}
    0 seconds
  {% else %}
    {{ states('sensor.stopwatch') }}
  {% endif %}

You’ll probably want to remove unit_of_measurement then, as it won’t make sense anymore.

As for putting it in a notification, you should be able to just use a template for the message and put the value of the sensor, i.e. {{ states('sensor.stopwatch') }}. Just be sure to use data_template instead of just data.

1 Like

Great, thanks! I’ll try this later.

I’m curious as to what you will learn from getting the elapsed time. Not critical, actually curious what this may yield. If you find anything interesting by monitoring it, it would be great if you could share your findings.