Skip to content

🧺 Send PagerDuty notifications when the dryer has finished a load of laundry

License

Notifications You must be signed in to change notification settings

Aldaviva/DryerDuty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Washing Machine · Dryer

🧺 DryerDuty

GitHub Workflow Status Testspace Coveralls

Notify you when your dryer has finished a load of laundry by sending a PagerDuty alert.

  1. Behavior
  2. Prerequisites
  3. Circuit diagrams
  4. Installation
  5. Configuration
  6. Running
  7. Alerts
  8. Presentation
  9. References

Dryer timer dial

Behavior

  1. When you start a load of laundry in the dryer, an induction clamp sensor installed inside the dryer detects the increased current flowing from the start button to the motor.
  2. A .NET daemon running on a Raspberry Pi reads the voltage from the induction sensor using an analog-to-digital converter, and sends a Change event to PagerDuty when the motor starts.
  3. When the motor stops, the Raspberry Pi triggers an Alert in PagerDuty. This will notify you on your configured communications channels, like a push notification in the mobile app.
  4. When you open the dryer door to remove the laundry, another induction clamp sensor detects the door light turning on, and the Raspberry Pi automatically resolves the Alert so you don't keep getting notifications.

Prerequisites

Circuit diagrams

Current sensor

Visual diagram Schematic diagram Photo
current sensor circuit, visual view current sensor circuit, schematic view current sensor circuit, photo
⬇️ Download Fritzing file

Dryer

Dryer wiring diagram

The 60 A motor clamp sensor attaches to the light blue wire that connects the Push To Start Relay to the Drive Motor.

The 5 A light clamp sensor attaches to the orange wire that connects the NC terminal of the Door Switch to the Drum Lamp.

Installation

Hardware

  1. Open the drum cabinet of the dryer by unscrewing the two Phillips screws on the lint trap, then prying up on the front edge of the top panel. There are two spring clips that hold it down in the front left and right corners. I used a plastic panel puller to lift the lid.

    lint trap screws

    cabinet panel puller

  2. Clamp the 5 A current transformer around the orange wire that leads to the door switch on the right side of the cabinet.

    door current sensor

  3. Run the end of the wire with the 3.5 mm TRS plug up into the hole in the back center of the lid that leads to the control panel.

  4. Close the cabinet lid and replace the two lint trap screws.

  5. Open the control panel by pushing straight in (not pulling up) under the front left and right corners with a panel puller to release the two spring clips. Pitch the control panel back and rest it on something.

    lint trap screws

    lint trap screws

  6. Clamp the 60 A current transformer around one of the two light blue wires leading to the Start button.

    lint trap screws

  7. Place the Raspberry Pi, connected to the assembled current sensing circuit, underneath the control panel. You may need to stand the Raspberry Pi up on its edge so it will fit.

    lint trap screws

  8. Connect the 3.5 mm TRS plug from the 60 A motor sensor (in the control panel) to the ADC Channel 0 (left) 3.5 mm jack in your circuit.

  9. Connect the 3.5 mm TRS plug from the 5 A door light sensor (in the drum cabinet) to the ADC Channel 1 (right) 3.5 mm jack in your circuit.

  10. Plug the Raspberry Pi into a USB AC power adapter and run the cable underneath the side of the control panel.

    lint trap screws

  11. Check one final time that you can SSH into the Raspberry Pi.

  12. Close the control panel.

Software

  1. Enable the SPI kernel module on your Raspberry Pi using sudo raspi-config3 Interface OptionsI4 SPI, then reboot.
  2. Download the DryerDuty.zip file from the latest release to your Raspberry Pi.
    wget https://github.com/Aldaviva/DryerDuty/releases/latest/download/DryerDuty.zip
  3. Extract the ZIP file to a directory like /opt/dryerduty/.
    sudo mkdir /opt/dryerduty
    sudo unzip DryerDuty.zip -d /opt/dryerduty
    rm DryerDuty.zip
  4. Allow the program to be executed.
    sudo chmod +x /opt/dryerduty/DryerDuty
  5. Install the SystemD service.
    # if you chose an installation directory that isn't /opt/dryerduty, edit ExecStart and WorkingDirectory in dryerduty.service
    sudo mv /opt/dryerduty/dryerduty.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable dryerduty.service

Configuration

PagerDuty

Create an Integration in PagerDuty and get its Integration Key.

  1. Sign into your PagerDuty account.
  2. Go to Services › Service Directory.
  3. Select an existing Service for which you want to publish events, or create a new Service.
  4. In the Integrations tab of the Service, add a new Integration.
  5. Under Most popular integrations, select Events API V2, then click Add.
  6. Expand the newly created Integration and copy its Integration Key, which will be used to authorize this program to send Events to the correct Service.

DryerDuty

DryerDuty is configured using appsettings.json in the installation directory.

  • pagerDutyIntegrationKey is the Integration Key that PagerDuty gives you when you create a new Events API v2 Integration for one of your Services.
  • motorMinimumActiveAmps is the minimum current, in amps, which would indicate that the dryer's motor is running.
    • My dryer's motor runs at 4.33 A, so I set this to 2.0.
  • lightMinimumActiveAmps is the minimum current, in amps, which would indicate that the light bulb in the drum turned on because the door was opened.
    • My 15 W bulb runs at 0.08 A, so I set this to 0.04.
  • motorGain is a coefficient which the motor current is multiplied by to get a more accurate value.
    • The default value is 1.0, but I had to set mine to 1.64 to match the current readings from my clamp multimeter.
  • lightGain is a coefficient which the light bulb current is multiplied by to get a more accurate value.
    • The default value is 1.0, but I had to set mine to 0.75 to match the nominal current of my bulb.
  • Logging.LogLevel controls the log verbosity, where the key is the namespace and the value is the log level name.
    • To see current readings from this library, set Logging.LogLevel.DryerDuty to Trace and run /opt/dryerduty/DryerDuty from the command line.

Running

Restart the service

sudo systemctl restart dryerduty.service

Check status

sudo systemctl status dryerduty.service
🟢 dryerduty.service - DryerDuty
     Loaded: loaded (/etc/systemd/system/dryerduty.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-09-23 01:21:11 PDT; 2h 44min ago
   Main PID: 340 (DryerDuty)
      Tasks: 19 (limit: 1714)
        CPU: 3min 25.970s
     CGroup: /system.slice/dryerduty.service
             └─340 /opt/dryerduty/DryerDuty

Sep 23 01:21:03 dryer systemd[1]: Starting DryerDuty...
Sep 23 01:21:10 dryer DryerDuty[340]: DryerDuty.DryerMonitor[0] Timers started
Sep 23 01:21:11 dryer DryerDuty[340]: Microsoft.Hosting.Lifetime[0] Application started. Hosting environment: Production; Content root path: /opt/dryerduty
Sep 23 01:21:11 dryer systemd[1]: Started DryerDuty.

View logs

sudo journalctl -f -u dryerduty.service
-- Journal begins at Tue 2023-05-02 17:25:51 PDT, ends at Sat 2023-09-23 04:06:51 PDT. --
Sep 23 01:21:03 dryer systemd[1]: Starting DryerDuty...
Sep 23 01:21:10 dryer DryerDuty[340]: DryerDuty.DryerMonitor[0] Timers started
Sep 23 01:21:11 dryer DryerDuty[340]: Microsoft.Hosting.Lifetime[0] Application started. Hosting environment: Production; Content root path:>
Sep 23 01:21:11 dryer systemd[1]: Started DryerDuty.

Alerts

  1. When the dryer starts running, this program will send a Change event to PagerDuty with the summary

    The dryer is starting a load of laundry.
    
  2. When the dryer completes the load, this program will trigger a new Alert at the Info severity, with the summary

    The dryer has finished a load of laundry.
    

    Alert in the PagerDuty Android app Alert in the PagerDuty webapp

  3. When the dryer door is opened after it finishes a load, this program will automatically resolve the previously created Alert. You can also manually resolve the Alert from the PagerDuty web or mobile apps.

Presentation

I gave a talk about this project for PagerDuty's 2024-02-09 How-To Happy Hour on their Twitch channel.

Video

References