I have a sensor for the power consumption of a device (washing machine). I would like to detect if the device is running or not. In standby, it consumer about 2W of power. My idea was to detect a power consumption of above 10W for 30s.
Complication: the power consumption fluctuates a lot when it is on. It goes abover 10W, but then might drop low, the go up again, and so on. So a simple trigger doesn’t work:
alias: Detect ongoing washing
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.shelly_washing_current_consumption
above: '10'
for: '0:00:30'
condition:
- condition: state
entity_id: input_boolean.washingmachine_running
state: 'off'
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.washingmachine_running
mode: single
It takes much more than 30s for this automation to detect that the device is active - actually until it stays consistently above 10W for 30s.
Is there a way to put the trigger on the average consumption over the last 30s?