Help with binary sensor automation

@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