I have a sonoff pow r2 linked to my washing machine, to get a notification when it’s finished.
The automation looks like this:
- alias: Waschmaschine - Benachrichtigung
initial_state: 'on'
trigger:
platform: state
entity_id: binary_sensor.wash_state
to: 'off'
action: ... (notification)
in binary_sensor.yaml
wash_state:
value_template: "{{ states.sensor.wash_mean.state | float > 10 }}"
in sensor.yaml
- platform: statistics
entity_id: sensor.wash_power_w
max_age:
minutes: 3
I need this meanvalue to even the curve so it don’t switch on and off at spikes. And I use the binary sensor to show the state in the UI. I know that I could bypass this in the automation.
Ok, so now my issue:
I’d like to turn off the the washing machine with the sonoff, when it is in standby for let’s say 15 minutes to save some power.
This is my automation to do this:
- alias: Washing machine off - after x min standby
initial_state: 'on'
trigger:
platform: time_pattern
minutes: '/5'
seconds: 00
condition:
- condition: state
entity_id: switch.power_washing_machine
state: 'on'
- condition: state
entity_id: binary_sensor.wash_state
state: 'off'
for: '00:15:00'
action:
- service: homeassistant.turn_off
entity_id: switch.power_washing_machine
But this doesn’t work as expected.
The problem is that it takes a little while to get the mean value above the threshold to turn the binary sensor too true.
So if the power of the washing machine is off and I turn it on manually (at the sonoff), there is a good change the automation will turn it of in the next 0-3 minutes, depending when the every-5min-trigger fires. If the meanvalue is still below the threshold, the washing maching gets turned off.
I missing a smart condition here. This might be obvious but I currently cannot see it.
Glad for any ideas.
@petro you show your skills regularly, any idea on this one?