- Sensors:
- Wireless clients counters
- Number of connected mesh peers
- Signal strength of mesh links
mwan3interface online ratio- WAN interfaces Rx&Tx bytes counters (if configured)
- Switches:
- Control WPS status
- Binary sensors:
mwan3connectivity status
- Services:
- Reboot device:
openwrt.reboot - Execute arbitrary command:
openwrt.exec(see the configuration below) - Manage services using command-line:
openwrt.init(see the configuration below)
- Reboot device:
-
OpenWrt device(s):
- Make sure that
uhttpd uhttpd-mod-ubus rpcdpackages are installed (if you use custom images)- If you use mesh networks, install
rpcd-mod-iwinfopackage
- If you use mesh networks, install
- Make sure that
ubusis available via http using the manual: https://openwrt.org/docs/techref/ubus- To make it right, please refer to the
Ubus configurationsection below
- To make it right, please refer to the
- Make sure that
-
Home Assistant:
- Add this repo as a custom integration using HACS
- Restart server
- Go to
Integrationsand add a newOpenWrtintegration
- Create new file
/usr/share/rpcd/acl.d/hass.json:
- Add new system user
hass(or do it in any other way that you prefer):- Add line to
/etc/passwd:hass:x:10001:10001:hass:/var:/bin/false - Add line to
/etc/shadow:hass:x:0:0:99999:7::: - Change password:
passwd hass
- Add line to
- Edit
/etc/config/rpcdand add:
config login
option username 'hass'
option password '$p$hass'
list read hass
list read unauthenticated
list write hass
- Restart rpcd:
/etc/init.d/rpcd restart
In order to allow ubus/rpcd execute a command remotely, the command should be added to the permissions ACL file above. The extra configuration could look like below (gives permission to execute uptime command):
{
"hass": {
"write": {
"ubus": {
/* ... */
"file": ["exec"]
},
"file": {
/* ... */
"/usr/bin/uptime": ["exec"]
}
},
}
}In order to allow ubus/rpcd execute a command remotely, the command should be added to the permissions ACL file above. The extra configuration could look like below (gives permission to manage presence-detector service. Start, stop, restart, enable and disable system services.):
{
"hass": {
"write": {
"ubus": {
/* ... */
"rc": ["init"]
},
"rc": {
/* ... */
"/etc/init.d/presence-detector": ["init"]
}
},
}
}

{ "hass": { "description": "Home Assistant OpenWrt integration permissions", "read": { "ubus": { "network.wireless": ["status"], "network.device": ["status"], "iwinfo": ["info", "assoclist"], "hostapd.*": ["get_clients", "wps_status"], "system": ["board"], "mwan3": ["status"] }, }, "write": { "ubus": { "system": ["reboot"], "hostapd.*": ["wps_start", "wps_cancel"] } } } }