Automation triggers, but doesn't execute action

Executed: March 12, 2022, 11:39:32
Result:
params:
  domain: fan
  service: turn_off
  service_data: {}
  target:
    entity_id:
      - fan.fan1
running_script: false
limit: 10

What is going on ??

alias: Fan Timer
description: ''
trigger:
  - platform: state
    entity_id: fan.fan1
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 7
    from: 'off'
condition: []
action:
  - service: fan.turn_off
    data: {}
    target:
      entity_id: fan.fan1
mode: single

If I run the action manually, it works. It does trigger after 7 seconds. Also tested with 20 minutes…
It is a Xiaomi Air purifier.

After a restart it works… Could it be that a process (turn fan off) is frozen and has no timeout so the scene runs forever?

I am out of ideas…

What exactly do you mean by “manually”?

Because if you click an automation’s Run Action button, it skips the automation’s trigger and simply executes the automation’s action. You said “It does trigger after 7 seconds” so that can’t be the result of using Run Action because the trigger isn’t used.

Check the history to see if the outputs are indeed just On and Off.
And nothing like Unavailable or something else pops up.
If that’s the case your from: 'off' might be getting in the way since the state wouldn’t be off, but something else.

Not sure if you even need the from: 'off' since I assume you want it set up to only run 7 seconds regardless of how it’s turned on.
Personally I’d leave either the to or from state blank.

Yes exactly like this. Run actions and it works

After 7 seconds the trigger flashes blue. No action.

I have removed the from: just to be sure.

For now it works, but I had this configuration before… The restart helped in that case.

So…it is working or it’s not working?

It works for now. :grinning_face_with_smiling_eyes: