Using ping instead of mDNS

Hello. I have HA on network 192.168.4., vpn to network 192.168.7. and DHT sensor on it. All tests is ok, but ESPHome show for this DHT as offline. Ping is ok, logs on ESPHome show information about sensor. I change the dashboard option to use ping for online checking, but without effect. Afrer first HA reboot DHT is online 1 second and then offline again. ESPHome and HA is latest version/

Welcome to HA. Can you post your ESPhome yaml? That may help someone assist you. Also - don’t just say “latest version”, it annoys some people (not me :slight_smile: ) but also means that if someone has a similar problem and finds your topic in 6 months, they won’t know if the version they are using is relevant to the problem.

1 Like

Thanks! )) Versions: Home Assistant 2023.6.3 Supervisor 2023.06.2 Operating System 10.3 ESPHome Current version: 2023.6.2

DHT yaml:

esphome:
  name: dht1
  friendly_name: DHT1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "*******"

ota:
  password: "*******"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.7.23
    gateway: 192.168.7.1
    subnet: 255.255.255.0
    dns1: 192.168.4.1
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Dht1 Fallback Hotspot"
    password: "*****"

captive_portal:
# Example configuration entry
sensor:
  - platform: dht
    pin: 02
    temperature:
      name: "Temperature 1"
    humidity:
      name: "Humidity 1"
    update_interval: 120s

Can anyone help in this forum? Or is it considered that this behavior of the module is the norm? Why is device visible in the logs, ping is enabled in the esphome settings instead of mDNS, ping from the system passes, but device is still offline???

I have something similar ---- We have a camp and I have a VPN setup between the two networks. I never switched ESPHome to use pings, I just use the use_address option in the YAML. The device always shows offline in the ESPHome dashboard, which doesn’t bother me at all. I can still flash it OTA and can access logs. And HA has no problems talking to it - but I added it to HA using the IP, not a hostname. I have zero issues with functionality. Yes, it shows offline in the ESPHome dashboard but everything still works fine. Also, you mentioned switching the dashboard option to use ping, but I don’t think that has anything to do with HA at all.

If the behaviour is consistent for both your examples - i.e. the sensors are available in HA, the device can be pinged manually etc you may want to consider logging an issue in the ESPhome Github. I would recommend a thorough search of the issues first to ensure it hasn’t been logged previously.

I also use static IP addresses. But there is one big problem: Offline devices are not reflected in the lists and cannot be displayed on the main screen. So I can’t use my temperature and humidity sensor in another network in any way, even though the logs (in yaml settings screen) show me both the temperature and humidity. But the sensor is offline and that’s it. Screenshot shows that instead of three devices it shows 2, only those that are online. DHT 1 is missing, although it exists and even has its yaml

I’m sorry but I don’t know what you mean by “Offline devices are not reflected in the lists and cannot be displayed on the main screen”? I have several ESPHome devices at camp and HA works with all of them without issues. And my setup is strange in that our camp only has power when we’re there - we run off a generator. I don’t have any issues at all with any of the ESPHome devices that are at camp, as long as they have power of course. Forget the ESPHome dashboard for a minute - when adding to HA did you use hostname or IP? I use IP because I haven’t been able to get mDNS working over Wireguard yet. If you are using hostname to add to HA, try IP. I even move some devices back and forth, and all I have to do is change the use_address IP and then delete and re-add to HA using the appropriate IP.

That’s all I can describe to you. There are 3 devices, but it shows only 2 everywhere. Why? I don’t know. I’m not an expert. But here’s what’s going on in my HA

Sorry, I’m not good at this and I don’t really understand how and what I need to do there.

Have you tried adding it manually?

image

A thing to note is that your title was a bit misleading. The ping setting is only used for device status on the ESPhome integration webpage. If you do not have a sensor connected and the logs show no connection to HA (I assume) that is a different issue altogether. Nothing to do with the ping setting…

If adding manually doesn’t work maybe post your ESPhome startup logs for the DHT1 device, post them as text, not a screenshot.

Manually added, but there is no information about temperature and humidity. DHT3 is the same sensor, and it has 3 objects, and this one has 1.

INFO ESPHome 2023.6.2
INFO Reading configuration /config/esphome/dht1.yaml...
INFO Starting log output from 192.168.7.23 using esphome API
INFO Successfully connected to 192.168.7.23
[03:06:34][I][app:102]: ESPHome version 2023.6.2 compiled on Jun 27 2023, 13:50:10
[03:06:34][C][wifi:543]: WiFi:
[03:06:34][C][wifi:379]:   Local MAC: 68:C6:3A:FD:30:8E
[03:06:34][C][wifi:380]:   SSID: [redacted]
[03:06:34][C][wifi:381]:   IP Address: 192.168.7.23
[03:06:34][C][wifi:382]:   BSSID: [redacted]
[03:06:34][C][wifi:384]:   Hostname: 'dht1'
[03:06:34][C][wifi:386]:   Signal strength: -54 dB ▂▄▆█
[03:06:34][C][wifi:390]:   Channel: 6
[03:06:34][C][wifi:391]:   Subnet: 255.255.255.0
[03:06:34][C][wifi:392]:   Gateway: 192.168.7.1
[03:06:34][C][wifi:393]:   DNS1: 192.168.4.1
[03:06:34][C][wifi:394]:   DNS2: 0.0.0.0
[03:06:34][C][logger:301]: Logger:
[03:06:34][C][logger:302]:   Level: DEBUG
[03:06:34][C][logger:303]:   Log Baud Rate: 115200
[03:06:34][C][logger:305]:   Hardware UART: UART0
[03:06:34][C][dht:017]: DHT:
[03:06:34][C][dht:018]:   Pin: GPIO2
[03:06:34][C][dht:020]:   Auto-detected model: DHT11
[03:06:34][C][dht:027]:   Update Interval: 120.0s
[03:06:34][C][dht:029]:   Temperature 'Temperature 1'
[03:06:34][C][dht:029]:     Device Class: 'temperature'
[03:06:34][C][dht:029]:     State Class: 'measurement'
[03:06:34][C][dht:029]:     Unit of Measurement: '°C'
[03:06:34][C][dht:029]:     Accuracy Decimals: 1
[03:06:34][C][dht:030]:   Humidity 'Humidity 1'
[03:06:34][C][dht:030]:     Device Class: 'humidity'
[03:06:34][C][dht:030]:     State Class: 'measurement'
[03:06:34][C][dht:030]:     Unit of Measurement: '%'
[03:06:34][C][dht:030]:     Accuracy Decimals: 0
[03:06:34][C][captive_portal:088]: Captive Portal:
[03:06:34][C][mdns:108]: mDNS:
[03:06:34][C][mdns:109]:   Hostname: dht1
[03:06:34][C][ota:093]: Over-The-Air Updates:
[03:06:34][C][ota:094]:   Address: 192.168.7.23:8266
[03:06:34][C][ota:097]:   Using Password.
[03:06:34][C][api:138]: API Server:
[03:06:34][C][api:139]:   Address: 192.168.7.23:6053
[03:06:34][C][api:141]:   Using noise encryption: YES
[03:06:59][D][dht:048]: Got Temperature=18.2°C Humidity=58.0%
[03:06:59][D][sensor:093]: 'Temperature 1': Sending state 18.20000 °C with 1 decimals of accuracy
[03:06:59][D][sensor:093]: 'Humidity 1': Sending state 58.00000 % with 0 decimals of accuracy
[03:08:59][D][dht:048]: Got Temperature=18.1°C Humidity=58.0%
[03:08:59][D][sensor:093]: 'Temperature 1': Sending state 18.10000 °C with 1 decimals of accuracy
[03:08:59][D][sensor:093]: 'Humidity 1': Sending state 58.00000 % with 0 decimals of accuracy

Sorry, I am not an expert… but I add and delete my DHT1 a 2 times, then went into the objects, there I found a temperature and humidity sensor marked as “read-only”. Deactivate, then activate the temperature again, it appeared normally, then went to the parameters of the humidity object and activate it there. Now everything appeared and read the data. Although the device itself shows offline anyway. But it doesn’t matter anymore? because the data demonstration works. Thank you for guiding me in the right direction.))

No worries. your logs show your ESPhome device was fine and that the problem lay in HA somewhere. Glad you worked it out.