Ping
Included with Macro DeckSee whether the devices on your network are online and how fast they answer, and react when one goes offline.
Ping status widgets showing four devices online with their latency history and a printer that is offline
- Ping devices by host name, IPv4 or IPv6 address
- Variables for online state, latency and packet loss
- Triggers when a device goes offline or comes back
- A widget with the latency and its history
- A failure threshold, so one lost packet is not an outage
The Ping integration checks devices on your network the way the ping command does: a NAS, a server, a router, a printer or anything else that answers ping. Add one configuration per device. Each one has its own interval, timeout and failure threshold, and every widget, trigger and variable of that device uses the same pings.
What you can do
- Show on your deck whether a device is online and how fast it answers, with the Ping status widget.
- Run an action when a device goes offline or comes back, with the Target offline and Target online triggers.
- Use the variables to show the latency or the packet loss on any button, or to graph the latency with the History Graph widget.
Some example setups:
- A Ping status widget for your NAS that shows its latency and turns red when it stops answering.
- An automation on Target offline of your server that sends you a notification.
- An automation on Target online of your PC that opens a folder or starts a program once it is back.
How it behaves
Macro Deck pings each device once per interval, 10 seconds by default. A device counts as offline only after as many pings in a row went unanswered as its failure threshold, 3 by default, and as online again on the first reply. The triggers fire only when a device really changes between online and offline, not for the first result after Macro Deck starts. When a host name has several addresses, for example an IPv6 and an IPv4 address, Macro Deck tries them in turn. When the system does not let Macro Deck send ping requests, the Integrations page says so and the devices are not reported as offline.
What you need
- A device that answers ping, reachable from the computer Macro Deck runs on.
- Its host name, IPv4 or IPv6 address, for example
192.168.1.10ornas.local. - On Linux: ping allowed for the user Macro Deck runs as, for example through the
net.ipv4.ping_group_rangesetting or thepingcommand.
Set it up
Step 1: Open the Ping integration
In Macro Deck, click Integrations in the sidebar and click Ping. On the Overview tab, click Add configuration in the Configuration section. Turning on the switch at the top right opens the same dialog, and the integration is turned on once the setup is done.
Step 2: Enter the device
In the Ping target dialog, enter:
- Configuration name: how the device is called in triggers, widgets and variables, for example
NAS. - Host: the host name, IPv4 or IPv6 address of the device.
- Interval (seconds): how often the device is pinged.
- Timeout (milliseconds): how long to wait for each reply. It must be shorter than the interval.
- Failures before offline: how many pings in a row must fail before the device counts as offline.
Click Continue. Macro Deck does not ping the device while you add it, so you can add a device that is switched off right now.
- Configuration name: how the device is called in triggers, widgets and variables, for example
Step 3: Add the widget
On the Deck page, add the Ping status widget to a folder. In its settings, choose the Target and whether it shows the latency, the packet loss and the latency history.
Step 4: React when a device goes offline
Click Automations in the sidebar, create an automation and choose Target offline or Target online as its trigger. Pick a Target, or leave it empty to react to every device, and add the actions to run.
Triggers2
A button or flow can react to these events.
- Target online
- A device answers again after it was offline. It carries the host and the latency in milliseconds.
- Target offline
- A device did not answer as many pings in a row as its failure threshold. It carries the host.
Variables4
Show these values on buttons and widgets, or use them in conditions.
ping_<target>_online- Whether the device counts as online. Unavailable until the first result.
ping_<target>_latency- The latency of the last reply in milliseconds. Unavailable while the device is offline.
ping_<target>_packet_loss- The share of the last 20 pings that went unanswered, in percent.
ping_<target>_last_seen- When the device last answered, as an ISO 8601 time in UTC.
Widgets1
Add these to your deck from the widget picker.
- Ping status
- Shows whether a device is online, its latency, its packet loss and a line of its recent latency.
Frequently asked questions
Why does a device count as offline only after a while?
A device counts as offline after as many pings in a row went unanswered as its Failures before offline, so a single lost packet does not make it look offline. Lower the value or the interval to notice an outage sooner.
Why did no trigger run when Macro Deck started?
The triggers fire only when a device changes between online and offline. The first result after Macro Deck starts or after you add a device fires no trigger, so starting Macro Deck does not run all your actions at once.
What happens when I rename a device or change its settings?
The device keeps its state, so a device that comes back right after the change still fires Target online. Renaming it renames its variables. Changing its host starts it over.
Why does the Integrations page say Ping is not permitted?
The system does not let Macro Deck send ping requests. On Linux, allow ping without root with the net.ipv4.ping_group_range setting or install the ping command. Windows and macOS allow ping without extra settings.
More in Smart home and web
Home Assistant
Included with Macro DeckSwitch lights, run scenes and scripts, and show live states from your Home Assistant on your deck.
AdGuard Home
Included with Macro DeckTurn AdGuard Home protection on, off or pause it, and show its statistics on your deck.
RSS feeds
Included with Macro DeckFollow RSS and Atom feeds, show their newest articles in widgets and react when new articles arrive.
HTTP
Included with Macro DeckSend HTTP requests from a button and save values from the response into variables.
Weather
Included with Macro DeckShow the current weather and the forecast for your locations on your deck, without an API key.