← All videos

Home Assistant Network Monitoring: Every Device on Your Network as an Entity

Playing loads the YouTube player (Google). Or watch it on YouTube.

Bring the home network into Home Assistant over MQTT: devices with presence, IP address and response time, network-wide counters, and an event entity for automations on new devices.

Chapters

Read the matching guide

Transcript

Home Assistant knows when your phone is home. It doesn't know when an unknown device joins your Wi-Fi, when the NAS drops off the network, or which address the printer has today. In this video we bring the whole home network into Home Assistant: every important device as an entity, network counters, and an event you can build automations on.

The network side comes from DeviceShelf Server, which scans the network around the clock. What you see is its demo network, a made-up home with forty six devices. The Home Assistant you'll see in a minute is a real test installation, and the entities in it really come from this demo server.

The connection runs over MQTT, the message system most Home Assistant setups already use. In DeviceShelf, open Settings, Data sources, and scroll to Home Assistant.

Enter the address of your MQTT broker. If you use the Mosquitto add-on, that's your Home Assistant's address with port eighteen eighty three. Add the username and password the broker expects, tick Publish to Home Assistant, and test the connection. If your broker uses TLS, write ssl colon slash slash in front of the address; the port is then usually eighty eight eighty three.

There's nothing to install in Home Assistant. DeviceShelf uses MQTT discovery, so Home Assistant creates the devices and entities by itself, within one scan.

Which devices end up in Home Assistant? By default your favorites and the infrastructure: routers, switches, access points, firewalls, servers, printers and storage. A home with a hundred and fifty devices would otherwise get hundreds of entities, most of them phones with changing addresses.

For a single device you decide yourself. Open it, and under Home Assistant pick always export or never export. A camera isn't infrastructure, but we want to know in Home Assistant when it drops off the network, so this one gets always export.

That's all on the DeviceShelf side. Now over to Home Assistant.

In Home Assistant, under Settings, Devices, the network devices now appear like any other device: the Fritz box, the switch, the access points, the servers and the printers. Each one is grouped by its hardware address, so it stays the same device when its IP address changes.

Open one, here the router. It has a presence sensor that's on while the device is reachable, a sensor with its current IP address, and one with its response time. Presence carries more in its attributes: vendor, model, device type, first and last seen, and open ports.

The response time is useful for graphs: a router that answers in one millisecond during the day and fifty in the evening tells you the network is busy. When a device is offline, the value is empty instead of zero, so the graph shows a gap and not a fake perfect value.

Besides the devices, DeviceShelf adds a hub with counters for the whole network: devices in total, online, offline and unidentified. Unidentified is the one to put on a dashboard. When it goes up, something joined that nobody has named.

And there's one entity Home Assistant can't produce on its own: the network events. It fires when a new device joins, a device goes offline or comes back, or a device opens a new port. Each event carries the hardware address, the IP, the name and the vendor.

That's what makes automations possible. Here's a simple one. The trigger is the DeviceShelf network events entity. The condition checks that the event type is new device. The action sends a notification with the device's name, address and vendor.

Here it creates a message inside Home Assistant. With the Home Assistant app on your phone, swap the action for a push notification. Other ideas: flash a light when the NAS goes offline, or switch off a smart plug when the printer has been unreachable for an hour.

Because the events come from a scan of the whole network, they also catch devices Home Assistant has never heard of. That's exactly the case you want an automation for.

To sum up: point DeviceShelf Server at your MQTT broker, and Home Assistant gets your important network devices with presence, address and response time, network-wide counters, and an event entity for new devices, outages and new ports. Build your automations on that. DeviceShelf Server and the Home Assistant guide are linked in the description.

More videos