Washing machine power consumption trigger

Could you also show your automation to notify you?

Any recommendations on which service I could use for the notifications using multiple devices?

this is what I use

## Washing Machine Alerts
  - alias: Send alert when washing machine is finished
    trigger:
      - platform: state
        entity_id: sensor.washing_machine_status
        to: Clean
        for:
          minutes: 1
      - platform: state
        entity_id: device_tracker.admin_samsung
        to: 'home'
        for:
          minutes: 2
      - platform: state
        entity_id: device_tracker.admin_iphone
        to: 'home'
        for:
          minutes: 2
      - platform: time
        at: '20:45:00'
    condition:
      condition: and
      conditions:
        - condition: time
          before: '21:00:00'
          after: '08:30:00'
        - condition: state
          entity_id: group.family
          state: 'home'
        - condition: state
          entity_id: input_select.washing_machine_status
          state: Clean
        - condition: state
          entity_id: input_boolean.disable_washing_machine_notification
          state: 'off'
        - condition: template
          value_template: >
            {% if states.automation.send_alert_when_washing_machine_is_finished.last_triggered is not none %}
              {% if as_timestamp(now()) | int   -  as_timestamp(states.automation.send_alert_when_washing_machine_is_finished.attributes.last_triggered) | int > 1800 %} true {% else %} false
              {% endif %}
            {% else %}
            false
            {% endif %}
    action:
      - service: tts.google_say
        data:
          entity_id: media_player.tts_kodi
          message: 'The washing machine has finished and is ready to be emptied'
      - service: notify.pushbullet
        data:
          message: 'The washing machine has finished and is ready to be emptied'

I trigger an input_boolean, which then is triggered once when set, then every thirty minutes (if I’m home); it notifies me by TTS on my Google Home and via Hangouts. I then turn off this input_boolean through Google Assistant once I empty the appliance. If I’m not home, the input_boolean stores the state till I do get home and it then tells me as part of my arrive home TTS sequence.

- id: appliances_wash_to_idle
  alias: 'Appliances - Toggle Notifications'
  trigger:
    - platform: state
      entity_id: input_select.state_dishwasher
      from: 'Dry'
      to: 'Powered Down'
    - platform: state
      entity_id: input_select.state_washingmachine
      from: 'Rinse / Spin'
      to: 'Idle'
    - platform: state
      entity_id: input_select.state_dryer
      from: 'Tumble'
      to: 'Idle'
  action:
    - service: input_boolean.turn_on
      data_template:
        entity_id: >-
          {%- if (trigger.entity_id == "input_select.state_dishwasher") %}
              input_boolean.empty_dishwasher
          {%- elif (trigger.entity_id == "input_select.state_washingmachine") %}
              input_boolean.empty_washingmachine
          {%- elif (trigger.entity_id == "input_select.state_dryer") %}
              input_boolean.empty_dryer
          {% else %}
          {%- endif %}

- id: empty_appliances_notification
  alias: 'Notification - Empty Washer/Dryer/Dishwasher'
  trigger:
    - platform: time
      minutes: '/30'
      seconds: 00
    - platform: state
      entity_id: input_boolean.empty_dishwasher, input_boolean.empty_washingmachine, input_boolean.empty_dryer
      to: 'on'
  condition:
    - condition: state
      entity_id: group.people_status
      state: 'home'
    - condition: or
      conditions:
      - condition: state
        entity_id: input_boolean.empty_dishwasher
        state: 'on'
      - condition: state
        entity_id: input_boolean.empty_washingmachine
        state: 'on'
      - condition: state
        entity_id: input_boolean.empty_dryer
        state: 'on'
  action:
    - service: script.send_dishwasher_alert
    - delay: '00:00:06'
    - service: script.send_washingmachine_alert
    - delay: '00:00:06'
    - service: script.send_dryer_alert

send_washingmachine_alert:
  sequence:
    - condition: state
      entity_id: input_boolean.empty_washingmachine
      state: 'on'
    - service: tts.google_say
      entity_id: group.google_home_speakers
      data:
        message: "The washing machine's cleaning cycle has finished and it needs to be emptied."
    - service: script.send_hangouts_message
      data_template:
        message: "The washing machine's cleaning cycle has finished and it needs to be emptied."

welcome_home_sequence:
  sequence:
    - service: tts.google_say
      data_template:
        entity_id: >
          {% if source is defined %}
          {{ source }}
          {% else %}
          group.google_home_speakers
          {% endif %}
        message: >
          {{ ["Welcome home","Welcome back","Greetings"] | random }}. {%- if (states.input_boolean.empty_dishwasher.state == 'on') and (states.input_boolean.empty_dryer.state == 'on') and (states.input_boolean.empty_washingmachine.state == 'on') %} The dishwasher, dryer and washing machine completed while you were out and requires to be emptied.
          {%- elif (states.input_boolean.empty_dishwasher.state == 'on') and (states.input_boolean.empty_dryer.state == 'on') %} The dishwasher and dryer completed while you were out and requires to be emptied.
          {%- elif (states.input_boolean.empty_dishwasher.state == 'on') and (states.input_boolean.empty_washingmachine.state == 'on') %} The dishwasher and washing machine completed while you were out and requires to be emptied.
          {%- elif (states.input_boolean.empty_dryer.state == 'on') and (states.input_boolean.empty_washingmachine.state == 'on') %} The dryer and washing machine completed while you were out and requires to be emptied.
          {%- elif (states.input_boolean.empty_dryer.state == 'on') %} The dryer completed while you were out and requires to be emptied.
          {%- elif (states.input_boolean.empty_washingmachine.state == 'on') %} The washing machine completed while you were out and requires to be emptied.
          {%- elif (states.input_boolean.empty_dishwasher.state == 'on') %} The dishwasher completed while you were out and requires to be emptied.
          {%- endif %}

Code is a little bit messy and could be cleaned up but has been about 99% reliable. My dishwasher seems to mix it up sometimes with its power draw so this one is the 1% unreliable :slight_smile:

This should be fairly simple. As trigger you take the power consumption and if it goes to below, say, 2 then you trigger a notification. I do this with my washing machine and dryer and they trigger a notification via simplepush and a TTS message to my Google Home.

Ok thank you all.

Is there a way to do these TTS messages with Alexa or Siri (on Homepod)? I don’t have a Google Home, but I’d love to have those voice notifications too.

LThis is how I did it. Not tested yet. Suggestions are welcome. TP-Link HS110
TTS with Alexa works with this:

automations:
- alias: Notification - washing machine
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: sensor.wash_power
    to: 'False'
    for: '00:03:00'
  action:
    - service: notify.ios_group
      data:
        message: "XYZ"
    - service: media_player.alexa_tts
      data:
        entity_id: media_player.echo_dot__wz
        message: "XYZ"

Is there a way to hold that tts messages until a motion sensor near alexa is fired?

I think I would use a input boolean which is set to on when the washing machine is finished.

In another automation I‘ll use the motion sensor as a trigger and the Input boolean as condition.
In „action“ I would reset the Input boolean and send the tts message.

Is there a bettet way to do it?

Thats the way I’ve done it. I use it to trigger a home TTS message, and a static wait time meant most times I’d miss it. The input-boolean stores the trigger, and then switches off after the script runs.

you can use wait_template: in the action of the automation with the motion sensor being the thing that the automation waits for. very easy. check the docs for wait_template:

As I mentioned before I also used the TP Link HS110.

I also want to collect power consumption data, so I use the attributes “total_energy_kwh” and “today_energy_kwh” to do this.

Today I realized that both values are approxametely the same, which is not possible because total must be a lot bigger.

I checked the kasa app and saw that the provided total value here is plausible.

Than I checked the recieved data in HA again. It seems like HA gets the wrong data for the total value.

Do you have the same problem? Maybe its a translation issue within the software (because my kasa app is in german).

Unbenannt

I’m facing a problem with my washmachine sensor.

I have a really simple setup which looks like this:

binary_sensor:
  - platform: template
    sensors:
      waschmaschine_status:
        friendly_name: "Status"
        # delay_on:
        #   minutes: 1  
        delay_off:
          minutes: 4
        value_template: "{{ states.sensor.waschmaschine_leistung.state | float > 3 }}"

My issue is that in certain washingprograms the energyvalue goes under 3 watts while washing for serval minutes. This triggers my notification, because it is off for more than 4 minutes.

The programs are different, the 1hour program works just fine. The 3hour program has some stops to let the soap sink in.
Any suggestions for this?

Also another question to my former post (right before that one):
Can someone with an english hs110 look into his/her kasa app and compare the provides values with the ones that are listet in home assistant.
I have a german version and the total_energy_kwh value in ha is never equal to any value in the app.

1 Like

You could feed the consumption values into a statistics sensor and use that as trigger. This should smoothen out these kind of issues.

Other possibility is to run a script as soon as value is below 4 watts. The script should then run a times for a few minutes and then check power consumption again. If consumption is still below 4 watts it triggers the automation.

1 Like

Where does this part go? If I put under input_boolean: I get an error with the options part.

input_select:

and fixed original post.

1 Like

Ah ok I thought so. So to clarify for any noobs:
Configuration.yaml:

input_select:
  state_washingmachine:
    name: Washing Machine state
    options:
      - Switched Off
      - Powered Down
      - Idle
      - Rinse / Spin
      - Wash
    icon: mdi:tumble-dryer

The rest in automations.yaml

1 Like

The power consumption issue on the washing machine totally depends on the power consumption the capacity of the machine as if the machine is heavily loaded, then it will consume more and if the machine is less loaded, then it will consume less. You can know much better from washing machine repair service as well.

Just want to add my version with only 2 states: Washing and Ready.
And based on the Watt power usage.
I used below 10W (for a duration of 2 min.) for Ready and above 100W (for 10 sec. as it normally starts with heating directly) for Washing, which I guess works for any normal washing machine.
Based on the info in this thread and the example in the input select page.

Configuration.yaml:

input_select:
  state_washingmachine:
    name: Washing Machine state
    options:
      - Ready
      - Washing
    icon: mdi:tumble-dryer

In automation.yaml or after automation: in configuration.yaml


- id: washingmachine_washing
  alias: 'Washing Machine - washing state'
  trigger:
   - above: 100
     entity_id: sensor.wasmachine_power
     for: 00:00:10
     platform: numeric_state
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.state_washingmachine
        option: 'Washing'

- id: washingmachine_ready
  alias: 'Washing Machine - ready state'
  trigger:
   - below: 10
     entity_id: sensor.wasmachine_power
     for: 00:02:00
     platform: numeric_state
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.state_washingmachine
        option: 'Ready'

I furthermore added the automation to blink the living room (woonkamer) and Diner table (keuken tafel) when done.

- id: washing_machine_ready
  alias: Washing machine ready
  trigger:
    platform: state
    entity_id: input_select.state_washingmachine
    from: "Washing"
    to: "Ready"
  action:
  - service: light.toggle
    entity_id:
        - light.woonkamer_plafond_lamp
        - light.eettafel_lamp
  - delay: 00:00:01
  - service: light.toggle
    entity_id:
        - light.woonkamer_plafond_lamp
        - light.eettafel_lamp
  - delay: 00:00:01
  - service: light.toggle
    entity_id:
        - light.woonkamer_plafond_lamp
        - light.eettafel_lamp
  - delay: 00:00:01
  - service: light.toggle
    entity_id:
        - light.woonkamer_plafond_lamp
        - light.eettafel_lamp
10 Likes

I switched consumption meters and am running into problems; my new meter occasionally has got some strange power spikes which causes my automation to trigger randomly. I solved this by applying a moving average filter to it. Not ideal as a moving median would be a better fit, but thats not possible yet in Esphome (feature request opened by someone else who faces the same issue https://github.com/esphome/feature-requests/issues/364)

@philhawthorne Has a very good post here about this topic: https://philhawthorne.com/making-dumb-dishwashers-and-washing-machines-smart-alerts-when-the-dishes-and-clothes-are-cleaned/

It works really well for me after a bit of tweaking to compensate for the way my appliances work.

4 Likes

Thank you for this. Using the recent Helpers, I did it with 1 Helper and 1 Automation (using Choose conditions). Putting it here for anyone that this can be useful to.

  1. A dropdown Helper with 3 options: Standby, Washing, Completed. Screenshot at the end.

  2. An automation that covers both state changes choosing a trigger, with an app notification too.

alias: Lavadora
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.lavadora_power
    for:
      hours: 0
      minutes: 0
      seconds: 15
    id: lavadora_washing
    above: '40'
  - platform: numeric_state
    entity_id: sensor.lavadora_power
    below: '20'
    for:
      hours: 0
      minutes: 2
      seconds: 0
    id: lavadora_standby
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: lavadora_washing
        sequence:
          - service: input_select.select_option
            target:
              entity_id: input_select.lavadora
            data:
              option: Lavando
      - conditions:
          - condition: trigger
            id: lavadora_standby
        sequence:
          - service: input_select.select_option
            target:
              entity_id: input_select.lavadora
            data:
              option: Completada
          - service: notify.mobile_app_iphone_de_antonio
            data:
              message: Lavadora finalizada. Vaciar
    default: []
mode: single

I also set a Conditional Card as a warning and a Script to reset the state to Empty

The Helper:

And all this can of course be placed on the Dashboard:
image

4 Likes