# Power consumption per one cycle (washing machine)

Hi all,

I want to get overview of how much power one run of my washing machine uses so I can compare different washing modes and their power usage.

I have Shelly PM installed, I can see the power consumption, I have sensor set that recognizes if the washing machine is running or is off. So my idea is that it should be possible to know how much power the machine used during the “washing” phase.

``````sensor:
- platform: template
sensors:
pracka_pere:
friendly_name: Pračka ##if power is higher than 0.1W set state to "pere"(washing)
value_template: >-
{% if states('sensor.pracka_zasuvka_shelly_pm_switch_0_power')|float > 0.1 %}
pere
{% else %}
vypnutá
{% endif %}
``````

Ideal outcome would be some kind of overview where I could see individual cycles and total amount of kWH used during the cycle.
or at least card in lovelace showing consumption for last finished cycle.

I think it should be possible, and that I have everything that is neccessary, I just dont know how to set it up and would appreciate help.

Thank you.

1 Like

A while back I experimented with trying to get cost calculations for various home appliances using wall wart type power plugs with power monitoring. My net take away from my simple experiments was that it is difficult to calculate accurate cost due to the slow sampling rate that these low cost power monitoring devices offer. I have the Shelly US Plugs among several others, none I found were really up to the task. Most home appliances use what is colloquially called in the power engineering worlds as ‘bang bang’ to operate most devices. For example a coffee maker will cycle the power between zero and full on several times a minute to keep your pot of coffee warm. The cost to build home appliances that run on our standard alternating current that would vary the power use rather than just ‘bang bang’ would make that coffee maker cost USD 1000 vs. USD 30.

So you have to have a sampling device that can track these square wave ons and offs, unfortunately what we have in devices like the Shellys miss a significant number of the power cycles, so the area under the curve is often far from accurate.

This is not to say that you cannot get some estimates, especially if you can do a number of ‘runs’ and also if you are doing a high level comparison of different operating cycles. But definitely don’t plan on taking the numbers to the ‘bank’.

Below is the output for a python jupyter notebook I wrote a while back. The data is captured with a Shelly US Plug. This data is from two back to back runs of a washing machine yesterday afternoon, each of the two runs used the same wash parameters on the machine. As you can see in the second picture, the two ‘area under the curve’ algorithms, ‘Trapezoidal’ and ‘Simpsons’, I use yield wildly different costs.

The notebook is pretty amateur code and is base on my use of postgresql for my Home Assistant recorder database. That said, I’m happy to share it with you.

Hope you are able to find some ways to get some useful analysis, good hunting!

1 Like

I dont really need exact number as per cost, what I want to know is, how much kWh each cycle uses (maybe do an average after few runs of different cycles)
The shelly can give me total kWh, but it is kind of cumbersome to get the consumption for each cycle especially when there are multiple in a single day.

Thank you again, I dont know if I will go the python way, tho.

If I understand you correctly, I concur. I have been looking for a way to capture power ‘event’ streams for a while. For example the washing machine cycle we are discussing. I think there are possible solutions using some of the AI and time series models and packages out in the world. It is on my ‘todo’ list, but it sits…

I am far from a qualified data scientist, however if my analysis shown, has any merit, it shows that that load of laundry either cost 4 cents, or a dollar sixty US. Kind of significant difference when I try to rationalize my hobbies and drinking to the significant other…

Hi David,

I dont think I need any AI. Thats too complicated of a solution, When the washing machine turns on, my sensor (shown in the OP) turns into “washing” mode" when the power consumption is 0 it swiches to “off” during the “washing” period the energy meter changes and I just want to calculate the difference between and after. I can do that manually from the graph, but thats boring.

When the device is turned on, save the device’s current energy to a helper. When it stops washing save the current energy. The difference is the consumption for this session.

3 Likes

Thats the kind of solution I want, but I cant figure out how to save the current state to a helper, do you have any pointers for this?

Thanks!

maybe another template-sensor that is triggered by the “pere” state … below is ex. from

``````template:
- trigger:
- platform: time_pattern
# This will update every night
hours: 0
minutes: 0
sensor:
# Keep track how many days have past since a date
- name: "Not smoking"
state: '{{ ( ( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(default=0) }}'
unit_of_measurement: "Days"
``````

not exactly this example, but you need the info from" Shelly PM" when state of “washing” == start “pere” and give it a uniqeu_id(1), and when state of “washing” == stop_pere unique_id(2)

Then maybe:

`````` - platform: template
id: washingperiod
unit_of_measurement: W
period: 'return id(pere2).state - id(pere1).state;'``````
1 Like

or read direct from Shelly PM, using aggregate/group by/period(starttime-stoptime), triggered by pere-start
PS: i have no idea, just full of ideas

… below might round it up

combing with this … maybe

I have implemented a solution for runtime/cost/usage for all my appliances using a state machine based on values in an input_select. The main idea is to identify off → on → running → finished by looking at the usage the smart switch is reporting, for instance above 1 kwh for 1 minute means on → running. Then add automations to make the transitions between states in the input_select. There is a more in-depth tutorial here: https://philhawthorne.com/making-dumb-dishwashers-and-washing-machines-smart-alerts-when-the-dishes-and-clothes-are-cleaned/

1 Like

wirth the curent “statistic” card it’s much easier. I used statistic card to tell me consumption per last week and I feel like this is much more helpful. maybe you can add another helper that will count number of cycles per week based on state of washing machine. (which i have sensor for) then you can just divide total weekly consumption by number of cycles.

Just to blow some life into this topic. I have such a solution setup, there are various ways to start and stop the utility meter with tariffs or utilize the newer statistic card.

However, how about storing these “sessions”? I would like have a consumption log from start to end and then include timestamps. Haven’t found anything jet.

Try this for size ‘Smart Home Junkie’ explains it very well. How To Monitor Your Washing Machine in Home Assistant - YouTube

Thanks!

This is somewhat into the direction, but nothing new or impossible. What this lacks for example is to have the ability what the washing session of two weeks looked like, duration, usage.