Help with binary sensor automation

Hello all.

I have the below automation.

  - alias: dryer_done
    trigger:
      - platform: state
        entity_id: binary_sensor.spotter_vibration
        state: 'off'
        for:
          minutes: 2
    action:
      - service: notify.sms_billy
        data:
          message: >
            Dryer is done!

This works, however if the binary_sensor is enabled for just a second, I will end up with a notification. I would like to only run the action if the sensor was on for more than 2 minutes, and is then turned off for more than 2 minutes. What would be the easiest way to do this? Thanks.

1 Like

Hey @w1ll1am23,

Check this one: https://home-assistant.io/cookbook/turn_on_light_for_10_minutes_when_motion_detected/

Should be very similar but instead of switching off a light you and the message.

@w1ll1am23

After following the thread by @rpitera and seeing what he is working on for his dryer shut off notification I realized that something similar might work for you.

Create a Input Boolean: This will act as a virtual switch.
Now my theory here is that if your vibration sensor is on for 2 minutes it will turn on the virtual switch.
In order to recieve the notification the sensor has to go from off to on for 2 minutes and then on to off for 2 minutes. After sending the notification it should set the state of the virtual switch back to off. You might have to increase the time the sensor has to be on or off for. For instance, Lets say you have had clothes in the dryer for over 2 minutes when you realize you need to add or remove items. If you do not add/remove the items within 2 minutes the notification will be sent. With that said increasing the value will increase the time it takes to get notified after the dryer actually stops.

name: Toggle Dryer Automation # Input Boolean Setup
initial: off
icon: mdi:sync

# Dryer Notification Sequence

- alias: Dryer Start
  trigger:
    platform: state
    entity_id: binary_sensor.spotter_vibration
    from: 'off'
    to: 'on'
    for:
      minutes: 2
  action:
    service: input_boolean.turn_on
    entity_id: input_boolean.dryer_switch

- alias: Dryer Done
  trigger:
    platform: state
    entity_id: binary_sensor.spotter_vibration
    from: 'on'
    to: 'off'
    for: 
      minutes: 2 
  condition:
    condition: state
    entity_id: input_boolean.dryer_switch
    state: 'on'
  action:
    - service: notify.sms_billy
      data:
        message: >
          Dryer is done!
    - service: input_boolean.turn_off
      entity_id: input_boolean.dryer_switch

Hope this helps you!

Regards

1 Like

Wishing I had paired those spotters I had when Wink still supported them. Now I’m stuck with useless pucks. I could have been doing it via vibration rather than power levels. LOL

Mike’s right on this though, it should work for you.

1 Like

Thanks everyone, I’ll test this out today or tomorrow. @rpitera I have had my spotter sitting around connect, but doing nothing for awhile. Just saw the laundry monitoring post and figured I would try it out. We will see how it works. I have noticed that my light sensor will come on and stay on forever, so the vibration might do the same. Also who knows when wink will completely drop support.

When I asked I was told that if you have them paired in, they’ll continue to work but they can never be removed. If they are, you lose them forever. So treat them well. LOL.

I wish there was some way beyond that stupid light based flashing to get these things to work. I bought three of them and only got one to work. Then it stopped responding and I could never pair it again and gave up. When I went back to it, I got the bad news from support.

That sucks, just need some hardware expert to come along and figure out how to “re-image” them with some arduino code and make it an mqtt sensor lol.

BTW the automation works great. I was missing the input boolean, if I would have known that existed I probably would have been able to figure this out. Thanks.

1 Like