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.

Configuration options

To change the options, go to Settings > Devices & services, select the OpenWrt (luci) integration, and select Configure.

Seconds to consider a device at 'home'

The time a device stays home after the router stops reporting it. The default is 180 seconds. You can set any value between 0 and 900 seconds. Increase this if devices that go to sleep, such as phones, switch between home and away too often. Set it to 0 to mark a device as away as soon as the router no longer reports it.

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.

When the router stops reporting a device, the entity stays home until the time set in Seconds to consider a device at ‘home’ has passed. While the device is still considered home, it keeps its last known IP address and hostname. This keeps short dropouts, such as a phone that puts its Wi-Fi to sleep, from looking like someone left the house.

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.

Troubleshooting

Some device trackers are missing or no longer updating

Symptom: “Remove leftover known devices for OpenWrt (luci)”

Home Assistant shows a repair issue titled Remove leftover known devices for OpenWrt (luci), and some of the device trackers created by this integration are missing or stopped updating.

Description

Earlier versions of this integration stored the devices it tracked in the known_devices.yaml file. The integration now creates its own entities instead, but leftover entries in that file use the same entity IDs. Because of that, the new entities are dropped when Home Assistant starts.

Resolution

  1. Open the known_devices.yaml file in your Home Assistant configuration directory (the same place as your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file).
  2. Remove the entries listed in the repair issue.
  3. Restart Home Assistant.

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.