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-rpcOn OpenWrt versions that use the older package manager, use
opkg updateandopkg install luci-mod-rpcinstead. -
Have the password for your router’s
rootaccount ready. The LuCI RPC package only works with therootaccount.
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.
-
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.
The username to log in to the router. Use root, the only account that works with the LuCI RPC package.
Connect to the router over HTTPS. Enabled by default. Turn this off if your router only serves the LuCI interface over HTTP.
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.
The integration polls the router every 30 seconds. When the router stops reporting a device, the entity changes to away at the next poll. It keeps its last known IP address and hostname.
To prevent a brief disconnection from starting an automation, use a State changed trigger with To set to Away and a For at least duration. The automation runs only if the device stays away for that duration. This delays only the automation, not the device tracker’s state change.
To choose which devices to track and how they are shown, see the device tracker integration page.
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
- Open the
known_devices.yamlfile in your Home Assistant configuration directory (the same place as yourconfiguration.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). - Remove the entries listed in the repair issue.
- 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
- Go to Settings > Devices & services and select the integration card.
- Next to the entry you want to remove, select the three dots
menu. Then, select Delete. - Depending on the integration, the entries are listed under one of the following headings:
- Devices
- Hubs
- Services
- Integration entries
- Depending on the integration, the entries are listed under one of the following headings:
- To confirm, select Delete.
- Home Assistant also deletes the devices and entities of the entry.
- If Home Assistant asks you to restart, restart Home Assistant.
- If Home Assistant asks whether to also delete the application credentials, select Remove or Keep.
- If you keep them, Home Assistant uses them automatically when you add the integration again.
- To delete them later, refer to Deleting application credentials.