Hello everyone.
I am having a bit of a brain fart on where to start…Kind of. But I think it should be easier that I have some preliminary things out of the way.
I’ve made a washer and dryer Chip for my upstairs.
I am running off of a Aeotec Smart Switch for the washer. And a Aeotec Heavy Duty(240v) switch for the dryer.
I have some automations and helpers in place. I modified @123 setup for work for my washer and dryer which can be seen here
But here’s the modified version of the automation.
alias: LAUNDRY - Washing Machine Operation
description: ""
trigger:
- platform: state
entity_id: sensor.washing_machine_state
action:
- service: input_select.select_option
data:
entity_id: input_select.washing_machine_state
option: >-
{% set s = states('input_select.washing_machine_state') %} {% set fr =
trigger.from_state.state %} {% set to = trigger.to_state.state %} {% if
fr == 'Done' and to == 'Fill' %} Wash Fill {% elif fr == 'Fill' and to
== 'Run' %} Wash {% elif fr == 'Done' and to == 'Run' %} Wash {% elif fr
== 'Run' and to == 'Pulse' and s == 'Wash' %} Wash Spin {% elif fr ==
'Pulse' and to == 'Run' and s == 'Wash Spin' %} Wash Drain {% elif fr ==
'Run' and to == 'Fill' %} Rinse Fill {% elif fr in ['Fill', 'Run'] and
to == 'Wait' %} Rinse Wait {% elif fr == 'Wait' and to == 'Run' %} Rinse
{% elif fr == 'Run' and to == 'Pulse' and s == 'Rinse' %} Rinse Spin {%
elif fr == 'Pulse' and to == 'Run' and s == 'Rinse Spin' %} Rinse Drain
{% elif fr in ['Run', 'Fill', 'Wait', 'unknown'] and to == 'Done' %}
Done {% else %} unknown {% endif %}
mode: single
And the template sensor
trigger:
- platform: state
id: washing_machine_watt_change
entity_id:
- sensor.washing_machine_plug_electric_consumption_w
sensor:
- name: Washing Machine State
state: >-
{% set s = states('sensor.washing_machine_state') %}
{% set p = states('sensor.washing_machine_plug_electric_consumption_w') %}
{% if p == 'unavailable' %} unavailable
{% else %}
{% set p = p | int %}
{% if p == 0 %} Done
{% elif p < 3 %} Wait
{% elif 3 <= p <= 20 %}
{{ 'Fill' if s in ['Done', 'Run'] else s }}
{% elif 100 < p < 180 %} Run
{% elif p > 180 %} Pulse
{% else %} {{s}}
{% endif %}
{% endif %}
icon: mdi:washing-machine
So I’ve got Dryer Sensors, and Washing Machine sensors, that follow the cycle of the appliances.
What I am trying to figure out. How do I make a template - to take the time the input_select.washing_machine_state is not in ‘done’, and create an average time not in done. I’ve thought about adding an input counter helper, to increase the count in the automation when the state changes from ‘done’ that way I have a number of loads/event count of ‘not in done’ to divide the total time the state was ‘not in done’. But I am really unsure and new to using statistics in calculations in HA.
I don’t necessarily need the answer, but would love if someone could point me in the right direction.