Action when laundry is done


#1

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?


#2

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


#3

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

Share your favourite or most useful automations
#4

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

#5

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


#6

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

Need help with tracking my washing machine status
Usage template energy meter to add to presence lights
Notification when washing machine is done
Need help with tracking my washing machine status
Power value monitoring
#7

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.


#8

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.


#9

@turboc Your solution works like a charm, thanks!


#10

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?


#11

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


#12

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:


#13

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!


#14

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.


Need help with tracking my washing machine status
An example of a countdown timer, and some related questions
#15

This is very cool - thanks for sharing it!


#16

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”

Need help with tracking my washing machine status
#17

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)


#18

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.


#19

Great, thanks! I’ll try this later.


#20

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.