Automation trigger not at home

Hello,

I’m trying to set an Automation based on when my phone is not at home, however the property is “Unknown”.

- id: 'CustomID'
  alias: Door - Open
  description: 'Notify when Phone is not at home'
  mode: single
  trigger:
    - entity_id: binary_sensor.openclose_6
      from: 'off'
      platform: state
      to: 'on'
  condition:
    - condition: device
      device_id: ed6410f9ae736db02ad
      domain: device_tracker
      entity_id: device_tracker.in2023
      type: is_not_home
  action:
    - service: notify.notify_home_group
      data:
        message: Door has been detected open
        title: 'Door: Open'

Is there some way to set up such notifications based on my device availability on the network for example?

My setup is Home Assistant on a Docker Image

...
condition:
  - condition: state
    entity_id: device_tracker.in2023
    state: not_home
...

not_home

This is what I’ve tried in the beginning, however, checking the value of [device_tracker.in2023] is “Unknown”, it doesn’t change. Maybe I do miss some setting ?

Does the device allow gps updates?
Someone at my always clicked ‘do not allow’ when the device gave a warning that HA has been using the gps for a long time.
Once they click ‘do not allow’, it is impossible for HA to track the device.

As alternative some users switch to pinging a device on the local network….

I was reading about it on different posts, but I’ve granted all permissions and also don’t configured power saving for the HomeAssistant app on my phone.

How’s the configuration by pinging the device? do you have some example ?

EDIT: I found that the sensors need to be enabled by the App going to settings and Companion App, once enabled the Unique Location sensor then the sensor send the data to HomeAssistant, however since my HomeAssistant is only reachable within my network, once I leave the home the sensor doesn’t send any update and HomeAssistant is not chanching the sensor values to null / default

Open up port 8123 on your router ?

Try to find an example here on ha forum

  • phone needs to have a fixed IP (f.e. use dhcp reservation on router)
  • create a ping sensor for that IP