This is a custom Home Assistant integration for monitoring MWAN3 (Multi-WAN) status on OpenWrt routers. It provides real-time status information about your MWAN3 interfaces, including their connection status, tracking information, and detailed statistics.
- Monitor multiple WAN interfaces configured in MWAN3
- Real-time status updates (every 30 seconds)
- Tracks interface status (online/offline)
- Additional attributes:
- Enabled status
- Score
- Connection state (up/down)
- Age
- Turn count
- Online count
- Uptime
- Lost packets
- Offline count
- Running state
- Track IP information (status, latency, packet loss)
- Secure authentication with your router
- Easy configuration through Home Assistant UI
- OpenWrt router with MWAN3 installed and configured
- MWAN3 web interface enabled on your router
- Home Assistant instance (version 2023.1.0 or newer recommended)
- Download this repository
- Copy the
custom_components/mwan3directory to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
- Go to Home Assistant UI → Settings → Devices & Services
- Click the "+ Add Integration" button
- Search for "MWAN3"
- Enter your router's details:
- Router IP Address (e.g., 192.168.1.1)
- Username (your router's admin username)
- Password (your router's admin password)
The integration requires the following information to connect to your router:
- Router IP Address: The IP address of your OpenWrt router
- Username: Your router's admin username
- Password: Your router's admin password
After installation, the integration will create sensors for each MWAN3 interface configured on your router. Each sensor will show:
- Current status (online/offline)
- Additional attributes:
- Enabled: Whether the interface is enabled in MWAN3
- Score: Current interface score
- Up: Whether the interface is up
- Age: Interface age
- Turn: Number of times the interface has turned
- Online: Number of times the interface has been online
- Uptime: Current uptime in seconds
- Lost: Number of lost packets
- Offline: Number of times the interface has been offline
- Running: Whether the interface is running
- Track IP: List of tracking IPs with their status, latency, and packet loss
You can use these sensors in:
- Home Assistant dashboards
- Automations
- Scripts
- Templates
type: entities
entities:
- entity: sensor.router_alias_adsl
- entity: sensor.router_alias_lte
title: MWAN3 Statusautomation:
- alias: "Notify on MWAN3 Interface Down"
trigger:as
platform: state
entity_id: sensor.router_alias_lte
to: "offline"
action:
- service: notify.mobile_app
data:
message: "MWAN3 LTE interface is down!"If you encounter any issues:
- Check that MWAN3 is properly installed and configured on your router
- Verify that the web interface is accessible at
http://<router-ip>/cgi-bin/luci/admin/status/mwan/interface_status - Ensure your router's credentials are correct
- Check the Home Assistant logs for any error messages
Common issues:
- "Could not connect to router": Verify the router's IP address and that it's accessible from your Home Assistant instance
- "Invalid authentication": Check your username and password
- "Unexpected error": Check the Home Assistant logs for detailed error messages
This integration is built using:
- Python 3.9+
- Home Assistant Core
- aiohttp for async HTTP requests
To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you need help or have questions:
- Check the Home Assistant forums
- Open an issue on GitHub
- Check the OpenWrt MWAN3 documentation