OpenWrt (luci)

The OpenWrt (luci) integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] tracks the devices connected to a router that runs OpenWrt with the LuCI web interface. Home Assistant polls the router locally, so you can use the presence of a phone or another device to tell who is home and trigger automations based on that.

Supported devices

This integration works with routers running OpenWrt that have the LuCI web interface and its RPC package installed. It has been used with a wide range of OpenWrt-supported hardware.

Prerequisites

Before you add the integration, prepare your router:

  • Install the LuCI RPC package on your OpenWrt router. Connect to the router over SSH and run:

    apk update
    apk add luci-mod-rpc
    

    On OpenWrt versions that use the older package manager, use opkg update and opkg install luci-mod-rpc instead.

  • Have the credentials of a user with administrative privileges ready. This is usually the admin account.

Configuration

To add the OpenWrt (luci) hub to your Home Assistant instance, use this My button:

Manual configuration steps

If the above My button doesn’t work, you can also perform the following steps manually:

  • Browse to your Home Assistant instance.

  • Go to Settings > Devices & services.

  • In the bottom right corner, select the Add Integration button.

  • From the list, select OpenWrt (luci).

  • Follow the instructions on screen to complete the setup.

Host

The hostname or IP address of your router, for example 192.168.1.1.

Username

The username of a user with administrative privileges on the router, usually admin.

Password

The password for that account.

SSL

Connect to the router over HTTPS. Enabled by default. Turn this off if your router only serves the LuCI interface over HTTP.

Verify SSL certificate

Verify the router’s SSL certificate. Disabled by default, because most routers use a self-signed certificate. Only enable this if your router presents a certificate that Home Assistant can validate.

If the credentials for your router change later, Home Assistant asks you to enter the new username and password so it can reconnect. You don’t need to remove and add the integration again.

Supported functionality

For each device it finds on the router, the integration creates a device trackerDevice trackers are used to track the presence, or location, of a device. [Learn more] entity that shows whether the device is home or away. Each entity also exposes the device’s IP address, hostname, and MAC address.

To choose which devices to track and how they are shown, see the device tracker integration page.

Known limitations

Some OpenWrt installations are affected by a small bug where the timeout for LuCI RPC calls is not set, which makes the calls fail. To fix this on your router, you can apply the change manually to the /usr/lib/lua/luci/controller/rpc.lua file, or set a fixed timeout. The default is 3600.

Removing the integration

This integration follows standard integration removal. No extra steps are required.

To remove an integration instance from Home Assistant

  1. Go to Settings > Devices & services and select the integration card.
  2. From the list of devices, select the integration instance you want to remove.
  3. Next to the entry, select the three dots menu. Then, select Delete.