Name.local doesn't work when adding ESPHome device to Home Assistant

When I want to add new ESPHome device to Home Assistant, the mdns name doesn’t work, I have to use the ip address. Which is strange, because I can ping / avahi-resolve the mdns name from the same machine as Home Assistant is running on (or any other machine in the local network.
Example pictures Home_Assistant_ESPHome_1_Screenshot_2022-07-24_20-20-32 Home_Assistant_ESPHome_2_Screenshot_2022-07-24_20-22-14

I should be able to use the mdns name when adding the ESPHome device, right?
Home Assistant is the latest version (2022.7.6) it normally runs in a docker, but I have tried a Python venv today as well to see if there was any difference - it wasn’t.
The ESPHome devices run ESPHome version 2022.6.2, the Home Assistant machine runs Debian 11.
Any idea on how to debug this further?

You can try your hostname+domain (like sensor219b.fritz.box for example) so to make it connect without mdns.

Can you do it from the home assistan cli too?

Fix your network’s mdns.

There doesn’t seem to be a cli for Home Assistant installed in a Python virtual environment. Perhaps it is only for Home Assistant OS?

tingo@heim:~/projects/venv-test-homeassistant$ source env/bin/activate
(env) tingo@heim:~/projects/venv-test-homeassistant$ ha
-bash: ha: command not found
(env) tingo@heim:~/projects/venv-test-homeassistant$ 

Well, yes, that’s what I’m trying to do. The only problem is that it seems to work fine - outside of Home Assistant. That’s why I’m asking about clues to debug this further.

small update: I installed home-assistant-cli (had to fix a few errors, and not all commands work) and I can run a discover command

(env) tingo@heim:~/projects/venv-test-homeassistant$ hass-cli discover
Running discovery on network (might take a while)...
esphome:
   -  host: 10.13.37.189
      port: 6053
      hostname: sensor219a.local.
      properties:
          board: nodemcuv2
          platform: ESP8266
          mac: 60019451e05b
          version: 2022.6.2
      mac_address: 60019451e05b
   -  host: 10.13.37.40
      port: 6053
      hostname: sensorserver-room.local.
      properties:
          board: nodemcuv2
          platform: ESP8266
          mac: 58bf25db0237
          version: 2022.6.2
      mac_address: 58bf25db0237
   -  host: 10.13.37.162
      port: 6053
      hostname: sensorlabben-a.local.
      properties:
          board: d1_mini
          platform: ESP8266
          mac: a020a617d3d7
          version: 2022.6.2
      mac_address: a020a617d3d7

octoprint:
   -  host: 10.13.37.107
      port: 80
      ssdp_description: http://10.13.37.107:80/plugin/discovery/discovery.xml
      name: OctoPrint instance "ironhive.local"
      model_name: 1.7.3
      model_number:
      serial:
      manufacturer: The OctoPrint Project
      udn: uuid:55d91cfe-74c0-4653-b6f4-540c145831ba
      upnp_device_type: urn:schemas-upnp-org:device:Basic:1
   -  host: 10.13.37.135
      port: 80
      ssdp_description: http://10.13.37.135:80/plugin/discovery/discovery.xml
      name: OctoPrint instance "caterpillar.local"
      model_name: 1.7.3
      model_number:
      serial:
      manufacturer: The OctoPrint Project
      udn: uuid:55d91cfe-74c0-4653-b6f4-540c145831be
      upnp_device_type: urn:schemas-upnp-org:device:Basic:1
   -  host: 10.13.37.190
      port: 80
      ssdp_description: http://10.13.37.190:80/plugin/discovery/discovery.xml
      name: OctoPrint instance "vespa.local"
      model_name: 1.7.2
      model_number:
      serial:
      manufacturer: The OctoPrint Project
      udn: uuid:55d91cfe-74c0-4653-b6f4-540c145831bd
      upnp_device_type: urn:schemas-upnp-org:device:Basic:1
   -  host: 10.13.37.56
      port: 80
      ssdp_description: http://10.13.37.56:80/plugin/discovery/discovery.xml
      name: OctoPrint instance "firefly.local"
      model_name: 1.8.1
      model_number:
      serial:
      manufacturer: The OctoPrint Project
      udn: uuid:55d91cfe-74c0-4653-b6f4-540c145831b9
      upnp_device_type: urn:schemas-upnp-org:device:Basic:1

it also finds a HP printer, Home Assistant itself and a few other things. So I would say yes - I can do discovery from Home Assistant cli.