[SOLVED] - Dryer cycle complete - automation - 4$ motion sensor SW-420

and here it is, not an Programmer`s choice but working solution for simple guy like me.

  - alias: Counting Dryer
    trigger:
      - platform: state
        entity_id: sensor.dryer
        to: 'ON'
    action:
      service: counter.increment
      entity_id: counter.dryer_counter

  - alias: Dryer Complete
    trigger:
      - platform: numeric_state
        entity_id: counter.dryer_counter
        above: 20
    condition:
      condition: state
      entity_id: sensor.dryer
      state: 'OFF'
      for: '00:05:00'
    action:
      - service: notify.alexa_media
        data:
          data:
           type: tts
          target: 
            - media_player.echo_show
          message: " Dryer is complete "

  - alias: Counting Reset
    trigger:
      - platform: state
        entity_id: sensor.dryer
        to: 'OFF'
        for: '00:06:00'
    action:
      service: counter.reset
      entity_id: counter.dryer_counter

The “Dryer Complete” automation may not work the way you expect.

It triggers when dryer_counter exceeds 20. This trigger will occur when the count changes from 20 to 21 It will not trigger when it changes from 21 to 22, or 22 to 23, etc (it triggers when the threshold value is crossed). So when the count is 21, it will check if dryer has been off for at least 5 minutes. If it has not the automation’s action is not executed … and the automation will not be triggered again (because the count has to drop below 20 and then rise above 20 to trigger the automation again).

you are correct , this part of automation is not working yet :frowning:
I will try to swap condition and trigger.

this is the working Solution ! thank you all for your inputs. The sensor + D1mini was ~4$

  - alias: Counting Dryer
    trigger:
      - platform: state
        entity_id: sensor.dryer
        to: 'ON'
    action:
      service: counter.increment
      entity_id: counter.dryer_counter

  - alias: Dryer Complete
    trigger:
      - platform: state
        entity_id: sensor.dryer
        to: 'OFF'
        for: '00:03:00'
    condition:
      - condition: numeric_state
        entity_id: counter.dryer_counter
        above: 20
    action:
      - service: notify.alexa_media
        data:
          data:
           type: tts
          target: 
            - media_player.echo_show
          message: " Dryer is complete "

  - alias: Counting Reset
    trigger:
      - platform: state
        entity_id: sensor.dryer
        to: 'OFF'
        for: '00:05:00'
    action:
      service: counter.reset
      entity_id: counter.dryer_counter

Why not use the “Dryer Complete” automation to reset the counter? What’s the need to wait another 2 minutes before resetting it?

When “Dryer Complete” executes its action, the counter has served its purpose so you may as well reset it there as opposed to using a separate automation.

  - alias: Counting Dryer
    trigger:
      platform: state
      entity_id: sensor.dryer
      to: 'ON'
    action:
      service: counter.increment
      entity_id: counter.dryer_counter

  - alias: Dryer Complete
    trigger:
      platform: state
      entity_id: sensor.dryer
      to: 'OFF'
      for: '00:03:00'
    condition:
      condition: template
      value_template: "{{states('counter.dryer_counter')|int > 20}}"
    action:
      - service: counter.reset
        entity_id: counter.dryer_counter
      - service: notify.alexa_media
        data:
          data:
            type: tts
          target: 
            - media_player.echo_show
          message: " Dryer is complete "
2 Likes

of course! makes perfect sense.

I`m afraid I could reduce tons of lines in my code if we work together more often :slight_smile:

cheers

1 Like

I have tried both: Xiaomi vibration sensor and power measurement and found power management far superior in terms of reliability.

You could even use the temporary additional power usage of crease protection (or anti-creasing, if your dryer has that feature) for a repeating reminder.

Interesting, never heard about 230V sockets in the U.S. My washing machine and dryer both consume 2300 Watts peak, so in Europe this translates to 10 Ampere. So there is no difference in the electrical plug.

You could use a current sensor, like https://esphome.io/components/sensor/pzemac.html or https://esphome.io/components/sensor/ct_clamp.html

1 Like

You could also attach a $0.95 photo-resistor on top off a LED/light of the dryer that indicates if it is running or not.

1 Like

Kinda late to the discussion but I just installed a temp/humidity sensor on mine over the weekend and made a YouTube video about it. Just incase it helps someone else.

Make a Dumb Dryer Smart in Home Assistant!!

I decided monitoring the moisture was a better approach for my situation since my dryer time seems pretty inconsistent and either leaves clothes damp or cooks them. I think this method should save me some electricity also.

Good luck with your projects!!!

Jake Bauer

2 Likes

Jake, I like you take on this: measure what you really want to know, i.e. are the clothes dry? I think I have all the parts here in my boxes, I think I have a new weekend project!

1 Like

It is a great idea.

I can imagine that the Humidity could be used as secondary information to the current measurement or motion monitoring to indicate something like

  • "Your dryer ended but your clothes are not dry yet, give it a few more minutes"

I will try to add the DHT22 to my existing sw-420 to extend the automation logic.

1 Like

Ive also got the TPlink energy plug reader/sensor. I had my config setup like this (im a newb!)

But im getting random notifcations at odd times of the day when the dryer isnt running and I cant figure out why. I was hoping to tighten up my code and make it more strict.

Only problem is the dryer drops to 2.6W momentarily during its cycle to change its rotation of spin but sits at 1800W normally.

I have it currently send a notification simply once its been under 1.0W for 10 seconds but was thinking of maybe adding an IF statement somewhere to say if its been over 1000W for 10 seconds and then goes under 1.0W for 10 seconds THEN fire off a notification? Just got no idea how to write that :slight_smile:

- alias: "Notify when dryer is done"
  trigger:
    platform: numeric_state
    entity_id: sensor.my_tp_switch_watts
    below: 1.0
    for: 00:00:10

  action:
    service: notify.PUSHOVER
    data:
      title: "Dryer done"
      message: "Grab the clothes!"

Hi, I have just picked up two vibration sensors, one for dryer and one for washing machine. Can you share your code with me please so I can tweak it to suit my application?

For those struggling with this like I was, I found a related post that solved my issues! Between the blue print and the idea to attach the sensor to the dryer drum it totally works now.

Thank you @rod_poplarchick !!

1 Like

good job figuring this out, seems like it will work great

I went down a similar path, using the SW-420. Thought I’d share photos of a slight “upgrade” - it’s now a $5 sensor including the housing :slight_smile: . ESP-01, carrier board, SW-420, Tic-Tac container, small piece of foam to hold the boards in place.


Going to mount to the side of my dryer with velcro tape.

1 Like

Is there a way to get something like this made and flashed already? I’m in way over my head here. I did finally get my preflashed s31 connected to my first homeassistant installation on my synology nas and think I have it configured to tell me when the washer power drops below 10 watts…running my first load of laundry now to see if it will work and trigger my sonos speakers in the kitchen.

I actually can’t believe I got this far but man I need help!

Yes you can buy vibration sensors.