Using the new Sonoff POW R2 current sensor, we added a new Home Assistant automation to notify via text message on phones and tablets and send audio alerts to our Sonos smart speakers when the washing machine has completed its cleaning cycle.

The Sonoff POWR2 sends updates every 10 seconds via our MQTT server to Home Assistant.

Using the following automation script, we can monitor its current usage and when the sensor.washing_machine_power drops below 5 watts for over two minutes. It sends notifications to our phones, tablets and speakers.

The data below from the sensor shows the mains current in amps throughout three washing cycles starting with a complete cycle, a short cycle with a small washing load and ending with a complete cycle.

The peaks on the graph at 10 amps are the water heating cycles, and the smaller peaks at the end of each cycle are the higher-speed spinning mode.

Current usage graph
Current usage graph

Automation Code

alias: Washing Machine Cycle finished
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.washing_machine_power
    below: '5'
    for: '00:02:00'
condition: []
action:
  - service: notify.mobile_app_brian_iphone
    data:
      message: >-
        Alert! The washing machine has finished, please remove the clothes from
        the washing machine
      data:
        push:
          sound: Update.caf
  - service: script.scriptwashingmachinecomplete
mode: single

Sonos Script

A second script has been added to Home Assistant for the Sonos smart speakers, which makes use of the Sonos snapshot feature to save the current state of the speaker, then sets the volume to 0.3 level, plays a voice alert from local storage with a short delay before restoring the Sonos state and allowing the speaker to continue as before.

This could have been added to the above automation, but I kept it separate for future expansion and added variables to play different files or on the other Sonos speakers in the house.

The audio file was created using a free text-to-speech service from https://ttsmp3.com/

alias: ScriptWashingMachineComplete
sequence:
  - service: sonos.snapshot
    data:
      entity_id: media_player.living_room
  - service: media_player.volume_set
    data:
      volume_level: 0.3
    target:
      entity_id: media_player.living_room
  - service: media_player.play_media
    target:
      entity_id: media_player.living_room
    data:
      media_content_type: music
      media_content_id: http://10.0.0.200/local/washing.mp3
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: sonos.restore
    data:
      entity_id: media_player.living_room
mode: single