# Monitor external ip and warn ik changed

**URL:** <https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781>\
**Category:** Questions & Help\
**Created:** [October 2, 2023, 4:35pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781 "2023-10-02T16:35:00Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 10, 2023, 5:10pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/22 "2023-10-10T17:10:26Z")

</div>

I updated the script last week.  
And I thought “I’m getting the wrong IP address” meant as “I’m getting an IP from something elsewhere” 🤪.  
Appearantly you just missed a few numbers.

This one should return any IP:

> [@Peter\_Kawa](#):
>
> A little improvement.  
> While the filter `slice(2, 15)` is not flexible, I found a way to ensure the IP only is returned, no matter the number of digits
> 
> ```auto
> var response = args[0];
> // A) while the - symbol is (while the returned data doesn't change)
> // the first one, and close to the actual IP address,
> // we select the string following the - symbol. 
> // B) when the IP has less than 12 digits, remove trailing HTML code "</"
> var myIP = '' + response.split("-")[1].slice(2).split("<")[0];
> 
> console.log('args: ', args[0]);
> 
> return myIP;
> 
> ```

---

<div class="post-metadata">

**Author:** ![HIGHWOOD](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/highwood/32/24583_2.png) [@HIGHWOOD](https://community.homey.app/u/HIGHWOOD)\
**Post date:** [October 11, 2023, 8:08am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/23 "2023-10-11T08:08:45Z")

</div>

This is what I have:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/e/ee0598bdf502d6db16bc5a0af1ed4a0e3495b82e.png)

I changed it back to:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/6/a61043dd628cfdfbcafc2013daf205bc85183281.png)

It doesn’t change the result:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/8/082f1e2175c81d6a1ed9260e9cda994839968da0.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 11, 2023, 2:07pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/24 "2023-10-11T14:07:31Z")

</div>

The last screenshot is the output of the HTTP GET trigger, [Result]  
So, you’ll need the output of the Homeyscript card in the timeline notification card, which is [_Response_]  
I hope this does the trick.

I recommend using the first script in your post.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 11, 2023, 2:41pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/25 "2023-10-11T14:41:45Z")

</div>

Instead of using a brittle method like parsing an HTML page you can also use [any of the dozens of available API’s](https://www.google.com/search?q=my+ip+json) that provide your IP-address in JSON format:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/9/69a345db6bbeeb85a4384a5a2b25eec40d0f5d70.png)

---

<div class="post-metadata">

**Author:** ![HIGHWOOD](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/highwood/32/24583_2.png) [@HIGHWOOD](https://community.homey.app/u/HIGHWOOD)\
**Post date:** [October 16, 2023, 3:34pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/26 "2023-10-16T15:34:37Z")

</div>

It seems to work now, thanks everybody for helping!

---

<div class="post-metadata">

**Author:** ![thobu](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thobu/32/18357_2.png) [@thobu](https://community.homey.app/u/thobu)\
**Post date:** [September 30, 2024, 2:19pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/27 "2024-09-30T14:19:35Z")

</div>

that’s what I was looking for for some. I can now update Duck DNS automatically. Thanks.

[Previous page](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781.md?page=1)
