Automation for washing machine not working properly

Hello everyone,

I built an automation to get a notification when the washing machine is started and when it is finished with the washing program. The automation also ensures that the lighting in the living room flashes when the washing machine is finished with the washing program.

The automation is started based on the power consumption of the machine. If the consumption is above 12 watts for more than 1 minute or if the consumption is below 1 watt for more than 5 minutes, the automation is started. The automation then ensures that a notification is sent to my phone.
At the beginning of the washing program it is reported that the washing machine has started and at the end of the program that the machine is ready, also the lighting in the living room will flash.

To date, however, I can’t get the automation working properly.

To measure the power consumption of the washing machine I use the Shelly Plug (https://www.shelly.cloud/products/shelly-plug-smart-home-automation-device/). I chose this plug because of the simplicity of pairing and the high power consumption for which the plug can be used.

I have tried various thresholds for consumption and also varied the time that the consumption must be below the threshold of 1 watt. However, it has not resulted in a fully functioning automation.

It seems, when analyzing the data, that the moment a notification is given that the washing machine has started, that is correct. The moment a notification is given that the washing machine is ready, however, that is not correct.
The automation is now started, while the consumption is not yet below the set threshold of 1 watt for 5 minutes.

To clarify, I have also added some print screens and a printout of the automation.

You can see that the automation starts for the 1st time at 07:17:30. That’s when the washing machine is turned on. This is exactly in line with the set threshold (>12 watts) and period (1 minute). After that, the automation is started again at 07:39:12. And that moment I do not understand that the automation is started. The automation could only be started if the consumption for a period of 5 minutes is below 1 watt.

When I look at the power consumption, I do not see that this was below 1 watt for a period of 5 minutes.

Therefore, the question of whether anyone has any idea how it is possible that this automation does not work properly? Thanks a lot!

Automation:

- id: '1601146471040'
  alias: 'NOTI: Wasmachine'
  description: ''
  trigger:
  - platform: numeric_state
    for:
      hours: 0
      minutes: 1
      seconds: 0
    entity_id: sensor.wasmachine_power
    above: '12'
  - platform: numeric_state
    entity_id: sensor.wasmachine_power
    for:
      hours: 0
      minutes: 5
      seconds: 0
    below: '1'
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: input_boolean.status_wasmachine
        state: 'off'
      sequence:
      - choose:
        - conditions:
          - condition: zone
            entity_id: person.rene
            zone: zone.home
          - condition: time
            before: '22:00'
            after: 07:00
          sequence:
          - device_id: 922c3b64c927ecbbcbe905d462c48a06
            domain: mobile_app
            type: notify
            message: Wasmachine gestart
            title: Wasmachine
        default: []
      - choose:
        - conditions:
          - condition: zone
            entity_id: person.nina
            zone: zone.home
          - condition: time
            before: '22:00'
            after: 07:00
          sequence:
          - device_id: f9e41f86bfd438de94c80ac6a5edd3e1
            domain: mobile_app
            type: notify
            message: Wasmachine gestart
            title: Wasmachine
        default: []
      - service: input_boolean.turn_on
        target:
          entity_id: input_boolean.status_wasmachine
        data: {}
    - conditions:
      - condition: state
        entity_id: input_boolean.status_wasmachine
        state: 'on'
      sequence:
      - service: script.knipperen_staande_lamp
        data: {}
      - choose:
        - conditions:
          - condition: zone
            entity_id: person.rene
            zone: zone.home
          - condition: time
            before: '22:00'
            after: 07:00:00
          sequence:
          - service: script.1638020154100
            data: {}
        default: []
      - choose:
        - conditions:
          - condition: zone
            entity_id: person.nina
            zone: zone.home
          - condition: time
            before: '22:00'
            after: 07:00:00
          - condition: state
            entity_id: input_boolean.status_wasmachine
            state: 'on'
          sequence:
          - service: script.noti_notificatie_wasmachine_nina
            data: {}
        default: []
    default: []
  mode: single

I am only guessing here because we aren’t getting the full picture with the graphs but I think that the automation isn’t getting triggered by the “less than 1 watt” trigger but instead it’s getting triggered again by the “greater than 12 watts” trigger. That will happen when the power goes to ~3 watts and then back to ~70 watts again.

then because you already set the input boolean to on and are only using that as the test to see the previous state of the washer then when the automation gets triggered by the 12 watt trigger it runs the completed set of actions.

you can test it by splitting the automation into two automations and just forego the complicated choose functions. Or you can change the conditions for the outermost choose function and use trigger data itself or the washing machine power as the condition to decide which actions to take.

IOW, using the input_boolean is the issue and it’s not a false trigger.

Hello Finity,

Thanks a lot for your help!
Because of your tips the automation now works perfect!

I added a trigger ID and the power threshold to the conditions of the automation. And because of that the automation now works like I wanted it to.

I kept the choose functions so I don’t need separate automations. And nevertheless it works fine now.

Thanks!

1 Like