Trigger on not at home, at home is triggered after rebooting the router

Good day
I have a trigger that works when my phone appears on the Wifi network (Mikrotik integration).

    - platform: state # are we at home
      entity_id: group.g_in_home
      from: "not_home"
      to: 'home'

The problem is that this automation is triggered when the Mikrotik router reboots (the watchdog is configured in the event of a loss of the Internet).
What condition can be added to avoid this problem?

You’d need to monitor the state of the router, and only run the automation if it’s been on for at least (say) 5 minutes.

A simple ping or nmap tracker integration may cover that. Then you can add a condition like:

- condition: state
  entity_id: device_tracker.your_router_entity
  state: 'home'
  for: '00:05:00'

thank you very much. I just couldn’t figure out how to get uptime router