# \[How To\] Use HomeyScript to update your free hostname at No-IP.com

**URL:** <https://community.homey.app/t/how-to-use-homeyscript-to-update-your-free-hostname-at-no-ip-com/108667>\
**Category:** Tutorials\
**Tags:** homeyscript, flow, javascript, homey-pro\
**Created:** [April 22, 2024, 6:21pm UTC](https://community.homey.app/t/how-to-use-homeyscript-to-update-your-free-hostname-at-no-ip-com/108667 "2024-04-22T18:21:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esset](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/esset/32/39038_2.png) [@Esset](https://community.homey.app/u/Esset)\
**Post date:** [April 22, 2024, 6:21pm UTC](https://community.homey.app/t/how-to-use-homeyscript-to-update-your-free-hostname-at-no-ip-com/108667/1 "2024-04-22T18:21:09Z")

</div>

Are you also sick of the e-mails from [no-ip.com](http://no-ip.com) every 4th week to renew your free hostname?  
There is a simple script you can make and then run however you want from a flow.

**Requierments**  
[HomeyScript App for Homey | Homey](https://homey.app/en-us/app/com.athom.homeyscript/HomeyScript/)

**Steps**

1. Install linked app above
2. visit [https://my.homey.app/](https://my.homey.app/) from your computer
3. Click on HomeyScript icon to the left (highlighted in blue)  
 ![homey-script](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/1/210dec89bb713b27f42fde05ec4ca85728d2b256.jpeg)
4. Click on “+ New HomeyScript”  
 ![New](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/3/83d433196f0b5498772c2e71775a4e0f09c36f90.jpeg)
5. Name the script to your liking
6. Paste this code:

```auto
const username = 'your_noip_username';
const password = 'your_noip_password';
const hostname = 'your_noip_hostname';

// Base64 encoding function
function base64encode(str) {
    return Buffer.from(str).toString('base64');
}

function updateDDNS() {
    const url = `https://dynupdate.no-ip.com/nic/update?hostname=${hostname}`;
    const auth = 'Basic ' + base64encode(username + ':' + password);

    fetch(url, {
        method: 'GET',
        headers: {
            'Authorization': auth
        }
    })
    .then(response => {
        console.log(`statusCode: ${response.status}`);
        return response.text();
    })
    .then(data => {
        console.log('response:', data);
    })
    .catch(error => {
        console.error('Error:', error);
    });
}

// Call the function to update DDNS
updateDDNS();

```

1. Replace `'your_noip_username'` , `'your_noip_password'` , and `'your_noip_hostname'` with your actual No-IP credentials and hostname.
2. Save the script and test. You can log in to [no-ip.com](http://no-ip.com) and check when your last renewal was, it should be the same timestamp as you ran the script test.
3. Create a flow to runt the script as you like, I set up mine to run every two weeks:  
 ![flow](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/4/e4edf1fd57553bd13dfc370f21438b9cd51e865d.jpeg)

This can be combined with other flows or advanced flows to runt when your external IP change or similar.

Hope this will help somebody 🙂

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [April 22, 2024, 8:31pm UTC](https://community.homey.app/t/how-to-use-homeyscript-to-update-your-free-hostname-at-no-ip-com/108667/2 "2024-04-22T20:31:16Z")

</div>

Very interesting 👍

---

<div class="post-metadata">

**Author:** ![Asterix](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/asterix/32/45768_2.png) [@Asterix](https://community.homey.app/u/Asterix)\
**Post date:** [April 23, 2024, 4:03pm UTC](https://community.homey.app/t/how-to-use-homeyscript-to-update-your-free-hostname-at-no-ip-com/108667/3 "2024-04-23T16:03:48Z")

</div>

Thank you very much👍🏼

---

<div class="post-metadata">

**Author:** ![Pee](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/pee/32/82880_2.png) [@Pee](https://community.homey.app/u/Pee)\
**Post date:** [December 8, 2024, 8:47am UTC](https://community.homey.app/t/how-to-use-homeyscript-to-update-your-free-hostname-at-no-ip-com/108667/4 "2024-12-08T08:47:22Z")

</div>

It only updates my IP-adress at no-ip-com but not pevent the every 4th week mails.
