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.
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!
Thank you for your reply,
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âŚ
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.
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)
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/
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.
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.