Requirements to adopt device into ESPHome dashboard

I am loading a device with ESPHome code that uses the Sharing ESPHome devices
template. After the device is connected to the network, Home Assistant discovers the new device, but ESPHome never discovers the new device. The code does have dashboard_import: set to a valid github url and specifies import_full_config: true

Does the ESPHome discovery process have any other requirements? Is it supported if Docker versions of Home Assistant and ESPHome are used?

I have no idea what this means. I just add a device, edit the YAML code, done.
Post your YAML file.

From my notes:
Go to the ESPHome panel, click on “Add Integration”. Search for “ESPHome”.
When you click on ESPHome, you are presented with the dialogue to enter the node IP address.
Enter the node IP address and click on “Submit”. The node is then added to the ESPHome integration.

The sharing process is documented at: Sharing ESPHome devices — ESPHome which has sample YAML. It is designed to add devices with ESPHome already loaded and to adopt that device into ESPHome.

In this instance I load the image on an ESP device from: Konnected Flash Tool - ESPHome - Install Konnected via Web Browser If I compile the code in ESPHome, of course it shows up as a device.

Differences between an ESPHome instance and add-on may be in play. My ESPHome 2023.3.2 dashboard does not have an “Add Integration” option. It says: " Welcome to ESPHome It looks like you don’t yet have any devices." and the only thing I can select is “+ New Device” which does not seem to have the adopt functionality.

I just tried a scenario by loading ESPHome on Windows Docker. I compiled https://github.com/konnected-io/konnected-esphome/blob/9aff3b8d0fc4ad493d8f6af9219805c5d81d5a49/alarm-panel-pro-esp32.yaml and installed the binary via USB from https://web.esphome.io/

Home Assistant sees the ESPHome instance with details confirming it is the version I compiled today. ESPHome running on the same same docker device as HA does not see the device. Even stranger, the ESPHome Docker running on Windows shows “OFFLINE”, but if I click “VISIT”, it shows the state of the sensors and reports the IP address. This information is consistent with what is shown in HA.

The device is found via mDNS/ZeroConf:
dns-sd -Q alarm-panel-pro.local
Timestamp A/R Flags if Name T C Rdata
15:41:26.764 Add 2 18 alarm-panel-pro.local. 1 1 192.168.1.138

The solution was to remove the ESPHOME_DASHBOARD_USE_PING=true environmental parameter for ESPHome running on Docker. Then ESPHome was able to detect the ESPHome instance and ADOPT the device.

The misinformation about ESPHOME_DASHBOARD_USE_PING and mDNS are throughout Frequently Asked Questions — ESPHome ESPHOME_DASHBOARD_USE_PING disables mDNS which is not documented. ESPHome uses mDNS to show online/offline state.

Sorry but so close. I cant figure out how to create a select function that I could expose to hassio that would allow me to select a page from the ones I have created. Heres the code I have so far…

light:

  - platform: fastled_clockless

    chipset: WS2812B

    pin: 27

    num_leds: 25

    rgb_order: GRB

    id: status_led

    name: 'M5 Light'

    effects:

      - random:

      - flicker:

      - addressable_rainbow:

binary_sensor:

  - platform: gpio

    pin:

      number: 39

      inverted: true

    name: 'M5 Button'

    on_press:

      then:

#        - light.toggle: status_led

        - display.page.show_next: led_matrix_display

         

display:

  - platform: addressable_light

    id: led_matrix_display

    addressable_light_id: status_led

    width: 5

    height: 5

    rotation: 180°

    update_interval: 16ms

    pages:

    - id: page1

      lambda: |-

       Color red = Color(0xFF0000);

       it.rectangle(0, 0, 5, 5, red);

    - id: page2

      lambda: |-

        Color red = Color(0xFF0000);

        it.rectangle(0, 5, 5, 0, red);

    - id: page3

      lambda: |-

        Color green = Color(0x00FF00);

        Color red = Color(0xFF0000);

        it.rectangle(3, 3, 1, 0, green);

        it.rectangle(0, 0, 5, 5, red);  

    - id: page4

      lambda: |-

        Color green = Color(0x00FF00);

        Color red = Color(0xFF0000);

        it.rectangle(3, 3, 1, 0, green);

I ran into a similar problem. mDNS wasn’t working, but I do have Avahi setup as a reflector. I’ve been using HA this way for a few months and this was working fine. Or so I thought.

The way avahi in a docker container works, or at least for me worked, was that it was happily reflecting on existing interfaces. Since I decided to put esphome into my mix of containers, and avahi was already happily running, for some reason it was not connecting to the ‘existing’ network interfaces.

A simple restart of the avahi container was enough to make all discovery work just fine.

Normally, I would expect avahi to listen on 0.0.0.0 and if interfaces get added or removed; that this would just work ™. However, I think avahi scans interfaces and adds/removes ‘somehow’. That is something I haven’t figured out.

This should generally only be really a problem whenever a new docker network gets created, but ideally this should just work ™.

Just my 2 cents :slight_smile:

So, there should be a mechanism that links the firmware that would be installed onto say an ESP32 with the .yaml that would typically be a viewable / editable version of that same firmware and that comes via the ‘Adopt’ option as something very different to the ‘Add’.

eg, Add just adds the device and it’s entity into HA whereas Adopt would also give you the node within the ESPHome Compiler, allowing you to edit the .yaml and upload it OTA atc?

So this process requires the Adopt function to pull the .yam from the interwebs as you can’t (easily) pull the code and especially not the 'yaml from the ESP itself?

So, if that is how it is supposed to work, why might it not please?

I have a std HAOS install on an Odroid N2+ and have re-flashed several different ESP32’s using the Web tool on Chrome and whilst the flashing works fine and the device appears in HA (Add etc), I have only seen the ‘Adopt’ option come up a couple of times and it didn’t seem to work when it did (eg, no entry in ESPHome Compiler)?