Problem with namecheapdns

Is anyone using the namecheapdns component?

I copied and pasted the config and filled in my details - but the only result I get is:

2017-11-21 21:23:03 ERROR (MainThread) [homeassistant.setup] Setup failed for namecheapdns: Component failed to initialize.

Thanks,
Daniel

Yes - I am also getting this on Hass.io 0.61.1

Can anyone assist with this?

Adding the A record under the host seems to resolve

namecheapdns:
host: A_record_to_update
domain: example.com
password: XXXXXXXXXXXXXXXXXXX

That error is fairly generic for any time the dynamic DNS call fails. Make sure Dynamic DNS is working correctly with Namecheap before troubleshooting your HA configuration.

Follow the instructions on How do I use a browser to dynamically update the hostā€™s IP? to verify you have Dynamic DNS setup property with Namecheap. If it is not working then follow the instructions on How do I set up a Host for Dynamic DNS?

TLDR: Update manually with below URL to check the error from Namecheap.

In case anyone wonders how to find out whatā€™s actually broken. I checked their docs and you can update the record by a HTTP call (Iā€™m pretty sure this is what the integration does), which will give you detailed info if it fails.

https://dynamicdns.park-your-domain.com/update?host=@&domain=yourdomain.com&password=YOURPASS123&ip=YOURIP

Check the host part! In my case this was set to the subdomain (as stated in the docs), but I manage my subdomain with CNAME. This means the A record referenced @ but I had set my subdomain in the config as host.

So I had to remove the host, even if I use a subdomain.

namecheapdns:
  # host: mysub 
  domain: example.com
  password: something

Your case could be different, just try to update it with above URL and check for its response. Good luck!

Sorry to revive a very old thread, but can I specify host as wildcard to just update all my records to the same ip? I basically want my Pi to make sure anything.domain.tld point to the same IP, then will sue nginx and sni to direct to the right place.

I am doing something similar with a script, I update a number of subdomains using a script, here is the template. You also need to install the DNS IP integration to fetch the public IP

/config/rest_command.yaml

namecheap_ddns:
  url: "{{ namecheap_ddns_url }}"
  method: get
  verify_ssl: false

/config/scripts.yaml

alias: Namecheap
sequence:
  - variables:
      namecheap_host: "{{ subdomain }}"
      namecheap_domain: insertyourdomainhere.com
      namecheap_password: insertyyournamecheapkeyhere
      namecheap_url: https://dynamicdns.park-your-domain.com/update?host={{namecheap_host}}&domain={{namecheap_domain}}&password={{namecheap_password}}&ip={{states('sensor.myip')}}
  - service: rest_command.namecheap_ddns
    data:
      namecheap_ddns_url: '{{ namecheap_url }}'
mode: single

/config/automations.yaml

alias: Network - Namecheap DDNS
description: ''
trigger:
  - platform: time_pattern
    hours: /1
condition: []
action:
  - service: script.namecheap_ddns
    data:
      subdomain: '@'
  - delay:
      seconds: 1
  - service: script.namecheap
    data:
      subdomain: www
  - delay:
      seconds: 1
  - service: script.namecheap
    data:
      subdomain: subdomain1
  - delay:
      seconds: 1
  - service: script.namecheap
    data:
      subdomain: subdomain2
  - delay:
      seconds: 1
  - service: script.namecheap
    data:
      subdomain: subdomain3
  - delay:
      seconds: 1
mode: single

Could I ask for just a little more info on how you update multiple subdomains with this example?

Do you put multiple hosts in the script, or create multiple scripts?

I havenā€™t been able to get this to work yet.

Single script using an automation with a time trigger. Iā€™ve included an example of the automation above for reference.

1 Like

Multiple host updates was actually in an abandoned https://github.com/home-assistant/core/pull/28607 4 years ago that WOULD have done this in addition to being able to verify the IP update frequency (something the documentation for the CURRENT integration doesnā€™t even discuss).

In case you are curious I looked at the code in the system integration and it seems to check every 5 mins,

Unfortunately, while an engineer for years, I donā€™t know Python, and just donā€™t have the time at present for all that would be required to learn all the beuqacratic & process requirements to get an integration qualified while at the same time trying to learn HA design and process internals. I am trying to pick up more knowledge in may spare time (what little there is) but donā€™t believe I can do more on this than point out what was started previously and hoped someone will pick up the mantle and perhaps move the code along (think it will need a number of things added to even start a chance of being qualified for HA today including config flow, UI support, etc).

So your choices either wildcard the domain entries as suggested earlier (not what I wanted), fork the code and fix it (probably not that hard if you are doing this for your own use and actually understand how internals of HA work, and GitHub process), or use @galaxy_explorer kindly donated code above. You could also manually tweak the integration with I suspect is the easiest solution but It will get replaced with the ā€œproduction/HAā€ system integration everytime HA updates so not really a long term solution. The final idea would be to create a HACS integration which would eliminate MOST of the qualification hurtles (as you could even just host it on GitHub, and not have it published/qualified for HACS discovery).

In the end I actually discovered this system integration when looking at the Analytics report of top deployed integrations so it seems there are quite a few people who use this if that helps anyone justify looking into this further :wink:

Personally Iā€™m going to test adding multiple hosts by adding multiple instances of the integration in YAML to see if it will update multiple hosts as I have yet to see anyone conclusively answer that question and it ALSO is not addressed in the system integration doc, and as a parting gift I will open a PR to update the doc for the integration to so that at the very least that answer and the update frequency will get pushed to the integration doc and HOPEFULLY save someone else a whole lot of time searching threads and source code.

ā€“T

*** Update- Unfortunately adding multiple instances of the integration in the configuration YAML dosenā€™t work so ultimately this integration in itā€™s current public form only supports a SINGLE host entry (be it a single ACTUAL single host host entry or the wildcard ā€˜*ā€™ entry for ALL hosts). There is no way to update n > 1 DNS records. When I get some time (perhaps over the wknd Iā€™ll try to type this up in a short sweet Documentation PR request in the hops that thee powers that be will push it into th HA docs.

I my case I think Iā€™m going to go with the next most straightforward solution and leverage the script/automation I refereed to above as it should work at least as well as this integration even if it is a bit more complicated (requires additional DNS integration as well as config of automation/script/REST cmd), but is MUCH more versatile in that it can be easily adapted to support ANY DDNS service (that offers a REST api) by simply revising the command script.

Perhaps THIS should be the starting point for a standard integration for a generic DDNS updates pushed from your HA server as we could eliminate the need for ANY provider specific integration (just the config would vary). This would mean that it would be MUCH more widely adopted and ideally that means more broadly supported by the communityā€¦ Any thoughts/anyone want to take up a general DDNS integration (yes thatā€™s even more work than just adding support for multiple DNS entriesā€¦ Anyone interested in taking up the mantel?

First a thank you to @galaxy_explorer for contributing his workaround/solution, this is not a jab at him but the code does have a couple errors which as I had not worked with scripts (in or out of the UI) or the rest_command option took meetups a bit of time to figure outā€¦

Corrections need to make work:

  1. The first script call in the Automation has a typoā€¦ should read ā€œscript.namecheapā€ like all the other calls
  2. The name of the script should actually MATCH call(s) in the automation one is Namecheap other is namecheapā€¦ I beleve this is case sensitive
  3. If you are security minded you may like me be tempted to abstract out the Namecheap key and use the secrets fileā€¦ Donā€™t do it. as I found out. below

After that everything should work you just need to choose what ā€œhostsā€ to update in the actual automation.

Bonus hint: It seems the YAML code editor in the UI is/had been/continues to be broken (at least for scripts but suspect this is universally true as I suspect there is only on routine that is called anywhere HA offers to edit YAML via UI). It seems that the UI is converting the YAML to/from JSON and thus is NOT able to support items like the !secrete file so you unfortunately canā€™t keep/store your namecheap key in there and just call the secret key in the actually script. If you enter it all OUTSIDE the UI it will work. just donā€™t ever exit the script via the UI (even in YAML) as this will corrupt/break the script. So for know the easiest solution is just to hardcode the key in the script and you can edit any way you like.

Thanks again for the code, if I had the time I would just roll thee changes to the actual automation but as I said short of time at the moment.