Washing machine notification

Folks, i monitor the consumption of my washing machine, and when it drops below 25 watts for a fixed amount of time, i have a notification sent that its in crease protection and again when it goes below 10 that its ready.

well that also happens each time i restart the HA instance, since then its so many minutes under 25 watts. and usually i work on it late at night and the very best wife is more than slightly annoyed by those false alarms while shes mostly trying to go sound asleep

how do i monitor for the average consumption over the past 20 minutes being above a given threshold?

the sensor is a Nous A1 wifi mqtt tasmota plug that also could switch but is not used for switching, only for measuring.

kind of if the 20 min average is above 500 watts cock the notification trigger, if it goes below 25 watts pull the notification trigger, but only fire when it was cocked beforeā€¦

thanks
manne

2 Likes

what if you change the trigger to go from [above] to [below] ?

thanks.
hm, i took a look at the history, and i cant do that as the washing machine hikes up and down many times during the washing process. e.g. while it heating its way up and while its soaking it basically zero, hence i have had a time limit for it to be under 25watts for a certain amount of time, (longer than the soak timeā€¦)

If i want to improve i have to have an average over a certain amount of time, then i could make a trigger if that goes from [above] to [below]

so I would like to clarify my question:

  1. how do I make a trigger that goes from [above] to [below]
  2. how do I get an average from an every 10 seconds reporting wifi mqtt sensor

A different approach.
It seems you get these false alarms because or when the washing machine is not running for real?
So what about first detecting that it is on and set a boolean to true. (above 100 w or something)
This boolean is then your condition in the notification automation.

that would work for sure, but only fixes part of my issues. the annoying ones for sure.

wiht your solution I would still have a delayed notification, because the ā€œfinishedā€ notification comes only after the soaking time threshold.

is computing an 30 min average from a sensor input that difficult?

I use a binary sensor that turns on, if power consumption goes above defined threshold (10 Watts). I use that binary sensor in an automation. A signal is sent if consumption falls below threshold for 5 minutes.

I donā€™t say, that this the easiest solution, but I donā€™t face false alarms.

Binary Sensor

binary_sensor:
  - platform: template
    sensors:
      washing_machine:
        value_template: "{{ states('sensor.washing_machine_power') | float(default=0) > 10.0 }}"

Automation

alias: signal washing machine is ready
description: ""
trigger:
  - entity_id: binary_sensor.washing_machine
    for: "00:05:00"
    from: "on"
    platform: state
    to: "off"
condition: 
  - condition: time
    after: "08:00:00"
    before: "22:00:00"
action:
  - data:
      message: >-
        Waschmaschine ist fertig.
    service: notify.someone_who_cares
mode: single
1 Like

thanks for the code, spares a lot of time building it myself, thats basically what Hellis81 was suggesting too.

I know a washing machine is not time criticalā€¦

i did some googleling and found that maybe a statistics sensor with median or meanwould do the trick?

I started playing with the statistics sensor

- platform: statistics
  name: "Washing machine average of 10 Minutes"
  unique_id: af802d9c-488e-41eb-b7e5-a7a60eea686d
  entity_id: sensor.plug_wama_energy_power
  state_characteristic: mean
  max_age:
    minutes: 10

right now gives me a nice smooth line in the UI. Ill put a screenshot in here after the machine finished washingā€¦

for a first test not so bad: image

I think I have found a way to get my automation the way I want itā€¦ thanks folks for the help, Ill be back with the finished code snipet.

edit: code:

alias: WaMa_finished
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.plug_wama_r_energy_power
    below: 20
    for:
      hours: 0
      minutes: 3
      seconds: 0
    id: WaMaR
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: WaMaR
              - condition: state
                entity_id: binary_sensor.wama_r
                state: "on"
        sequence:
          - service: mqtt.publish
            data:
              topic: wallpanel/nexus9/command
              payload: "{\"speak\": \"Washing machine finished.\"}"
              qos: 0
              retain: false
          - service: notify.mobile_app_for_who_cares
            data:
              message: Washing machine finished.
              title: WaMa finished
    default:
      - service: mqtt.publish
        data:
          topic: wallpanel/nexus9/command
          payload: "{\"speak\": \"Nothing new in the laundry room.\"}"
          qos: 0
          retain: false
mode: single

And I think this is a nice idea at least for the TTS stuff.

              - condition: time
                after: "08:00:00"
                before: "23:00:00"

hence i turned it around:

  - conditions:
      - condition: and
        conditions:
          - condition: trigger
            id: WaMaR
          - condition: state
            entity_id: binary_sensor.wama_r
            state: "on"
    sequence:
      - service: notify.mobile_app_from_who_cares
        data:
          message: Washing machine is finished.
          title: WaMa done
      - if:
          - condition: time
            after: "08:00:00"
            before: "23:00:00"
        then:
          - service: mqtt.publish
            data:
              topic: wallpanel/nexus9/command
              payload: "{\"speak\": \"Washing machine is finished.\"}"
              qos: 0
              retain: false

now I dont have false alarms after HA restart and i dont have a talking tablet after 11pm, just the companion app notification during the night.

2 Likes

Thats a really elegant solution - I went another route with in total three helpers - two number values to determine the kWh and one to sort out fales negatives during the washing cycle.

The value give at the end is the same as my Energy dashboard shows me (currentyl tests three times)

Maybe this could be interesing for someone here.

alias: "[Washing] Done"
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.waschmaschine_power
    for:
      hours: 0
      minutes: 1
      seconds: 0
    above: 3
    id: Washing_Start
  - platform: numeric_state
    entity_id: sensor.waschmaschine_power
    for:
      hours: 0
      minutes: 1
      seconds: 30
    below: 1
    id: Washing_End
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Washing_Start
          - condition: state
            entity_id: input_boolean.washing_machine_on
            state: "off"
        sequence:
          - service: input_number.set_value
            data_template:
              value: "{{ states('sensor.waschmaschine_energy') | float }}"
              entity_id: input_number.energy_start
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.washing_machine_on
      - conditions:
          - condition: trigger
            id: Washing_End
        sequence:
          - service: input_number.set_value
            data_template:
              value: "{{ states('sensor.waschmaschine_energy') | float }}"
              entity_id: input_number.energy_end
          - service: notify.pushover
            data:
              title: So Fresh and So Clean
              message: >-
                Washing is done. Used {{
                ((states('input_number.energy_end')|float)  - 
                (states('input_number.energy_start')|float)) | round(2)}} kWh.
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.washing_machine_on
mode: single

2 Likes

Hi Thorn, yours is also pretty neat :slight_smile:

how ever, do one really wants to know how much energy the washing machine is using? one could get scared at the current energy prices and by this one may start to get a bit more smelly.

ROFL

For me, I use mostly solar power, so I honestly dont care, same goes for water, I use 100% rainwater, and its still enough in the cistern to water the garden and even fill up the pool when necessary, I really dont care.

We havent run dry in years, and we feed a house with 6 grownups and 7 kids. Lots of washing, lots of toilet-flushings, big garden, regular pool refills from splash water, washing cars etc. pp.

So, the only thing I care is, is my cloth clean from grease and dirt as well as free from soap and it should be fast. I work mechanically, I cook all my work cloths, I change them at least every day. Thats 3 Machines a week for me alone. Hence I want it fast. 60mins for a 95Ā°C cooked machine with no prewash but with extra rinse. I only have one machine thats slower. its the newest, Bosch, and I wont go buy an other one of those new slow crapy green machines, I go with old Mile, good results, fast and reliable for decades.

In most countries washing the car where the water ends up in rivers, lakes or oceans is illegal.
You would need the water to go to a drain inside the house that goes to a treatment plant.

And your 60 min washing programs are not the best.
There is a reason why washing machines and dishwashers takes hours these days.
They clean the clothes or dishes the same way you would do it, by letting it soak in water and letting the water do the hard work.
The shorter programs relies more or mechanical cleaning which uses more energy and wears the clothes more.

Thatā€˜s what the Energy dashboard is for ā€¦

Thereā€™s not much point in me expanding on this unless you use node-RED, but just in case you do there is a neat contrib node that allows you to create a ā€˜state machineā€™ as the washing machine goes through its various phases. Using a regular entity state node you measure how long a given level of consumption is detected e.g. low, medium, high and depending on the previous machine state you can infer the new state.


The state machine handles this:
Screenshot 2023-02-08 105110
and you then create an entity based on the result.

2 Likes

thats neat, would have made so much so much easierā€¦ I just wonder why in years of FHEM and HA I never stumbled over that add-on.

I really do miss the Siemens PLC language FUP, that is so easy, still runing an S5 in my basement for some stuff. I never understood why all those Home Automation Guys made it so much more difficult.

Well, thanks @hunterdrayman
I for sure try that one out.

@m0wlheld, I have the energy dashboard deactivated :slight_smile: I did pay for that second layer on my roof and the big battery a lot of money, therefore now, I dont pay any money any more, asside from the hail insurance for that stuff. 100% self sufficient. The 600l rapeseed oil I use in my BHKW during the winter to bolster the battery, grow on my own land, well I leased it to a farmer and he pays me in rapeseed oil, as I myself would need to rotated the fruits to keep the ground in good shape, and could not grow rapeseed every year, also would need to bother with Berufsgenossenschaft and keep all the hardware to run the ā€œfarmingā€, naa. Therefore I just dont care how much we consume, we got plenty enough to run bitcoin miners 10 months a year with the surplus energy. And at 9ā‚¬ per day (0,6 cent per min) I dont care if miners runs a bit more or not. I just rather make some bitcoin and use the waste heat in my house than just dumping the surplus energy into heating water with a heating element, its basically the same, just without the 9ā‚¬ gain per day.

@Hellis81 indeed your right, if you wash delicate stuff, absolutely, go with the slow washing. However, my work cloth seldom gets older than a few months, a year max, due to ripping tearing and other stuff like welding burn-holes and such. So who cares if the fast washing eats that cloth? For me clean and fast is all I care.

Hi,
Iā€™m ā€œhijackingā€ this thread, since I am thinking on creating something similarā€¦ but ā€¦ before I just start to do an automation with the notification, I would like to start creating a template with the current state - similar to what @hunterdrayman did with node redā€¦
But - I would like to try it without the usage of noderedā€¦

I am asking myself, if it could be possible to create a template sensor with such states based on this patternā€¦

Sure, it might change if you select another washing programā€¦ but basically, I think it should be possible :thinking:

The part of my node-RED flow that youā€™re referring to is embodied in the state nodes. Below is one of them. Basically each is saying ā€˜if an HA state holds for time t emit trigger Xā€™. This is the easy bit and Iā€™d expect that to be possible in an automation. The interplay of many triggers and many machine states is the complicated bit. I think this will be difficult to replicate in a template but I would be delighted to be proved wrong.

Youā€™re right about other washing machine programmes messing things up, as I find out every so often when my wife uses a different one or when the machine objects to an excess of suds!