View your AirVPN stats in Home Assistant
This custom integration allows you to view your AirVPN user and session statistics directly in Home Assistant. It polls the AirVPN API every 10 minutes (600 seconds) to provide up-to-date information on your account and active VPN sessions.
- User Stats: View your account's premium status, connected status, and expiration date.
- Session Details: For each active VPN session, a separate device is created in Home Assistant with a set of sensors for details like server name, IP addresses, country, and data transfer rates.
- Copy the
airvpnfolder from this repository into your Home Assistant'scustom_componentsdirectory. - Restart Home Assistant.
The AirVPN integration is configured via the Home Assistant UI.
- Add through hacs
- Go to Settings > Devices & Services.
- Click the Add Integration button.
- Search for AirVPN.
- Enter your AirVPN API key when prompted. You can find your API key on your AirVPN client page, then API
The integration creates the following sensors:
A device named after your AirVPN username is created with the following sensors:
sensor.airvpn_expiration_days: Days until your account expires.sensor.airvpn_credits: Number of credits on your account.binary_sensor.airvpn_connected: State of your VPN connection (on/off).binary_sensor.airvpn_premium: Your account's premium status (on/off).
This integration first fetches a list of all your configured VPN devices from the AirVPN API. For each device, it creates a corresponding HA device with the same name (e.g., "Router").
It then checks your active sessions and attaches the following sensors to the correct device if a session is currently running. These sensors will show "unknown" when the device is not connected to a VPN session.
sensor.router_status: The connection status of the device (e.g., "ready").sensor.router_server_name: The name of the server you're connected to.sensor.router_vpn_ip: The assigned VPN IP address.sensor.router_bytes_read: Total bytes read from the connection.sensor.router_bytes_written: Total bytes written to the connection.sensor.router_read_speed: Current download speed.sensor.router_write_speed: Current upload speed.