Device tracker with the Companion App automation issues

Device tracker - Companion App with the enabled location sensors.

The problem that I am experiencing in my automation is the following:

The condition which checks the state (home, away) of the entity device_tracker.sm_s916u works only when “For” is set to 0. As soon as I set it to, e.g. 2 min, the condition test fails.

I have checked the entity history and it contains the correct information.

Tested the same logic with some of my switches and it worked fine.

Post the automation and/or the trace from an instance when it failed.

This is just a simple test automation:

alias: Tracker-test
description: ""
trigger:
  - platform: time_pattern
    minutes: /6
    id: time-pat
condition: []
action:
  - if: []
    then:
      - delay:
          hours: 0
          minutes: 2
          seconds: 0
          milliseconds: 0
      - condition: state
        for:
          hours: 0
          minutes: 2
          seconds: 0
        entity_id: device_tracker.sm_s916u
        state: not_home
      - service: notify.pushover
        metadata: {}
        data:
          message: Away for 2 min
mode: single

Trace:

{
  "trace": {
    "last_step": "action/0/then/1/entity_id/0",
    "run_id": "7131fb05a61a372cb548f5d26438ed14",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2024-04-25T13:18:00.205574+00:00",
      "finish": "2024-04-25T13:20:00.210751+00:00"
    },
    "domain": "automation",
    "item_id": "1713824912189",
    "trigger": "time pattern",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2024-04-25T13:18:00.206027+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.new_automation",
              "state": "on",
              "attributes": {
                "id": "1713824912189",
                "last_triggered": "2024-04-25T13:12:00.205471+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Tracker-test"
              },
              "last_changed": "2024-04-25T12:52:56.333558+00:00",
              "last_reported": "2024-04-25T13:14:00.479092+00:00",
              "last_updated": "2024-04-25T13:14:00.479092+00:00",
              "context": {
                "id": "01HWAP8DWZE8FEP6GR2TNYTA4N",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "time-pat",
              "idx": "0",
              "alias": null,
              "platform": "time_pattern",
              "now": "2024-04-25T09:18:00.205357-04:00",
              "description": "time pattern"
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-04-25T13:18:00.207023+00:00",
          "changed_variables": {
            "context": {
              "id": "01HWAPFR0DF72REKZJVPG4P32Y",
              "parent_id": null,
              "user_id": null
            }
          },
          "result": {
            "choice": "then"
          }
        }
      ],
      "action/0/if": [
        {
          "path": "action/0/if",
          "timestamp": "2024-04-25T13:18:00.207208+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "action/0/then/0": [
        {
          "path": "action/0/then/0",
          "timestamp": "2024-04-25T13:18:00.207523+00:00",
          "result": {
            "delay": 120,
            "done": true
          }
        }
      ],
      "action/0/then/1": [
        {
          "path": "action/0/then/1",
          "timestamp": "2024-04-25T13:20:00.209346+00:00",
          "result": {
            "result": false
          }
        }
      ],
      "action/0/then/1/entity_id/0": [
        {
          "path": "action/0/then/1/entity_id/0",
          "timestamp": "2024-04-25T13:20:00.209411+00:00",
          "result": {
            "result": false,
            "state": "not_home",
            "duration": "2024-04-25T13:18:00.209528+00:00"
          }
        }
      ]
    },
    "config": {
      "id": "1713824912189",
      "alias": "Tracker-test",
      "description": "",
      "trigger": [
        {
          "platform": "time_pattern",
          "minutes": "/6",
          "id": "time-pat"
        }
      ],
      "condition": [],
      "action": [
        {
          "if": [],
          "then": [
            {
              "delay": {
                "hours": 0,
                "minutes": 2,
                "seconds": 0,
                "milliseconds": 0
              }
            },
            {
              "condition": "state",
              "for": {
                "hours": 0,
                "minutes": 2,
                "seconds": 0
              },
              "entity_id": "device_tracker.sm_s916u",
              "state": "not_home"
            },
            {
              "service": "notify.pushover",
              "metadata": {},
              "data": {
                "message": "Away for 2 min"
              }
            }
          ]
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01HWAPFR0DF72REKZJVPG4P32Y",
      "parent_id": null,
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Tracker-test",
      "message": "triggered by time pattern",
      "source": "time pattern",
      "entity_id": "automation.new_automation",
      "context_id": "01HWAPFR0DF72REKZJVPG4P32Y",
      "when": 1714051080.2061899,
      "domain": "automation"
    }
  ]
}

History:

entity_id	            state	                last_changed
device_tracker.sm_s916u	not_home	2024-04-25T12:00:00.000Z
device_tracker.sm_s916u	home	       2024-04-25T13:28:06.591Z
device_tracker.sm_s916u	not_home	2024-04-25T13:28:30.473Z
device_tracker.sm_s916u	home	       2024-04-25T13:33:04.173Z