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?