Hello, I would like to have a card that shows my current public IP address. I would also like it to send a pushover notification when it changes, and what the new IP is.
I do not want to use a DDNS service, hoping there is a way to directly integrate it.
Thanks! I was also looking for an option to show my public IP. The sensor option works verry well for this.
But what I don’t understand, you have also mentioned the “group” config, what does it do?
Because I’m already able to show the public IP with a sensor card in lovelace with only the Sensor config.
I’m just trying to understand were the group config is for and what it does
Thanks already!
There has some changes in HA now it’s not calles dnsip it generates myip instead
sensor:
- platform: myip
automation:
alias: Notify when external ip changes
initial_state: on
trigger:
platform: state
entity_id: sensor.myip
action:
service: notify.YOU
data_template:
message: "New external IP address is {{ states('sensor.myip') }}"
Will that really work?
When the IP changes the phones connection to HA is lost and therefore this message wont be received?
Or is there something I’m not understanding here?
You could Email the new IP but using notifications won’t work (at least when you are not home)
stupid question but where do you paste this in? configuration.yaml or automations.yaml? Thanks
I am getting a duplicate key error when I paste into configuration.yaml
group: !include groups.yaml
automation: !include automations.yaml #i get a duplicate key error here
I have a similar issue where DNS IP won’t work and that is if my DDNS update has failed and I got a new IP address from my ISP. In that case, asking a DNS is futile. I would recommend this instead:
Like many others, I could not get the DNSIP integration to work with the default myip.opendns.com config and had to resort to using YOUR_SUBDOMAIN.duckdns.org
But while this worked, I think relying on a DNS resolver could potentially cause problems or delays with a dynamic IP address, so I think the RESTful integration external IP sensor will be more reliable since it gets the IP address directly, no need to wait for any DNS propagation or update.
So just add this to configuration.yaml and remember a full HA restart is required, not just a YAML reload:
Note that the default scan_interval for the RESTful sensor is 30 seconds which seems excessive and would put unnecessary load on the jsontest.com servers who are kindly offering this public service, hence why I changed it to 5 minutes.
Now, to do something useful with the Extenal IP address I’ve created an automation to send a notification and to force an update for DuckDNS:
alias: IP Change
trigger:
- platform: state
entity_id:
- sensor.external_ip
condition: []
action:
# Updated the IP address for DuckDNS
- service: rest_command.duckdns_update
data: {}
# Send a notification to all mobile devices
- service: notify.all_devices
metadata: {}
data:
message: New external IP address is {{ states('sensor.external_ip') }}
data:
actions:
- action: URI
title: Check external access works
uri: https://YOUR_SUBDOMAIN.duckdns.org
importance: high
ledColor: red
mode: single
Just as an FYI, if you have both IPv4 and IPv6, the ip.jsontest.com may flip flop between the two in the result, as it supports both. Which could cause false positives to there being a change. So it may receive one or the other. So if you have email notifications setup when there is a change, you’ll start getting tons of emails everyday.