# 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:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 2, 2023, 4:35pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/1 "2023-10-02T16:35:00Z")

</div>

Somehow I fell this was asked before…can’t find the topic.

If my external ip changes, I have to make changes in my NAS and in the DNS settings of my internet hosting section.

Is it possible to store the current op address in a variable so it can be monitored and checked?

Thanks!

---

<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 3, 2023, 1:11am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/2 "2023-10-03T01:11:56Z")

</div>

This can do the trick (“watismijnip” is whatismyip in English by the way)  
You only have to figure out how to filter the IP address from the HTML info 😉

 ![Ipaddress](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/8/8853ec674f003f9ad171006529ca4eef81ed48aa.jpeg)

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 3, 2023, 7:24am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/3 "2023-10-03T07:24:01Z")

</div>

Thanks @Peter_Kawa !  
Thats a start!

Tried to create that flow, but can’t seem to get that tag to show up (‘response’):

 ![Schermafbeelding 2023-10-03 om 13.05.38](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/b/ebb4dd6ddc84c67328820fc9ccddfbf3d579cd4f.jpeg)

I saved the flow. Ran it a couple of times, but the ‘response’ tag is still not shown. Is that created manually as a variable?

Tried that too, both as a text and number variable, but the ‘value’ doesn’t change:

 ![Schermafbeelding 2023-10-03 om 13.11.15](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/0/c034b796af049c96eacf237a4775ff3b3a317a70.png)  
 ![Schermafbeelding 2023-10-03 om 13.12.12](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/4/d4a30621c0282062b3ee4ede4cbbcc24b1567d00.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 3, 2023, 8:18pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/4 "2023-10-03T20:18:46Z")

</div>

YW!

Yeah, how would you know… You seem to have used the card _for standard flows_. There’s a ‘twin’ one, _for advanced flows_, which has a **tag** symbol in it, next to the card’s name. Which means, it provides for local tags in flows.

![Screenshot from 2023-10-03 22-15-06](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/6/664c242e958d89dd46c50e49514f987e26a77021.png)

So there’s an ‘twin’ card purely for adv. flows, because they didn’t want to break existing standard flows I assume.

---

<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 4, 2023, 2:03am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/5 "2023-10-04T02:03:11Z")

</div>

Hi Ernst,

I couldn’t let it go 🥴 🤣, finally I found a way to filter out the IP, and now we can send a warning when it has changed!

 ![Screenshot from 2023-10-04 03-54-35](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/4/94e98c7e0302d51084054dbe953237d8e431a045.png)

View of the Homeyscript card with the script, and the [Response] tag from the Logics HTTP GET flow card in the argument field on top:

 ![Screenshot from 2023-10-04 03-55-15](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/b/3b272099a69e2abc650fafa21fdee096a7dce5bf.png)

The script (note: it will fail as soon as the webpage is changed somehow. Then the filter will have to be adjusted again):  
_change ‘2, 15’ into ‘2, 17’ for IP addresses like xxx.xxx.xxx.xxx (mine is xx.xxx.xxx.xx atm)_

```auto
var response = args[0];
var myIP = '' + response.split("-")[1].slice(2, 15);
return myIP;

```

Just for fun:  
When you use Better logic variable cards, you can display the IP on an Advanced virtual device like this (without flows):  
 ![Screenshot from 2023-10-04 03-31-40](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/a/ba2438798e106f2d2d867422fbdc1d47351dd108.png)

![Screenshot from 2023-10-04 04-02-14](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/7/07f545c364e9c98c07aaca76c57e09c75e648325.png)

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 4, 2023, 5:16am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/6 "2023-10-04T05:16:36Z")

</div>

Haha, I recognise your need to solve things! Bugs you and needs to be solved…

Great help! I will try to get it to work later today.

Thanks again!!

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 4, 2023, 10:13am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/7 "2023-10-04T10:13:35Z")

</div>

Getting there, need a little help… 🙃

Created/copied your flow:

 ![Schermafbeelding 2023-10-04 om 12.13.53](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/e/0e8369aea12520d9c4d54a3f332872f2de1c3ca4.jpeg)

but the script returns an error. I do see the ‘response’ (called ‘antwoord’ in my case) with the html code and my IP address. So the URL is correct (it is different from your example)

The script I entered is:

 ![Schermafbeelding 2023-10-04 om 12.11.11](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/c/7c50dddaa26943b5d7ef3e6d8e1f05fca793282b.png)

Could it be the English to Dutch translation??

 ![Schermafbeelding 2023-10-04 om 12.16.12](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/e/4e96dd3a2ebe8caa4c71442fd755c3f2a559ea11.jpeg)

![Schermafbeelding 2023-10-04 om 12.16.05](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/f/6fde2d2efd86a4c34595470e9bd9c96778d2b976.png)

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [October 4, 2023, 10:40am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/8 "2023-10-04T10:40:24Z")

</div>

Your first console.log is missing a comma ( , ) between your string and variable.

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 4, 2023, 11:01am UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/9 "2023-10-04T11:01:37Z")

</div>

Thank you!

4 decades ago I had to write stuff in Pascal and it wouldn’t compile. Checked the code over and over again. Only thing I missed was the . at the end. It had ‘end’ but it should have been 'end."

It is working now!

---

<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 4, 2023, 2:46pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/10 "2023-10-04T14:46:21Z")

</div>

Update:  
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;

```

* * *

> [@Eternity](#):
>
> Only thing I missed was the . at the end

So recognizable 😜 I don’t know how many days I’ve spend in total to find out about a missing `}``.``)` or the like. My urge to get it working helps, but oh I have given up on many scripts as well 🤣

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 4, 2023, 3:20pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/11 "2023-10-04T15:20:49Z")

</div>

Script and flows are working nicely!  
Cool!

Thanks again for the solution @Peter_Kawa

---

<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 4, 2023, 3:34pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/12 "2023-10-04T15:34:33Z")

</div>

Thank you as well, as I liked to have this IP check as well, but you just made me do it 😜 🤣

---

<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 9, 2023, 2:37pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/13 "2023-10-09T14:37:54Z")

</div>

I’m getting the wrong IP address when I test the flow. I think I have two things wrong:

1. The ANY part of starting the flow?
2. I only have a GET logic, I cannot find a specific HTTP GET logic card. Is there a difference?

Thanks for any help!

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/5/9574bef780bd23e339922ac77d3530f818c227dd.png)

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 9, 2023, 4:19pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/14 "2023-10-09T16:19:55Z")

</div>

Remove that card and test the flow from the card above that one. Does that give the correct ip?

And, have you installed Homey script App?

 ![1000062612](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/f/bf93e4f73dfe29b5827a48b3a15018a9f328ebf1.jpeg)

(Not sure if it is needed. I have it installed)

---

<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 9, 2023, 6:11pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/15 "2023-10-09T18:11:16Z")

</div>

Indeed the HomeyScript app is needed, due to the HomeyScript flowcard + code to filter out the IP.

1. Also the 1. card is not needed. You can trigger the flow just how you’d like it. The time trigger seems a logical choice to me 😉
2. The logics GET request card = HTTP GET request. It’s the right card.

To check if your IP is determined correctly:  
When you add the green [Result] tag to a timeline card, it returns the complete web page in HTML, where your IP should be somewhere between `<title>` and `</title>`  
(it should be present somewhere in the first 20 lines or so)

---

<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 10, 2023, 12:47pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/17 "2023-10-10T12:47:05Z")

</div>

> [@HIGHWOOD](#):
>
> I Removed the card [1]. And yes, I have Homey Scripts installed. But I still get the wrong IP.

I Removed the card [1]. And yes, I have Homey Scripts installed. But I still get the wrong IP.

---

<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 10, 2023, 12:52pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/18 "2023-10-10T12:52:43Z")

</div>

I’ve removed the [1] card, the time trigger is still there. I added the green [Result] tag to a timeline card, but it doesn’t change the wrong IP.

---

<div class="post-metadata">

**Author:** ![Eternity](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eternity/32/102113_2.png) [@Eternity](https://community.homey.app/u/Eternity)\
**Post date:** [October 10, 2023, 1:06pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/19 "2023-10-10T13:06:22Z")

</div>

Test run the flow and than hover your mouse over the tags. Do you see the web page contents?

---

<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 10, 2023, 2:59pm UTC](https://community.homey.app/t/monitor-external-ip-and-warn-ik-changed/90781/20 "2023-10-10T14:59:50Z")

</div>

Yes, this is the code:

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

---

<div class="post-metadata">

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

</div>

Well, that is promising!

I guess you have to fiddle with the code to extract the ip correctly. My ip starts with two digits, not 1.

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