Skip to content

Online

The online platform provides a binary sensor that reports whether the device can reach any of a list of connectivity targets. By default it queries four well-known DNS servers, which is lightweight and requires no persistent connection.

online:
update_interval: 30s
timeout: 3s
# Defaults to the four DNS servers below; override to use your own targets.
targets:
- host: 8.8.8.8 # protocol defaults to "dns" (always port 53)
- host: 8.8.4.4
- host: 1.1.1.1
- host: 1.0.0.1
binary_sensor:
- platform: online
name: 'Online'
icon: mdi:web
device_class: connectivity
PropertyTypeDefaultDescription
targetslist of targetsGoogle & Cloudflare DNS on :53Connectivity targets (see Target options below)
update_intervalduration30sPoll interval
timeoutduration3sDefault connection/response timeout per target

Each entry in the targets list supports the following properties:

PropertyTypeDefaultDescription
hoststringRequiredHostname or IP address to check
protocolstringdnsProbe type: dns sends a minimal DNS query (always port 53); tcp opens a TCP connection
portnumberPort number. Required for tcp; optional for dns (defaults to 53)
timeoutdurationfrom onlinePer-target timeout override

The binary sensor exposes the standard triggers and actions: on_press fires when connectivity is restored and on_release when it is lost.