Hass.io Addon Dynamic IP Updater for Cloudflare

hassio-cloudflareipupdater

Dynamic IP Updater for Cloudflare in hass.io

Buy me a coffee

This Hass.io Addon

The objective is to provide a client to do dynamic dns updates in Cloudflare on behalf of your hass.io server. The configuration of this addon allows you to setup your Cloudflare domain to dynamically update whenever a change of your public IP address occurs.

Configuration

The available configuration options are as follows (this is filled in with some example data):

{
    "zone": "yourdomain.com",
    "host": "sub.yourdomain.com",
    "email": "[email protected]",
    "api": "yourAPIkeyFromCloudflare"
}

Installation

To use this repository with your own Hass.io installation please follow the official instructions on the Home Assistant website with the following URL:

https://github.com/davidramosweb/hassio-addons

You should add this in your automations.yaml:

- id: cloudflare-updater
  alias: "IP Cloudflare Updater"
  trigger:
  - platform: time_pattern
    # This will match every 1 minutes
    minutes: '/1'
  action:
  - service: hassio.addon_restart
    data:
      addon: local_hassio_cloudflareipupdater
2 Likes

How to install ?

Cool.
How is the syntax for multiple hosts?

Hi, you can install it like a repository following the the official instructions on the Home Assistant website with the following URL:

https://github.com/davidramosweb/hassio-addons

Hi,
Why do you need to update multiple hosts?
This you can do from Cloudflare by adding a CNAME to the domain updated by the add-on.

Because of my lack of insight that had led me to set everything as A-records instead of CNAME…
Standing corrected, I know see why this is not necessary…

Since you found it worth using the efforts to make this Addon as an alternative to using the CloudFlare component in Hass - could you elaborate what advantages this addon gives (apart from the interval used for checking the IP-address)?
Just out of curiousity :wink:

Regards,
Chr.

This one appears to work at least. The Hassio default version just fails for me.

1 Like

I get an error in the log regarding invalid request headers
Any ideas?

Hi

I have the invalid headers request too.

Not sure if its because of something I have set up at this side on HA or the Cloudflare. A screen shot or info on Cloudflare set up might help also.

I also found that the Zone also has an ID but the instructions say type the name in of the domain

Are you using the global (CloudFlare account-wide one) API key? I don’t think it works with the ones restricted to a specific zone.

I have exactly the same issue, put all into A name, but how to put in CNAME? Sorry newb here. Could you post your clouflare screenshot (hiding your data of course)

this mine, of course I added more A for having more subdomain, but then only one is updated fron the addon

Sorry for the late replay, @Klagio

This is how my config on cloudflare looks like (in principle, of course, names and numbers are changed):

Hi All,

I was able to install the addon and while starting it gives the following error;

Btw I have registered mydomain with a .tk website

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Current time: 2020-08-15 22:20:14
IP: X.X.X.X
Zone mydomain.tk id : myid
Updating record e3823338687963658b29ea84ba52810e for host mydomain.tk
jq: error (at <stdin>:3): Cannot iterate over null (null)
Error: 
[cmd] /cloudflare.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I was able to add a new domain (mydomain.live) which now works with Cloudflare IP Updater following the same steps so there is a problem with .tk websites which dont support the cloudflare API or something. Anyways I now have a new issue where Cloudflare IP updater would be able to be started, it will check for the ip and if different is able to update it without issues. However it will then turn off? For some reason it doesnt want to stay running

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Current time: 2020-08-24 19:49:31
IP: mypublicIP
Zone mydomain.live id : myid
Updating record 82415848bc1acf891d7df217fe3ccfea for host mydomain.live
IP changed to: mypublicIP
Current time: 2020-08-24 19:54:37
IP is unchanged : mypublicIP Exiting.
[cmd] /cloudflare.sh exited 0
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Hello,

I’m looking for a way to use the updater to updated the AAAA record with the IPV6. Checking in the code I’ve seen that it already reacts to an $IPV6 variable, but this variable is not set defined on the JSON config file.

How am I supposed to enable it?

Thanks!

1 Like

I had the same issue.
You have to use the Global API Key the DNS Zone token is not working.

Hi All

I need some advise with the addon. I installed it and received the following error on when i try to start it - s6-overlay-suexec: fatal: can only run as pid 1

did you manage?

Solution is this

but don’t know how to fix it

did you manage to fix this?
i’m running into the same problem and I don’t know how to fix it.

Also want to use this addon but i’m not able to start it. Same error as mentioned above

s6-overlay-suexec: fatal: can only run as pid 1