What’s the best way that people have found to get their public IP address into Home Assistant? It’d be useful to run an automation to send a notification when it changes.
sensor:
- platform: dnsip
group: External IP: - sensor.dnsip
automation: alias: Notify when external ip changes initial_state: on trigger: platform: state entity_id: sensor.dnsip action: service: notify.YOU data_template: message: “New external IP address is {{ states(‘sensor.dnsip’) }}”
Here you go.
Source: https://community.home-assistant.io/t/display-public-ip-notify-of-change/74655
If your use case is to access your home assistant from external, I highly suggest cloudflare tunnels. https://community.home-assistant.io/t/new-add-on-cloudflared/361637/10
Maybe not the best way, but I set up a Node RED work flow to query the API at ip.me every few minutes for my v4 and v6 addresses, and update sensors in HA.