# Replace these entities with your own:
# - sensor.laundry_washing_machine_plug_power
# - binary_sensor.laundry_washing_machine_vibration
# - input_number.washer_running_power_threshold
# - input_boolean.washer_running
# - input_boolean.washer_finished
# - timer.washer_finish_delay
# - timer.washer_reminder_timer

alias: Laundry - Washer - Running Detection
description: >
  Marks the washing machine as running when power rises above the running
  threshold or vibration is detected.

mode: queued
max: 10

trigger:
  - platform: numeric_state
    entity_id: sensor.laundry_washing_machine_plug_power
    above: input_number.washer_running_power_threshold
    id: power_rose_above_running_threshold

  - platform: state
    entity_id: binary_sensor.laundry_washing_machine_vibration
    to: "on"
    id: vibration_detected

condition: []

action:
  - service: timer.cancel
    target:
      entity_id:
        - timer.washer_finish_delay
        - timer.washer_reminder_timer

  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.washer_running

  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.washer_finished