How to define a condition, where a state did not happen for a specific duration?

I would like to use write an automation that uses a not-condition including a state-condition with a specific duration. This is not working. Home Assistant is always claiming that the not-condition would be true.

Here is a example:

alias: test-oral-b
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.io_series_7_8_53f9_toothbrush_state
    from: charging
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.io_series_7_8_53f9_toothbrush_state
        state: running
        for:
          hours: 20
          minutes: 0
          seconds: 0
action:
  - service: notify.alexa_media_echo_og_bad
    data:
      message: Example sentence.
mode: single

I am aware that I could solve the problem with the help of a toggle-helper controlled by another automation. But I am writing a more complex automation that later is planned to become a blueprint a want to publish. I don’t want the users of my blueprint to add helpers be themself. That could be a showstopper for less experienced users.

I could also solve this problem with using the state-condition in a way that doesn’t require a negation. But this wouldn’t work in my use case because the device in question can have more than just two states and I am looking for a condition were a specific state didn’t happen for a given duration.

Another solution would be, if I could use a and-condition combining all possible states but the one in question. But then I have the problem that Home Assistant doesn’t seem to have the option to give a combined duration time for all state-conditions inside a and-condition.

Is this maybe an already known bug/limitation of Home Assistant?
Is there a way to solve this problem?

It’s certainly not a bug, but it’s outside the scope of what’s possible in the way you’re doing it due to what’s stored in the State object.

I’d create a trigger-based template sensor that triggers when your toothbrush changes from running to something else and records the current time in its state. Then use that in your condition.

Thank you very much for the quick answer. I would like to avoid the creation of a trigger-based template sensor, since my final goal is the creation of a blueprint.

In the history of the sensor I can see all the changes of the state. Is there a way to access this information directly for a condition?

No. These is the closest you can get, but all will require an additional sensor. Happy to be proven wrong, but I don’t think I will be.