Is there e WIFI uptime sensor?

I would like to know how long the wifi connection has been connected?

I have HA ping Google every minute.

# Ping Google to check internet connection

  - platform: ping
    host: 8.8.8.8
    name: "internet"
    scan_interval: 60

This gives you binary_sensor.internet which you can use in a logbook card, for example.

It is in ESPHome that i need it. In ESPHome binary_sensor.ping is not available.

It is a feature request: https://github.com/esphome/feature-requests/issues/242

Also this is a binary i would like a time…

Do you want to know, when WIFI is connected or do you need to know, if a specific host could be reached.
For the first, you could use Wifi.connected from WIFI Component. Check in intervals and store the timestamp into a global variable. This you can make available to HA.

Ulrich

image

again, esphome does not have ping. You could write a custom component to ping another host.

But ping doesn’t tell you if the wifi connection is down. A ping failure could be because the ping destination host is down.

This can help you?

https://esphome.io/components/sensor/wifi_signal.html

I am not clear what you are asking. What Wi-Fi connection are you wanting timed? And, why?

I have some home assistant sensors with on_value automation. When the wifi connection drops and it comes back up the on_value automation is run. Even if the value has not changed.

I was thinking to disable the automation as long as the connection isn’t active for more than 30 seconds…

But i solved it by storing the value as a global. And checking if it changed before starting the automation…