EverythingSmartHome / everything-presence-lite

Everything Presence Lite
117 stars 43 forks source link

Can't connect to ESP. Please make sure your YAML file contains an 'api:' line. #163

Closed STB-SMART closed 6 days ago

STB-SMART commented 1 week ago

Hello,

i just recieved my everything-present-lite sensors and tried to set these up. Blutooth setup worked fine, but while trying to configure the sensor I get the following error:

EPL_Configure_Error

I can ping the sensor from my Raspbarry 5 and my PC and its showing up in my unify console.

When I open the LOGS in ESPHome via cable everything looks fine to me.

But when i try to open the LOGS wirelessly i get an error again

INFO ESPHome 2024.8.3
INFO Reading configuration /config/esphome/everything-presence-lite-5c09ec.yaml...
INFO Starting log output from 192.168.1.74 using esphome API
WARNING Can't connect to ESPHome API for everything-presence-lite-5c09ec @ 192.168.1.74: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.74', port=6053))]: [Errno 113] Connect call failed ('192.168.1.74', 6053) (SocketAPIError)
INFO Trying to connect to everything-presence-lite-5c09ec @ 192.168.1.74 in the background

I have other ESP Devives (D1_mini) setup and working in Homeassistant with no issues at all and i already compared the code, especially for the API line.

Noteworthy is that i cant even show the API Key from ESPHome Main Menu with the Presence Lite EPL_API_Error

Thats my current configuration:

# Enable Home Assistant API
api:
  encryption:
    key: "hD4MUudRq03sOAryYk62clFT4ruJUT/W3duVJba5B90="

substitutions:
  name: everything-presence-lite-5c09ec
  friendly_name: Everything Presence Lite 5c09ec
packages:
  EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-lite/everything-presence-lite-ha.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

# Enable logging
logger:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.1.74
  manual_ip:
    static_ip: 192.168.1.74
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1 

As you may notice I already tried to adjust some stuff but it never worked in the first place, same issues with the settings it shipped with.

Thank you for any help already in advance

EverythingSmartHome commented 1 week ago

This error is a bit of a red herring, it makes most users think they need to check the config however 99% of the time it's either:

This would be backed up by you not being able to open the logs.

What is the IP of your HA server?

STB-SMART commented 1 week ago

Thanks for the fast reply.

Both HA and the ESP are in the same VLAN. The Adress of HA is 192.168.1.42 The only thing thats kind of "outside" of this VLAN ist the unify router itself with its Ip being 192.168.178.121. I can check if i can forward Adresses and Ports for the same VLAN there. But thats a little bit above my networking knowlege though it might take awhile.

Is it possible that there is a connection error between HA and ESP even though im able to ping it from HA/Raspbarry itself?

EverythingSmartHome commented 1 week ago

Are you certain that the IP you are using is correct and it's not another device you are pinging? After you added the manual IP to the config, did you upload it over USB?

STB-SMART commented 1 week ago

Yes, I did upload it over USB. Im 98% sure im pinging the correct device. I double checked in Unify and also tried to fix IP Adress over there to avoid changes while im working on the issue

EverythingSmartHome commented 1 week ago

Can you grab the logs over USB in that case? It should show the connection details on boot which we can use to verify

STB-SMART commented 1 week ago

Edit: Removed Link To File

I just deleted some AP_Names and MAC Adresses for private reasons and replaced them with "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

EverythingSmartHome commented 1 week ago

Looks good in the log - have you tried connecting to it while it's plugged in over USB?

STB-SMART commented 1 week ago

Yes, i have one thats connected to USB all the time and one thats just connected to load changes. Both not working. I will continue troubleshooting tomorrow.

STB-SMART commented 6 days ago

Okay,

an update on my troubleshooting: After adopting the Sensor to a completly new test enviroment this morning (different router, newly setup HA on Raspberry 4) i was able to connect to the sensor.

Noteworthy is that I was still not able to request the API key on the ESPHome Dashboard. That was one thing that kept confusing me.

With one sensor running I switched back to my original setup with unify. Aber a few more hours of troubleshooting I finally got it to work.

I already tried this yesterday but I had to to implement some rules into Unifi to allow for full communication betwenn HA and the ESP Sensor (Even though the devices could ping eachother before that and are in the same VLAN). My guess the corresponding ports were still blocked. The one thing I was missing yesterday was a full restart of my Ubiquiti Dream Router to actually make these new rules apply to my network.

image

Here is one example of the modified config that I am using right now:

substitutions:
  name: everything-presence-lite-6c09ed
  friendly_name: EPL_Arbeitszimmer

packages:
  EverythingSmartTechnology.Everything_Presence_Lite: github://everythingsmarthome/everything-presence-lite/everything-presence-lite-ha.yaml@main

esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

# Enable Home Assistant API
api:
  encryption:
    key: "wANNZisF4BmCaJMcpvqRS2K7Ee1h6Rj0yHf1VXKhJbQ="

# Enable logging
logger:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.1.75
  manual_ip:
    static_ip: 192.168.1.75
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1 

Thank you for the fast help.

EverythingSmartHome commented 6 days ago

Glad you got it figured out, thanks for the update!