Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FQDN support for UDP addresses list #2977

Open
skykingjwc opened this issue Dec 6, 2024 · 3 comments
Open

FQDN support for UDP addresses list #2977

skykingjwc opened this issue Dec 6, 2024 · 3 comments

Comments

@skykingjwc
Copy link

skykingjwc commented Dec 6, 2024

Describe the problem you have/What new integration you would like
Would like to be able to use FQDN names in the UDP address list in addition to IP addresses.
This would allow users to use devicename.local addresses leveraging the advantages of mDNS and DNS and eliminate the burden of tracking IP addresses manually.

Addition of an FQDN option in lieu of an IP address. For example:

  - id: udp_external
    update_interval: 60s
    addresses:
      - remotedevice.local    #<----- FQDN instead of an IP address

Please describe your use case for this integration and alternatives you've tried:

Problem is the current limitation of IP addresses only requires manual tracking of IP address to device mappings and precludes the possibility of using mDNS or DNS for address resolution.

Additional context

If adding FQDN to the addresses configuration variables is not possible due to existing code issues, an alternative could the addition of an FQDNs: configuration variable.

@nagyrobi
Copy link
Member

nagyrobi commented Dec 7, 2024

That imposes a lot of overhead to work properly. If the name resolution would happen once when the component starts, you wouldn't be happier anyway because if the IP changes behind the name, it won't work until you reboot the node. If the name would be resolved every time a new packet is sent, that would slow down seriously the whole loop - you don't want that...

@skykingjwc
Copy link
Author

skykingjwc commented Dec 9, 2024

That imposes a lot of overhead to work properly. If the name resolution would happen once when the component starts, you wouldn't be happier anyway because if the IP changes behind the name, it won't work until you reboot the node. If the name would be resolved every time a new packet is sent, that would slow down seriously the whole loop - you don't want that...

Other components such as https://esphome.io/components/http_request.html#http-request-post-action use a FQDN. Name caching is a widely accepted method of addressing performance issues. No one is suggesting that the lookup be done during each iteration of a loop. Caching the address until the DNS TTL expires is standard procedure.

@clydebarrow
Copy link

The http_request component doesn't do dns lookups directly, it relies on the platform libraries (ESP-IDF or Arduino) to handle that. To manage this properly ESPHome really needs a DNS component, that would handle lookups and caching with appropriate refreshing. Such a component could then be used by any other component that needs to resolve hostnames to addresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants