Feature Request: New Trigger for Changed (External) IP Address

Hi,

New/testing user of Keyboard Maestro here. So far, I like what I'm seeing.

I'm trying to convert other automations I've put into place over the years to Keyboard Maestro, perhaps this can be the all-in tool to handle everything.

One thing I was not able to find was a trigger for when an IP address changes, be it on a local interface or the one that the internet sees me using (behind NAT, firewall etc.)

Yes, I've seen hints how to get that external IP. But I'd need a trigger when that changed.

Is Stairways monitoring the forums? Or is there another way to ask for features?

Thanks
Simon

Peter Lewis (the dev) is on the forum, but he doesn't have time to read everything anymore.

There's a Wireless Network trigger, but I don't think the macOS broadcasts an event when the IP address changes – and that means no trigger for same.

@peternlewis?

If you don't absolutely require it to be a trigger, you could instead run a macro like this periodically to check the public IP address.

Public IP Test.kmmacros (3.5 KB)

2 Likes

Head on over to Mousedown Software and take a look at EventScripts, which does network change detection and more. You can fire off AppleScripts based on those events, and AppleScript can trigger KM macros.

You might be able to do something similar with KM's "Folder" triggers (or your own LaunchAgent and WatchPaths) looking for changes in resolv.conf, NetworkInterfaces.plist, com.apple.airport.preferences.plist (and maybe some others) but that'll take some research.

2 Likes

Keyboard Maestro does not have such a trigger. I'll note it down, but I'm not sure I'll add a trigger for it. Firstly, it would require some sort of event, but also I'm not sure about the utility or general usefulness of it.

Modern IP addresses on most Macs are dynamically allocated private IPs, so what it means to "change IP" is not entirely clear. Your Mac might change IPs when the DHCP lease is renewed (typically it won't) but that wont change your apparent IP to the rest of the world through NAT.

Or you might go from one location to another and still have the same private IP address, allocated by a different DHCP server.

1 Like

This forum is awesome!

Eventscripts (didn't want to mention foreign software out of the gate) is exactly what I've been using so far to trigger actions when the external IP (thus telling me where I am, office or home or....) changes. I added the interface IP just to keep the question generic, it's the whatsmyip

This means I'll keep both tools for the moment, but might tinker with some Eventscript triggered stuff in KM, nifty.

thanks a lot
simon

1 Like