/Home-Assistant-Appliance-Monitor

Get alerts about the state of a pre-IoT appliance based on signal from a sensor. In this example I'm attaching an SW-420 vibration sensor to the back of a washer and dryer to enable remote notification based on laundry room activity.

Apache License 2.0Apache-2.0

LaundryBot

These days there is no shortage of smart appliances. But does that mean we should neglect our simple pre-IoT machines just because they can't send a push notification?

I invite you to explore one way to get alerts about the state of any appliance regardless of its smartness based on signal from a binary sensor. In this example I'm attaching an SW-420 vibration sensor to the back of a washer and dryer to enable remote notification based on laundry room activity.

While this guide centers around washer and dryer units, this concept may be extended to other appliances. For instance, you could use a thermocouple to send an alert when the oven is ready, etc.

To follow this guide you will need Home Assistant running on the same network as the sensor unit.

Home Assistant

Open source home automation that puts local control and privacy first.

There are other ways (IFTTT, Slack, Twitter) to get alerts from a sensor to your phone but these are a great topic for another excellent guide.

Disclaimer

This guide assumes that the reader has intermediate knowledge and experience with electronics prototyping, soldering, scripting, debugging, and safe practices. As with any project there are many ways to acheive the desired result and this is just one of them. While I hope this is helpful, I offer no warranty and assume no liability for the result of following any or all of the instructions in this guide.

Step 1: Set up the ESP32 with ESPHome

Get started by installing the ESPHome Hass.io add-on. The ESPHome Getting Started guide assumes some knowledge of Home Assistant which has it's own Getting Started guide.

Step 2: Set up the hardware

Next, you'll want to get the hardware wired up. I decided to solder mine but you can use jumper wires if you prefer.

Step 3: Set up push notifications

Finally, it's time to get push notifications.

Here's what you'll need

  • Home Assistant running on the local network
  • Home Assistant companion app running on iOS
  • ESP32
  • SW-420 Normally Closed Vibration Sensor Module
  • 22AWG-28AWG stranded wire (either pre-terminated jumper wires with BLS connectors or using a BLS connector kit and crimping tool)
  • half-size breadboard
  • USB cable

Optional

  • Soldering Kit
  • Perfboard
  • Dust-resistant enclosure for SW-420 (I used some polypropylene cases I had sitting around)

Step 1: Set up the ESP32 with ESPHome

  1. Connect ESP32 and SW-420 to a breadboard. The red LED next to the USB port on the Huzzah32 is directly connected to GPIO#13. I decided to plug in the data line there to see if things were registering on the ESP32. The LED on the ESP32 started blinking when I gave the board a gentle tap. ESPHome Dashboard
  2. Install Home Assistant
  3. Install ESPHome and continue through the steps to set up your first node.
  4. Compile and upload LaundryBot.yaml script to ESP32 using ESPHome You may have noticed that I have this file set up for two different sensors connected to the same ESP32. If you only need one sensor you can delete the second one.
LaundryBot

esphome:
 name: laundrybot
 platform: ESP32
 board: featheresp32

wifi:
 ssid: 'network-id'
 password: 'network-password'

api:
 password: 'api-password'

ota:
 password: 'ota-password'

binary_sensor:
 - platform: status
   name: "LaundryBot"
 - platform: gpio
   pin: GPIO13
   name: "washer"
   device_class: vibration
   filters:
   - delayed_on: 10ms
   - delayed_off: 5min

ESPHome Dashboard 5. Once you've tested the hardware you may find that you need to fine tune the Binary Sensor Filter which helps debounce the input signal and potentially mitigate false positives.

   filters:
   - delayed_on: 10ms
   - delayed_off: 5min

Step 2: Set up the hardware

  1. I had originally planned on terminating the wires with BLS connectors and connecting the female BLS connector directly to the SW-420. I started to wonder if this type of connection in a vibration-intensive environment would introduce unnecessary risk. Ultimately I decided to solder the connections instead. ESPHome Dashboard
  2. Optionally, cut appropriately sized rectangles of perfboard and solder the sensor wires and the SW-420 to the perfboard. ESPHome Dashboard
  3. Connect SW-420 sensors to ESP32. ESPHome Dashboard
  4. Install sensor in the optional enclosure and attach them to the appliance you want to monitor. ESPHome Dashboard

Step 3: Set up push notifications

  1. Configure the sensor in the Integrations tab of Home Assistant. ESPHome Dashboard
  2. Create a basic automation from the Automation menu within the Configuration tab. ESPHome Dashboard
  3. Once the automation is created, edit the automation in the automations.yaml file, replacing yourdevice with your iOS device name.
- id: 'id-goes-here'
  alias: Washer is done!
  trigger:
  - entity_id: binary_sensor.washer
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - service: notify.ios_yourdevice
    data:
      message: Washer is done!
  1. Try to trigger the sensor and adjust the sensitivity control on the SW-420 until the desired threshold is acheived. ESPHome Dashboard
  2. 🎉 If everything is working, you should be able to receive notifications in the Home Assistant iOS app. ESPHome Dashboard

Copyright 2019 Ryan Moore

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.