esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
417 stars 26 forks source link

Adding static host entries (/etc/hosts capability) #2008

Open segdy opened 1 year ago

segdy commented 1 year ago

Describe the problem you have/What new integration you would like

Ability to add a host entry to ESPhome that will be used to resolve arbitrary DNS names locally without any DNS required.

This is standard functionality of any TCP/IP stack and it would be very useful to have this in ESPhome as well.

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

I have asked this but since there was no response I assume it it not possible (yet).

The use cases are manifold. For example, you may want to operate your ESP devices without relying on a DNS server. Or you may want to put your ESP devices into a dedicated VLAN without DNS.

Additional context

Currently I am not able to use the media player at all. Reason: The requesting system (Home Assistant) sends a request to play a file to my ESPhome media player. This file is sent in the form of an URL. The URL points back to my Home Assistant but unfortunately the DNS name it uses is not configurable. On any other system I would just enter something like this into my /etc/hosts file:

10.227.68.10   home-assistant.intra.example.net
nagyrobi commented 1 year ago

In the core network component I'd imagine something like:

# Example configuration
network:
    enable_ipv6: true
    hosts:
      - 10.227.68.10:   home-assistant.intra.example.net
      - "fe80::d6a:cd85:edaa:b897":   home-assistant-test.intra.example.net

IPv6 addresses would be interesting to validate within YAML...

segdy commented 1 year ago

Yes that would be exactly what I had been imagining as well.

nagyrobi commented 1 year ago

Afaik we're using lwip which doesn't seem to support it: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/lwip.html