DuckDNS automatic IP and IPV4 config

Hi,

I am quite certain I am facing a unique “issue” but I’d like to apologise if that is not the case and that the answer had been previously provided.

I am trying to configure DuckDNS following the excellent youtube tutorial by Lewis from Everything Smart Home and I’ve got it working… sort of…

The issue I have is that I seem to have two external IP (this could be because I am using a “booster” that uses the 5G network in conjunction with the good ol’ copper lines) and it seems that DuckDNS is retrieving the “wrong” IP, i.e., not the one that my main router has (my main router being the one that forwards the port).
If I specify the “correct” IP address explicitly in the configuration of DuckDNS then everything works fine and I can use my duckdns domain to access my instance but of course I am not immune to an IP change by my provider and I’d like this to be covered.

Unfortunately, the two services suggested in the DuckDNS Documentation also resolve to the “wrong” IP address and thus I cannot use these either in the configuration.

I have hope though as I found that a dnsip sensor (setup in my configuration.yaml) and the service here https://api.myip.com/ resolve to the correct IP.
The “only” issue remaining is that I do not know how to use the sensor state in the DuckDNS configuration or how to parse the JSON from https://api.myip.com/ which is of this shape:

{"ip":"XXX.XXX.XXX.XXX","country":"Switzerland","cc":"CH"}

Any help would be greatly appreciated.

Many thanks

PS: this is my working DuckDNS configuration with hardcoded IP.

aliases: []
domains:
  - xxx.duckdns.org
lets_encrypt:
  accept_terms: true
  algo: secp384r1
  certfile: fullchain.pem
  keyfile: privkey.pem
seconds: 300
token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
ipv4: XXX.XXX.XXX.XXX

I have a similar issue with my satellite setup.
My WAN here has one IP but the services like api.myip.com return the address the provider sends.
We loose satellite connection often enough that it changes almost weekly so hard coding isn’t a good solution for me.
I was going to create a local web service to return the WAN IP of my router as a solution but thought I would see if I just added my router sensor from HA as a parm to the ip4: tag, and so far that seems to be working.

ipv4: sensor.archer_c5400x_external_ip

Have you found a solution to this? I’m having the same problem. I’m trying to find ways to disable the auto-detection and have it stick to my home assistant instance ip. It keeps updating to my public ip.

I foud a “solution”… My router is able to not forward the IP of the booster to a selected list of IP… therefore what I did was to stop forwarding that IP to my home assistant and that worked…

It’s by far not ideal because it means that my HA cannot benefit from boosted connection but hey, that’s what I have