Skip to content

Smart Plug Automation for Home Assistant Get notified when your washing machine, coffee maker, or other device is done — directly on your TV or Android!

License

Notifications You must be signed in to change notification settings

Bacard1/HASS-plug-notification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BANNER
<<<<<<< HEAD

📣 SMART PLUG NOTIFICATIONS

License: MIT GitHub last commit hacs_badge

Home Assistant Donate via PayPal Script

Български Deutch English

This Home Assistant automation notifies you when a device connected to a smart plug (e.g., washing machine, coffee maker, etc.) finishes its cycle. It monitors real-time power consumption to detect when the device stops operating and sends a visual notification to your TV or Android device. Ideal for energy savings and daily convenience.

🔧 Built with YAML
📡 MQTT Compatible
💡 Energy Efficient
📺 Supports Android TV & Mi TV


📦 CONTENTS


🚀 Tuya Smart Plug Zigbee TS011F

plug The Tuya Smart Plug Zigbee TS011F is an affordable smart plug with decent real-time monitoring responsiveness. In simple terms, data updates are relatively fast (around 10 seconds). While not perfect, it's sufficient—you'll receive the notification about 10 seconds after your laundry finishes.

METHOD 1: Notification Automation

🔌 Automation Trigger

When the washing machine is idle and turned off, the Tuya Smart Plug Zigbee TS011F shows a value of "0 watt." Any reading above "1 watt" means the washing machine is on. This condition triggers the automation:

alias: HASS PLUG NOTIFICATION
description: ""
triggers:
  - platform: numeric_state
    entity_id:
      - sensor.steckdose_002_wohnwand_power
    above: 1
    for:
      hours: 0
      minutes: 0
      seconds: 10

⏲️ Condition

⚠️ This automation does not use a separate conditions block, as the condition is embedded in the actions.

📲 Action

Once power consumption drops below 1W for 5 seconds, a notification is sent:

actions:
  - wait_for_trigger:
      - platform: numeric_state
        entity_id:
          - sensor.steckdose_002_wohnwand_power
        below: 1
        for:
          hours: 0
          minutes: 0
          seconds: 5
        continue_on_timeout: false
  - service: notify.mitv
    metadata: {}
    data:
      message: Washing machine finished !!!
      title: "Home Assistant Service:"
      data:
        position: top-left
        transparency: 50%
        color: black
        interrupt: 0
        fontsize: medium
        duration: 10

The notification is sent to Android TV using Notifications for Android TV.

ADD Integrations

notifications

📳 Automation Outcome

The automation monitors the plug's power usage. If it exceeds 1W, the washing machine is on. When it drops below 1W for 5 seconds, the cycle is complete, and a notification is sent.

🧾 Full Automation Code

alias: HASS PLUG NOTIFICATION
description: ""
triggers:
  - platform: numeric_state
    entity_id:
      - sensor.steckdose_002_wohnwand_power
    above: 1
    for:
      hours: 0
      minutes: 0
      seconds: 10
conditions: []
actions:
  - wait_for_trigger:
      - platform: numeric_state
        entity_id:
          - sensor.steckdose_002_wohnwand_power
        below: 1
        for:
          hours: 0
          minutes: 0
          seconds: 5
        continue_on_timeout: false
  - service: notify.mitv
    metadata: {}
    data:
      message: Washing machine finished !!!
      title: "Home Assistant Service:"
      data:
        position: top-left
        transparency: 50%
        color: black
        interrupt: 0
        fontsize: medium
        duration: 10
mode: single

METHOD 2: Using a Binary Sensor

Creating a binary sensor simplifies the process and allows visualization of the device's state on your room map.

Creating a Binary Sensor

  1. Create a new template by clicking the button:
    Add Template

  2. Select binary_sensor:
    img

  3. In the "State template*" field, enter:

{% if states('sensor.steckdose_002_wohnwand_power') | float == 0 %} 
  off
{% else %}
  on
{% endif %}

float == 0 sets a default value because without it, the sensor would return null, which is problematic for INT (integer) sensors. This is a simple example where a power reading above 0 means the device is on; otherwise, it's off.

Sensor Configuration

Assign the sensor to the correct device, and you're done:
img


💡 Tips & Additional Info

  • If you liked this project, check out HERE for more interesting repositories I've created.
  • If you encounter issues or have questions, feel free to reach out.

About

Smart Plug Automation for Home Assistant Get notified when your washing machine, coffee maker, or other device is done — directly on your TV or Android!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published