Can't add ESPhome integration

sorry, can’t help you with that, as i don’t use BME280

I’ve come to the conclusion, it’s not going to happen now, getting esphome added to HA.
I have tried 2 different ways of installing the yaml file, legacy download and then using esphome-flasher, and also using ESPHome web to install the legacy file.
And still HA says to make sure there is an API line. I know there is one in the file and I can retrieve the API key from ‘Show API key’
In the logs it is still saying it can’t connect to to ESPHome API for 192.168.0.229
I am now at loss as to what else I can do

Thanks

I think you are looking at it the wrong issue.
I do not think the issue is with the ESP device, but rather your network.

First start an ESP flash with a basic device with no other sensors connected and only a basic setup.
Then get your network to recognize that device before starting to play with expanding the functionality of the ESP device.

Did you add the web sever component yet? Can you access your esphome node then via browser on it’s (mDNS)hostname and/or IP?

:point_up:

:100:

Thanks for the reply.
I have just added a web_server, port 80, but still getting the same error.
I can ping the esp32 board ip address with no problems.

I tend to agree that it is all to do with mdns. Is this a new feature with HA and or ESPhome, because it didn’t cause me any problems when I first set up the esp in HA , 2 years ago.

I have spent hours googling how to get mdns working, but I’ve had no luck so far.

Using avahi-browse -alr I can see other devices resolving as .local, including my NAS and printer which I can access by using them, but HS does not show as a .local

So you can ping the device (meaning it is reachable in your network) but can’t open the web server/site with your favorite browser? What error message is shown in your browser?

Pings in a terminal:
rob@rob-Z97:~$ ping 192.168.0.229:6053
ping: 192.168.0.229:6053: Name or service not known

In a web browser:
This site can’t be reached192.168.0.229 refused to connect.

That’s expected as you can’t ping dedicated ports (which you were told already lately in this very forum)

You can try again with ping 192.168.0.229

What happens if you use the domain name like esphomenodename.local (mDNS) or with your local domain name?

rob@rob-Z97:~$ ping 192.168.0.229
PING 192.168.0.229 (192.168.0.229) 56(84) bytes of data.
64 bytes from 192.168.0.229: icmp_seq=1 ttl=255 time=2.79 ms

The name is just home, so I pinged home.local
rob@rob-Z97:~$ ping home.local
ping: home.local: Name or service not known

In a web browser I tried esphomehome.local, and just got a listing of links to do with esphome

So whatever the device behind this IP is - it is reachable.

Question is it really the esphome node you are expecting or another device?

Can you try ping -a 192.168.0.229 and post the output? It might give a clue about the hostname or not…

That looks like (if it your esphome node) the the web server component actually wasn’t installed :thinking:

Can you tell us your brand of router and if you have any VLANS, Firewall or other custom configurations in place?

rob@rob-Z97:~$ ping -a 192.168.0.229
PING 192.168.0.229 (192.168.0.229) 56(84) bytes of data.
64 bytes from 192.168.0.229: icmp_seq=1 ttl=255 time=2.95 ms

How does the web server component get installed and to where

Router is TP-Link AX50, also known as AX3000
I don’t have any VLANS as far as I’m aware

The SPI Firewall on the router is on and is set for pings from LAN

No custom configurations that I know of

Thanks

If you add the lines for the web server component I posted to your yaml and let esphome do the magic (validate, compile & upload/install to your node) then your esphome node should show a web page were you can control things and see logs.

That does really not say much. :slight_smile:
What is the default rule for incoming and outgoing packets and doors your access point have some segregation running, which could also be called guest network/said?

@orange-assistant
I did add the web server lines earlier and I compiled and installed the file to my esp2 board, and there is nothing different than there was before.
During the compile stage, I noticed:
ESPAsyncWebServer- esphome @ 2.1.0
|----AsyncTCP-esphome @ 1.2.0
DNSService @ 2.0.0
ESPmDNS @ 2.0.0

So I thought that it would be ok this time, but no.
If the web server has been installed, then I am doing something wrong when I try to access the node
Again, the ESPhome integration can’t be add because of the API line error!!!

Could you paste the whole output? Compiling till down the upload/install is complete and then further when the esphome node is restarted and continues putting out an endless log (you can cut when the 60 seconds cycles always print the same stuff over and over)

Lot’s of useful information is to be expected when the esphome node restarts after the update as it will print for example network information and which components are loaded.

Weird as when it was compiled earlier, it took something like 7.5 minutes to complete and there was a lot to it, but this time there are only a fraction of the lines. I selected Manualy download then Modern Format.

INFO Reading configuration /config/esphome/home.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing home (board: nodemcu-32s; framework: arduino; platform: platformio/espressif32 @ 5.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- AsyncTCP-esphome @ 1.2.2
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- AsyncTCP-esphome @ 1.2.2
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.4
|   |-- libsodium @ 1.10018.1
|-- Wire @ 2.0.0
|-- ArduinoJson @ 6.18.5
RAM:   [=         ]  12.5% (used 40940 bytes from 327680 bytes)
Flash: [=====     ]  51.6% (used 946753 bytes from 1835008 bytes)
========================= [SUCCESS] Took 44.11 seconds =========================
INFO Successfully compiled program.

Can’t you install it directly ether OTA (via network) or to the device when it’s connected via USB?

That way after successful installing the window will directly output the log of the esphome node which would be super useful for your further troubleshooting.

I already did install it directly while connected by usb. I only did what I did so I could get all the lines which you wanted.
As I said above, I must be doing something wrong because there is no change at all.
ESPHome has been discovered but it can’t be submitted due the API line error I keep getting

@orange-assistant was hoping to get the logs from after the OTA installation, something like this:

======================== [SUCCESS] Took 12.46 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of sonoff-switch-ip51.domainy.my
INFO  -> 192.168.103.51
INFO Uploading /data/sonoff-switch-ip51/.pioenvs/sonoff-switch-ip51/firmware.bin (481376 bytes)
INFO Compressed to 328933 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from sonoff-switch-ip51.domainy.my using esphome API
WARNING Can't connect to ESPHome API for sonoff-switch-ip51.domainy.my: Timeout while connecting to ('192.168.103.51', 6053)
INFO Trying to reconnect to sonoff-switch-ip51.domainy.my in the background
INFO Successfully connected to sonoff-switch-ip51.domainy.my
[22:09:05][I][app:102]: ESPHome version 2022.12.7 compiled on Jan 26 2023, 22:08:17
[22:09:05][C][wifi:504]: WiFi:
[22:09:05][C][wifi:362]:   Local MAC: C4:4F:33:C2:51:7D
[22:09:05][C][wifi:363]:   SSID: [redacted]
[22:09:05][C][wifi:364]:   IP Address: 192.168.103.51
[22:09:05][C][wifi:365]:   BSSID: [redacted]
[22:09:05][C][wifi:367]:   Hostname: 'sonoff-switch-ip51'
[22:09:05][C][wifi:369]:   Signal strength: -59 dB ▂▄▆█
[22:09:05][C][wifi:373]:   Channel: 6
[22:09:05][C][wifi:374]:   Subnet: 255.255.252.0
[22:09:05][C][wifi:375]:   Gateway: 192.168.101.254
[22:09:05][C][wifi:376]:   DNS1: 192.168.101.254
[22:09:05][C][wifi:377]:   DNS2: 0.0.0.0
[22:09:05][C][logger:293]: Logger:
[22:09:05][C][logger:294]:   Level: DEBUG

I installed the file while the board was connected by USB and didn’t realise the logs were needed.
This is all there is.

INFO Reading configuration /config/esphome/home.yaml... INFO Starting log output from 192.168.0.229 using esphome API WARNING Can't connect to ESPHome API for 192.168.0.229: Error connecting to ('192.168.0.229', 6053): [Errno 111] Connect call failed ('192.168.0.229', 6053) INFO Trying to reconnect to 192.168.0.229 in the background