Automation with shelly not working - washing machine

Hi,
I’m trying to identify when the washing machine is finished.
My home-assistant configuration is based on Shelly 1PM with a power metering feature.
I have 2 automation:

  1. washing machine started - detect when washing machine power measure is more than 5W for 5 Minutes. when this happens the boolean input ‘washing_machine_running’ is change to ON. This is working as expected.
  2. washing machine finished - detect when the power consumption is less than 3W for 1 minute and the boolean input is ON, then change the boolean to OFF and run a shell_command. I did check the power consumption and when the machine is ON the power consumption is 3 or more. when it is finished it is 2 or 3 for a few minutes and then it becomes 0.
    This is the config:
- id: 'xxxxxxx'
  alias: washing_machine finished and play announcement
  description: detect when washing machine finished working
  trigger:
  - below: '3'
    entity_id: sensor.shelly_shsw_pm_1_current_consumption
    for: 'minutes: 1'
    platform: numeric_state
  condition:
  - condition: state
    entity_id: input_boolean.washing_machine_running
    state: 'on'
  action:
  - data: {}
    entity_id: input_boolean.washing_machine_running
    service: input_boolean.turn_off
  - data: {}
    service: shell_command.kvisa
  - service: logbook.log
    data: {}
  mode: single

I cant figure out why it is not working :thinking:
Any help will be appreciated :pray:

Thanks.

I recommend that you read the documentation, there are several examples and quite clear.

https://www.home-assistant.io/docs/automation/trigger/
    for: 
      minutes: 1
1 Like

Thanks pollinolas, I will check it.
But this kind of error is very strange because I used the GUI to configure this automation :face_with_raised_eyebrow:

I will update after the next washing cycle :slight_smile:

If your adding times in the UI I’ve only found adding them using the format

00:00:00

works reliably.

In your instance it’d be

for: 00:01:00

Thank you jivesinger for your advice, It did the trick.
I used:

for: 00:00:30

and its working! (decided to reduce it to 30 seconds).
I still have a problem with a very long delay between the time when the power consumption is less than 3 and the time the automation is working… I will try to use the MQTT for this.
Thanks again :pray:

1 Like

i did this

works great

2 Likes

OK.
I enabled the MQTT integration and now its working perfectly.
Thanks for all the help!