Can you ping a device with an action?

Presence detection is usually stable however occasionally it takes my devices a while to update their location as home.
I have an automation that sends me an ‘intruder alert’ when any of the house’s motion sensors are triggered and all devices are not_home. This creates multiple unwanted notifications when the device(s) do not update their location quickly.

So the questionis: is it possible to ping device(s) within an action - this way when the motion sensor is tripped I can first ping all devices for a status update and only if none of them are seen as home, run the intruder alert notification.

Depends on what you mean by “ping.” If you literally mean do an ICMP echo request using a command line ping command, then yes. You could do this, for example, by using the shell_command component. But if you mean get the HA device entities to update themselves, that’s another story.

You might be better off adding a minimum “not_home” time to the condition in your automation, like this:

condition:
  condition: state
  entity_id: group.all_devices
  state: 'not_home'
  for:
    minutes: 15

Of course, adjust the time period accordingly, making it long enough to avoid (most) false alarms, and short enough to avoid making the alert useless.