Esphome esp32

I have problem to connect an esp32 to home assistance.
I have connected it on wifi

[esp32_ble_tracker:148]: Starting scan...e
[D][esp32_ble_tracker:544]: Found device 4B:69:EE:5F:9A:AE RSSI=-94e
[D][esp32_ble_tracker:565]:   Address Type: RANDOMe
[D][esp32_ble_tracker:544]: Found device A4:C1:38:3C:EE:9B RSSI=-39e
[D][esp32_ble_tracker:565]:   Address Type: PUBLICe
[D][esp32_ble_tracker:567]:   Name: 'LYWSD03MMC'e
[D][xiaomi_ble:300]: Got Xiaomi LYWSD03MMC (A4:C1:38:3C:EE:9B):e
[D][xiaomi_ble:306]:   Humidity: 55.0%e
[D][sensor:092]: 'Ble Humidity': Sending state 55.00000 % with 0 decimals of accuracye
[D][esp32_ble_tracker:148]: Starting scan...e
[D][esp32_ble_tracker:544]: Found device 4B:69:EE:5F:9A:AE RSSI=-89e
[D][esp32_ble_tracker:565]:   Address Type: RANDOMe
[D][esp32_ble_tracker:544]: Found device A4:C1:38:3C:EE:9B RSSI=-37e
[D][esp32_ble_tracker:565]:   Address Type: PUBLICe
[D][esp32_ble_tracker:567]:   Name: 'LYWSD03MMC'e
[D][esp32_ble_tracker:544]: Found device 4C:B9:DC:EA:7B:C7 RSSI=-90e
[D][esp32_ble_tracker:565]:   Address Type: RANDOMe
[D][esp32_ble_tracker:148]: Starting scan...e
[D][esp32_ble_tracker:544]: Found device 4C:B9:DC:EA:7B:C7 RSSI=-92e
[D][esp32_ble_tracker:565]:   Address Type: RANDOMe
[E][api:084]: No client connected to API. Rebooting...e
[I][app:132]: Forcing a reboot...e

But der is no connection to home assistance
Her is the code

esphome:
  name: 'xiaomi_ble'
  platform: ESP32
  board: mhetesp32devkit

wifi:
  ssid: "xxxx"
  password: "xxxx"

captive_portal:

# Enable Home Assistant API
api:

web_server:
  port: 80

logger:

ota:

# Enable Bluetooth scanning for this ESP32
esp32_ble_tracker:

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:3C:EE:9B
    bindkey: "c9f8575d0e7d6976f3338869c39a69fd"
    temperature:
      name: "Ble Temperature"
    humidity:
      name: "Ble Humidity"
    battery_level:
      name: "Ble Battery Level"

What am I doing wrong the device is on wifi

Posting pictures of text files.

Looks like mDNS isn’t working on your network. I would copy and paster the error message, but you posted it as a pic. (see above). :slight_smile:

1 Like
INFO Reading configuration /config/esphome/xiaomi_ble.yaml...
INFO Starting log output from xiaomi_ble.local using esphome API
WARNING Error resolving IP address of xiaomi_ble.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -2] Name or service not known). Re-Trying in 1 seconds
WARNING Error resolving IP address of xiaomi_ble.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Re-Trying in 1 seconds
WARNING Error resolving IP address of xiaomi_ble.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Re-Trying in 2 seconds
WARNING Error resolving IP address of xiaomi_ble.local. Is it connected to WiFi?
WARNING (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname). Re-Trying in 3 seconds

How do I get mDNS working on your network ?
My router is an Tilgin hg2381

Ask tilgin

I solved it with static ip

esphome:
  name: 'xiaomi_ble'
  platform: ESP32
  board: mhetesp32devkit

wifi:
  ssid: "xxx"
  password: "xxx"
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.180
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

# Enable Home Assistant API
api:

web_server:
  port: 80

logger:

ota:

# Enable Bluetooth scanning for this ESP32
esp32_ble_tracker:

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:3C:EE:9B
    bindkey: "c9f8575d0e7d6976f3338869c39a69fd"
    temperature:
      name: "Ble Temperature"
    humidity:
      name: "Ble Humidity"
    battery_level:
      name: "Ble Battery Level"