A Home Assistant custom integration that subscribes to MQTT topics published by Ruuvi Gateways and forwards BLE advertisements to Home Assistant's Bluetooth backend.
- Repository type: HACS Integration (Custom Repository)
- Installation mode: repository-based (
zip_release: false) - Add directly in HACS via the one-click badge above or by URL:
https://github.com/eburi/hass_ruuvi_gateway_bluetooth_proxy
This integration uses Home Assistant's built-in MQTT integration. It does not connect to MQTT directly.
You must have the MQTT integration configured and connected in Home Assistant before using this integration.
- 🔌 Uses HA's Built-in MQTT - No external MQTT libraries, relies on Home Assistant's existing MQTT connection
- 📡 Bluetooth Scanner Registration - Properly registers each Ruuvi Gateway as a remote Bluetooth scanner with HA's Bluetooth manager
- 🏠 Device Hierarchy - Creates organized device structure: Gateway devices with linked Bluetooth scanner devices
- 📶 Gateway Status Monitoring - Real-time online/offline status via MQTT gw_status messages
- 🎯 Flexible Filtering - Whitelist gateways and devices, per-gateway RSSI filtering
- 📦 Intelligent Batching - Coalesces observations within a configurable window to reduce processing
- 🔄 Timestamp Synchronization - Converts gateway timestamps to monotonic time for accurate tracking
- 📊 Diagnostics & Debug Sensors - Optional sensors for monitoring packet statistics
- 🔧 Full Config Flow - Easy setup and configuration through the UI
- 🎨 Material Design Icons - Custom icons for all entity types
- Ruuvi Gateway publishes BLE advertisements to MQTT topics in format:
ruuvi/<gateway_mac>/<ble_device_mac> - This Integration subscribes to those topics using HA's MQTT integration
- Device Creation - Automatically creates Gateway device for each discovered gateway
- Scanner Registration - Registers each gateway as a remote Bluetooth scanner using
async_register_scanner- Bluetooth integration automatically creates scanner device in
bluetoothdomain - Scanner device is linked to gateway device via
source_device_id
- Bluetooth integration automatically creates scanner device in
- Status Monitoring - Subscribes to
ruuvi/<gateway_mac>/gw_statusfor real-time online/offline tracking - Parses & Forwards - Parses BLE advertisement data and forwards it to HA's Bluetooth backend with proper timestamps
- Integration Ready - Bluetooth-based integrations (like Bermuda BLE Trilateration) automatically detect and use the scanners
Configure the MQTT integration in Home Assistant:
- Go to Settings → Devices & Services
- Click Add Integration
- Search for MQTT
- Configure your MQTT broker connection
Configure your Ruuvi Gateway to publish to MQTT:
- Access your Ruuvi Gateway configuration interface
- Set up MQTT connection to your broker
- Enable BLE advertisement publishing
- Note the topic prefix (default is
ruuvi/)
- Open HACS in Home Assistant
- Click on "Integrations"
- Click the three dots in the top right and select "Custom repositories"
- Add
https://github.com/eburi/hass_ruuvi_gateway_bluetooth_proxyas an Integration - Search for "Ruuvi Gateway Bluetooth Proxy"
- Click Install
- Restart Home Assistant
- Copy the
custom_components/ruuvi_gateway_bt_proxydirectory to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
- Go to Settings → Devices & Services
- Click Add Integration
- Search for Ruuvi Gateway Bluetooth Proxy
- Configure the integration:
| Option | Default | Description |
|---|---|---|
| MQTT Topic Prefix | ruuvi/ |
The prefix for MQTT topics (will be normalized to end with /) |
| MQTT QoS | 0 |
Quality of Service level (0, 1, or 2) |
| Gateway Whitelist | (empty) | Comma-separated MAC addresses of gateways to accept (empty = all) |
| Device Whitelist | (empty) | Comma-separated BLE device MAC addresses to accept (empty = all) |
| Batch Window (ms) | 250 |
Time window for coalescing observations (50-5000ms) |
| Enable Debug Entity | false |
Enable debug sensors for monitoring statistics |
The integration automatically creates the following devices and entities:
- Purpose: Houses integration-level statistics and debug information
- Entities (only if debug entities enabled):
sensor.packets_received- Total packets received from MQTTsensor.packets_forwarded- Packets successfully forwarded to Bluetooth backendsensor.packets_dropped- Packets filtered or droppedsensor.active_gateways- Number of active gateways (with MAC addresses in attributes)
-
Gateway Device - Represents the physical Ruuvi Gateway (in
ruuvi_gateway_bt_proxydomain)- Entities:
binary_sensor.<gateway>_status- Gateway online/offline status (from MQTT gw_status)number.<gateway>_rssi_filter- Per-gateway RSSI filter threshold
- Entities:
-
Bluetooth Scanner Device - Automatically created by HA's Bluetooth integration (in
bluetoothdomain)- Purpose: Registered as a Bluetooth scanner source in HA's Bluetooth manager
- Linked to: Gateway device via
source_device_id - Visible to: Bermuda and other Bluetooth-based integrations
- Scanner Source: Gateway MAC address (e.g.,
C1:05:28:BF:A7:E7) - Note: Assign an Area to this device for Bermuda to use it for location tracking
- Automatic: Created by Bluetooth integration when scanner is registered with
async_register_scanner
Each Ruuvi Gateway device has an RSSI Filter number entity that allows you to set the minimum RSSI threshold for that specific gateway. Advertisements with RSSI below this threshold will be filtered out.
- Default:
-127(no filtering) - Range:
-127to0dBm - Step:
1dBm - Location: Settings → Devices & Services → Ruuvi Gateway Bluetooth Proxy → [Gateway Device] → Controls → RSSI Filter
This allows you to optimize filtering per gateway based on location and environment. For example, you might set a higher threshold (e.g., -70) for a gateway in a central location to only capture nearby devices, while leaving a remote gateway at the default to capture all devices.
Basic setup:
- Topic Prefix:
ruuvi/ - All other options at defaults
- Per-gateway RSSI filters at default
-127(no filtering)
Filtered setup for presence detection:
- Topic Prefix:
ruuvi/ - Gateway Whitelist:
C1:05:28:BF:A7:E7, AA:BB:CC:DD:EE:FF - Device Whitelist: (empty - track all devices)
- Batch Window:
500 - Enable Debug Entity:
✓ - Per-gateway RSSI filters:
- Central gateway:
-60(only nearby devices) - Remote gateways:
-80(wider range)
- Central gateway:
- Important: Assign Areas to Bluetooth scanner devices for Bermuda location tracking
The integration subscribes to topics matching:
<prefix>+/+ # BLE advertisements
<prefix>+/gw_status # Gateway status messages
Default: ruuvi/+/+ and ruuvi/+/gw_status
ruuvi/<GATEWAY_MAC>/<BLE_DEVICE_MAC>
Example: ruuvi/C1:05:28:BF:A7:E7/6B:EF:59:3C:53:D9
{
"gw_mac": "C1:05:28:BF:A7:E7",
"rssi": -49,
"aoa": [],
"gwts": 1768151705,
"ts": 1768151705,
"data": "07FF4C0012020001",
"coords": ""
}rssi- Signal strength (integer)data- Hex string of BLE advertisement datatsorgwts- Unix timestamp (integer, converted to monotonic time)
ruuvi/<GATEWAY_MAC>/gw_status
Example: ruuvi/C1:05:28:BF:A7:E7/gw_status
{
"state": "online"
}or
{
"state": "offline"
}The status is reflected in the binary_sensor.<gateway>_status entity.
When debug entities are enabled, the following sensors are created under the Integration Device:
- Packets Received (
sensor.packets_received) - Total MQTT messages received - Packets Forwarded (
sensor.packets_forwarded) - Successfully forwarded to Bluetooth backend - Packets Dropped (
sensor.packets_dropped) - Dropped due to filtering or errors - Active Gateways (
sensor.active_gateways) - Number of gateways seen in the last activity window- Attributes: Includes list of gateway MAC addresses with last seen timestamps
These sensors use Material Design Icons for consistent UI appearance.
The integration provides comprehensive diagnostics data:
- Go to Settings → Devices & Services
- Find Ruuvi Gateway Bluetooth Proxy
- Click on the integration (not individual devices)
- Click Download Diagnostics
Diagnostics include:
- Configuration (sensitive data redacted)
- Statistics counters (received, forwarded, dropped, filters)
- Gateway information (last seen timestamps, status)
- Registered scanner sources
- RSSI filter values per gateway
- Integration version and runtime info
Error: MQTT integration is not ready
Solution: Ensure the MQTT integration is installed, configured, and connected before adding this integration.
-
Check MQTT Topics: Verify your Ruuvi Gateway is publishing to the correct topics
mosquitto_sub -h <broker> -t "ruuvi/#" -v
-
Check Topic Prefix: Ensure the configured prefix matches what your gateway publishes
-
Enable Debug Logging: Add to
configuration.yaml:logger: default: info logs: custom_components.ruuvi_gateway_bt_proxy: debug
Check the debug sensors or diagnostics to see why packets are being dropped:
invalid_topic- Topic doesn't match expected formatinvalid_json- Payload is not valid JSONinvalid_hex- Data field is missing or invalidfiltered_gateway- Gateway MAC not in whitelistfiltered_device- Device MAC not in whitelistfiltered_rssi- RSSI below minimum threshold
Error: Bluetooth integration is not ready
Solution: Ensure the Bluetooth integration is installed and functional in Home Assistant.
This integration is designed to work seamlessly with the Bermuda BLE Trilateration integration for presence detection:
- Install this integration and configure it
- Install Bermuda from HACS or manually
- Assign Areas to the Bluetooth scanner devices:
- Go to Settings → Devices & Services → Ruuvi Gateway Bluetooth Proxy
- Click on each "Ruuvi Gateway {MAC} Bluetooth Proxy" device
- Click the pencil icon next to the device name
- Assign the device to an Area (e.g., "Living Room", "Bedroom")
- Configure Bermuda - It will automatically detect the Ruuvi Gateway scanners
- Bermuda will use the scanner data for multilateration-based presence detection
Important: Bermuda requires scanners to have an assigned Area to use them for location tracking. Without an area assignment, the scanner will be detected but not used for positioning.
The integration automatically handles multiple Ruuvi Gateways:
- Each gateway is registered as a separate remote Bluetooth scanner with HA's Bluetooth manager
- Scanner source format: Gateway MAC address (e.g.,
C1:05:28:BF:A7:E7) - Bluetooth scanner device automatically created in
bluetoothdomain, linked to gateway device - Observations are coalesced per gateway to optimize processing
- Each gateway has its own status sensor and RSSI filter
- Gateway and Bluetooth scanner devices are created automatically for each discovered gateway
- Device hierarchy: Gateway Device (in ruuvi_gateway_bt_proxy domain) → Bluetooth Scanner Device (in bluetooth domain, auto-created)
If your Ruuvi Gateway uses a custom topic prefix:
- Configure the gateway to use your prefix (e.g.,
custom/ruuvi/) - Set the MQTT Topic Prefix in the integration config to match
pytest tests/custom_components/ruuvi_gateway_bt_proxy/
├── __init__.py # Integration setup and entry management
├── config_flow.py # Configuration UI flow
├── const.py # Constants and configuration keys
├── coordinator.py # Main coordinator (MQTT + Bluetooth logic)
├── advertisement_parser.py # BLE advertisement parsing
├── diagnostics.py # Diagnostics data provider
├── sensor.py # Optional debug sensors
├── binary_sensor.py # Gateway status sensors
├── number.py # Per-gateway RSSI filter entities
├── icons.json # Material Design Icons mapping
├── manifest.json # Integration metadata
└── translations/
└── en.json # English translations
This integration uses only public Home Assistant APIs:
homeassistant.components.mqtt.async_subscribe- MQTT subscription for BLE advertisements and gateway statushomeassistant.components.bluetooth.async_register_scanner- Registers Ruuvi Gateways as remote Bluetooth scannershomeassistant.components.bluetooth.async_get_advertisement_callback- Gets callback for forwarding advertisementshomeassistant.components.bluetooth.BluetoothServiceInfoBleak- Formats advertisement data for the Bluetooth backendhomeassistant.helpers.device_registry- Creates and manages device entries
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add/update tests
- Submit a pull request
This project is licensed under the MIT License.
- Built for use with Ruuvi Gateway
- Designed to complement Bermuda BLE Trilateration
For bug reports, questions, or feature requests, please open an issue on GitHub. When reporting bugs, include Home Assistant version, integration version, and Diagnostics output when possible.