Zdr
(zdr)
August 30, 2024, 5:57pm
1
Hi, I am trying to make baby steps at HA with integrating ESP32 dev board into it, however I seem to be stuck on the very doorstep. I could not ping it from Windows machine by name, so I had to put it into hosts file. I don’t see a way to do this in HA however, so I either need a solution for ESP32 mDNS problem or a way to edit hosts file in HA.
opened 03:56PM - 31 Jan 22 UTC
integration: mdns
### The problem
Detected that ESP32 devices are not properly announcing mDNS .l… ocal domain when using multicast-relay solution. Before moving to this mDNS solution, I was using Avahi service that was working as expected. This brings the Offline status on ESPHome main page.
The nuance in this issue is that I have a ESP8266 with almost the same settings as my ESP32 (2 devices) and this is working as expected.
On my local network, in multiple VLAN configured, I can ping ESP8266 .local DNS name but the ones for ESP32 are not pingable. For the IoT VLAN, I have a specific internal DNS domain and all the devices are pingable. If I set the `domain:` setting using my internal DNS for the specific IoT VLAN, nothing changes but I'm able to access the logs and upgrade ESP32 firmwares.
Checking multicast-relay logs on the specific docker image, I can see that when the devices boot, they send multicast request to all VLAN configured during the first 5 seconds the device are online, but then stops. Instead, for ESP8266, it initiates the initial announce broadcast and then continue to broadcast each 15-90 seconds, as expected.
### Which version of ESPHome has the issue?
2022.1.2
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
2021.12.10
### What platform are you using?
ESP32
### Board
esp32dev
### Component causing the issue
mDNS
### Example YAML snippet
```yaml
esphome:
name: esp32-name
platform: ESP32
board: esp32dev
includes:
- custom_us_sensor_esp32.h
libraries:
- "Grove Ultrasonic Ranger"
i2c:
sda: 15
scl: 2
wifi:
ssid: !secret wifi_iot_ssid
password: !secret wifi_iot_password
domain: .internal.patriarca.pt
ap:
ssid: $friendly_name WiFi
password: !secret esphome_ap
captive_portal:
logger:
api:
password: !secret esphome_api
ota:
password: !secret esphome_ota
mqtt:
broker: !secret mosquitto_ip
username: !secret mosquitto_username
password: !secret mosquitto_password
topic_prefix: esphome/esp32-name
sensor:
- platform: custom
lambda: |-
auto my_sensor = new MyCustomSensor();
App.register_component(my_sensor);
return {my_sensor};
sensors:
name: Garage $friendly_name Distance
unit_of_measurement: cm
id: garage_sensor
- platform: wifi_signal
name: Garage $friendly_name RSSI
update_interval: 60s
- platform: bme280
temperature:
name: Garage $friendly_name Temperature
oversampling: 16x
pressure:
name: Garage $friendly_name Pressure
humidity:
name: Garage $friendly_name Humidity
address: 0x77
update_interval: 60s
- platform: uptime
name: Garage $friendly_name Uptime
id: uptime_sensor
update_interval: 60s
internal: true
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
- platform: template
name: Garage $friendly_name Cover
lambda: !lambda |-
if (id(garage_sensor).state < 20) {
return 100;
} else {
return 0;
}
update_interval: 2s
accuracy_decimals: 0
text_sensor:
- platform: wifi_info
ip_address:
name: Garage $friendly_name IP Address
- platform: template
name: Garage $friendly_name Uptime
id: uptime_human
icon: mdi:clock-start
button:
- platform: restart
name: Garage $friendly_name Reboot
- platform: safe_mode
name: Garage $friendly_name Safe Mode
```
### Anything in the logs that might be useful for us?
```txt
[15:42:46][I][app:102]: ESPHome version 2022.1.2 compiled on Jan 31 2022, 10:53:59
[15:42:46][C][wifi:488]: WiFi:
[15:42:46][C][wifi:350]: Local MAC: 00:00:00:00:00:00
[15:42:46][C][wifi:351]: SSID: [redacted]
[15:42:46][C][wifi:352]: IP Address: ip_address
[15:42:46][C][wifi:354]: BSSID: [redacted]
[15:42:46][C][wifi:355]: Hostname: 'esp32-name'
[15:42:46][C][wifi:357]: Signal strength: -57 dB ▂▄▆█
[15:42:46][C][wifi:361]: Channel: 1
[15:42:46][C][wifi:362]: Subnet: 255.255.255.0
[15:42:46][C][wifi:363]: Gateway: gateway
[15:42:47][C][wifi:364]: DNS1: dns1
[15:42:47][C][wifi:365]: DNS2: 0.0.0.0
[15:42:47][C][logger:233]: Logger:
[15:42:47][C][logger:234]: Level: DEBUG
[15:42:47][C][logger:235]: Log Baud Rate: 115200
[15:42:47][C][logger:236]: Hardware UART: UART0
[15:42:47][D][sensor:125]: 'Garage name Cover': Sending state 0.00000 with 0 decimals of accuracy
[15:42:47][C][i2c.arduino:037]: I2C Bus:
[15:42:47][C][i2c.arduino:038]: SDA Pin: GPIO15
[15:42:47][C][i2c.arduino:039]: SCL Pin: GPIO2
[15:42:47][C][i2c.arduino:040]: Frequency: 50000 Hz
[15:42:47][C][i2c.arduino:043]: Recovery: bus successfully recovered
[15:42:47][I][i2c.arduino:053]: Results from i2c bus scan:
[15:42:47][I][i2c.arduino:059]: Found i2c device at address 0x77
[15:42:47][C][uptime.sensor:031]: Uptime Sensor 'Garage name Uptime'
[15:42:47][C][uptime.sensor:031]: State Class: 'total_increasing'
[15:42:47][C][uptime.sensor:031]: Unit of Measurement: 's'
[15:42:47][C][uptime.sensor:031]: Accuracy Decimals: 0
[15:42:47][C][uptime.sensor:031]: Icon: 'mdi:timer-outline'
[15:42:47][C][template.sensor:023]: Template Sensor 'Garage name Cover'
[15:42:47][C][template.sensor:023]: State Class: ''
[15:42:47][C][template.sensor:023]: Unit of Measurement: ''
[15:42:47][C][template.sensor:023]: Accuracy Decimals: 0
[15:42:47][C][template.sensor:024]: Update Interval: 2.0s
[15:42:47][C][template.text_sensor:021]: Template Sensor 'Garage name Uptime'
[15:42:47][C][template.text_sensor:021]: Icon: 'mdi:clock-start'
[15:42:47][C][bme280.sensor:143]: BME280:
[15:42:47][C][bme280.sensor:144]: Address: 0x77
[15:42:47][C][bme280.sensor:156]: IIR Filter: OFF
[15:42:47][C][bme280.sensor:157]: Update Interval: 60.0s
[15:42:47][C][bme280.sensor:159]: Temperature 'Garage name Temperature'
[15:42:47][C][bme280.sensor:159]: Device Class: 'temperature'
[15:42:47][C][bme280.sensor:159]: State Class: 'measurement'
[15:42:47][C][bme280.sensor:159]: Unit of Measurement: '°C'
[15:42:47][C][bme280.sensor:159]: Accuracy Decimals: 1
[15:42:47][C][bme280.sensor:160]: Oversampling: 16x
[15:42:47][C][bme280.sensor:161]: Pressure 'Garage name Pressure'
[15:42:47][C][bme280.sensor:161]: Device Class: 'pressure'
[15:42:47][C][bme280.sensor:161]: State Class: 'measurement'
[15:42:47][C][bme280.sensor:161]: Unit of Measurement: 'hPa'
[15:42:47][C][bme280.sensor:161]: Accuracy Decimals: 1
[15:42:47][C][bme280.sensor:162]: Oversampling: 16x
[15:42:47][C][bme280.sensor:163]: Humidity 'Garage name Humidity'
[15:42:47][C][bme280.sensor:163]: Device Class: 'humidity'
[15:42:47][C][bme280.sensor:163]: State Class: 'measurement'
[15:42:47][C][bme280.sensor:163]: Unit of Measurement: '%'
[15:42:47][C][bme280.sensor:163]: Accuracy Decimals: 1
[15:42:47][C][bme280.sensor:164]: Oversampling: 16x
[15:42:47][C][restart.button:017]: Restart Button 'Garage name Reboot'
[15:42:47][C][safe_mode.button:022]: Safe Mode Button 'Garage name Safe Mode'
[15:42:47][C][safe_mode.button:022]: Icon: 'mdi:restart-alert'
[15:42:47][C][captive_portal:144]: Captive Portal:
[15:42:47][C][ota:082]: Over-The-Air Updates:
[15:42:47][C][ota:083]: Address: esp32-name.domain:3232
[15:42:47][C][ota:086]: Using Password.
[15:42:47][C][api:134]: API Server:
[15:42:47][C][api:135]: Address: esp32-name.domain:6053
[15:42:47][C][api:139]: Using noise encryption: NO
[15:42:47][C][mqtt:064]: MQTT:
[15:42:47][C][mqtt:066]: Server Address: mosquitto.domain:1883 (ip_address)
[15:42:47][C][mqtt:067]: Username: [redacted]
[15:42:47][C][mqtt:068]: Client ID: [redacted]
[15:42:47][C][mqtt:070]: Discovery prefix: 'homeassistant'
[15:42:47][C][mqtt:071]: Discovery retain: YES
[15:42:47][C][mqtt:073]: Topic Prefix: 'esphome/esp32-name'
[15:42:47][C][mqtt:075]: Log Topic: 'esphome/esp32-name/debug'
[15:42:47][C][mqtt:078]: Availability: 'esphome/esp32-name/status'
[15:42:47][C][wifi_signal.sensor:009]: WiFi Signal 'Garage Name RSSI'
[15:42:48][C][wifi_signal.sensor:009]: Device Class: 'signal_strength'
[15:42:48][C][wifi_signal.sensor:009]: State Class: 'measurement'
[15:42:48][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm'
[15:42:48][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[15:42:48][C][wifi_info:009]: WifiInfo IPAddress 'Garage name IP Address'
[15:42:48][C][mdns:084]: mDNS:
[15:42:48][C][mdns:085]: Hostname: esp32-tiguan
[15:42:48][C][mqtt.sensor:027]: MQTT Sensor 'Garage name Distance':
[15:42:48][C][mqtt.sensor:031]: State Topic: 'esphome/esp32-name/sensor/garage_name_distance/state'
[15:42:48][C][mqtt.sensor:027]: MQTT Sensor 'Garage name RSSI':
[15:42:48][C][mqtt.sensor:031]: State Topic: 'esphome/esp32-name/sensor/garage_name_rssi/state'
[15:42:48][C][mqtt.sensor:027]: MQTT Sensor 'Garage name Temperature':
[15:42:48][C][mqtt.sensor:031]: State Topic: 'esphome/esp32-name/sensor/garage_name_temperature/state'
[15:42:48][C][mqtt.sensor:027]: MQTT Sensor 'Garage name Pressure':
[15:42:48][C][mqtt.sensor:031]: State Topic: 'esphome/esp32-name/sensor/garage_name_pressure/state'
[15:42:48][C][mqtt.sensor:027]: MQTT Sensor 'Garage name Humidity':
[15:42:48][C][mqtt.sensor:031]: State Topic: 'esphome/esp32-name/sensor/garage_name_humidity/state'
[15:42:48][C][mqtt.sensor:027]: MQTT Sensor 'Garage name Cover':
[15:42:48][C][mqtt.sensor:031]: State Topic: 'esphome/esp32-name/sensor/garage_name_cover/state'
[15:42:48][C][mqtt.text_sensor:023]: MQTT Text Sensor 'Garage name IP Address':
[15:42:48][C][mqtt.text_sensor:024]: State Topic: 'esphome/esp32-name/sensor/garage_name_ip_address/state'
[15:42:48][C][mqtt.text_sensor:023]: MQTT Text Sensor 'Garage name Uptime':
[15:42:48][C][mqtt.text_sensor:024]: State Topic: 'esphome/esp32-name/sensor/garage_name_uptime/state'
[15:42:48][C][mqtt.button:029]: MQTT Button 'Garage name Reboot':
[15:42:48][C][mqtt.button:030]: State Topic: 'esphome/esp32-name/button/garage_name_reboot/state'
[15:42:48][C][mqtt.button:030]: Command Topic: 'esphome/esp32-name/button/garage_name_reboot/command'
[15:42:48][C][mqtt.button:029]: MQTT Button 'Garage name Safe Mode':
[15:42:48][C][mqtt.button:030]: State Topic: 'esphome/esp32-name/button/garage_name_safe_mode/state'
[15:42:48][C][mqtt.button:030]: Command Topic: 'esphome/esp32-name/button/garage_name_safe_mode/command'
```
### Additional information
multicast-reply logs for ESP8266 device:
`Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 15:31:22 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 74 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 15:31:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 104 bytes from 0.0.0.2:5353 on br30 [ttl 255] to 224.0.0.251:5353 via br40/0.0.40.1`
multicast-relay logs for ESP32 device (presented logs are the only available on device boot time and only for some brief minutes):
`Jan-31 10:57:34 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 10:57:34 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 10:57:34 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 10:57:34 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 132 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 10:57:35 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 10:57:36 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 10:57:36 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 10:57:36 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 10:57:36 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br40/0.0.40.1
Jan-31 10:57:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br0/0.0.1.1
Jan-31 10:57:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br10/0.0.10.1
Jan-31 10:57:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br20/0.0.20.1
Jan-31 10:57:37 ./multicast-relay/multicast-relay.py INFO: [mDNS] Relayed 247 bytes from 0.0.0.1:5353 on br30 [ttl 1] to 224.0.0.251:5353 via br40/0.0.40.1`