'for' period in condition not respected

I have the following automation:

trigger:
  - platform: state
    entity_id:
      - person.catherine
    from: home
    for:
      hours: 0
      minutes: 15
      seconds: 0
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: person.stephan
        state: home
        for:
          hours: 1
          minutes: 0
          seconds: 0

The problem is that I was travelling with her, so my non-home time is a maximum of 15 min also. This automation did get triggered and the action was executed. This was created in the UI and would have expected that it would work as you can set a ‘for’ period in the condition entry.

The trace shows:
image

While my away time started at:
image

So my away time was 18 minutes, while the automation should check if I was away for at least 1 hour.

Should I raise this as a bug or is there something wrong with my automation?

The condition you created does this:

  1. Has Stephan been home for at least an hour?
  2. Whatever is the answer to the question, it reports the opposite response (due to the not).

Example:
If you were not home for 18 minutes the answer to the question is ‘No’ (false) and then it reports the opposite ‘Yes’ (true) and then, because it’s true, proceeds to execute the action.

ah yeah, guess my brain wasn’t working properly when I created the automation :slight_smile: Will remote the ‘not’ part of it.

Thanks for pointing it out, I kept looking at it and couldn’t see what was wrong with it.

1 Like