Description
What happened?
Hi,
I would like to use this with HA on Docker using macvlan networking mode instead of host mode. This mode allows to attribute a mac address for the container (HA) on the LAN. This allows for features that would normally require host mode, like DLNA, without the problems of host mode (impossibility to join a Docker virtual network).
I was using BLE Monitor before with host mode, and I would like to use it with macvlan.
I have set my HA this way:
homeassistant:
image: homeassistant/homeassistant:latest
platform: "linux/arm64"
container_name: homeassistant
restart: unless-stopped
privileged: true
networks:
- services
- macvlan
cap_add:
- NET_ADMIN
- NET_RAW
- SYS_ADMIN
environment:
- PUID=0
- PGID=0
- TZ=${TZ}
volumes:
- ${CONFIG_FOLDER}/homeassistant:/config
- /run/dbus:/run/dbus:ro
ports:
- 8123:8123
PUID=0 PGID=0
means I am running as root.
I checked that Bluetooth works on the main system.
The bluetooth adapter is seen by HA's bluetooth integration:
HA's Xiaomi BLE integration automatically found my BLE device (MiScale Body Composition 2) and was able to retrieve the weight:
But this is non-stabilized weight and I would like impedance in addition to this value.
But BLE monitor fails to find the adapter:
I know this is an uncommon setup but I would like to ask for some help and knowledge to dig a bit more into this.
What, in your opinion, could cause this issue with macvlan ? What can cause the adapter to be seen by HA and not by BLE Monitor ? Why can HA's Xiaomi BLE integration receive the weight but not BLE Monitor ?
In the log section, you will find the output if I don't use automatic configuration but rather the following YAML:
ble_monitor:
bt_interface:
- '00:1A:7D:DA:71:15'
discovery: False
devices:
- mac: '0C:95:41:D7:4A:F8'
With this configuration, I have the following error:
2024-01-17 22:18:20.753 ERROR (MainThread) [custom_components.ble_monitor] Bluetooth interface with MAC address 00:1A:7D:DA:71:15 is not available
What could cause the interface to not be available with this config ?
Thanks in advance for any answer and have a great day.
Sensor type
MiScale Body Composition 2
Relevant log output
2024-01-17 22:17:05.405 DEBUG (MainThread) [custom_components.ble_monitor] async_unload_entry: <homeassistant.config_entries.ConfigEntry object at 0x7f75239e40>
2024-01-17 22:17:05.414 DEBUG (MainThread) [custom_components.ble_monitor] HCIdump thread: joining
2024-01-17 22:17:05.418 DEBUG (Thread-2) [custom_components.ble_monitor] HCIdump thread: main event_loop stopped, finishing.
2024-01-17 22:17:05.420 DEBUG (Thread-2) [custom_components.ble_monitor] HCIdump thread: Run finished
2024-01-17 22:17:05.421 DEBUG (MainThread) [custom_components.ble_monitor] HCIdump thread: joined
2024-01-17 22:17:05.421 DEBUG (MainThread) [custom_components.ble_monitor] BLE monitor stopped
2024-01-17 22:17:05.422 DEBUG (MainThread) [custom_components.ble_monitor] Initializing BLE Monitor entry (config entry): <homeassistant.config_entries.ConfigEntry object at 0x7f75239e40>
2024-01-17 22:17:05.422 DEBUG (MainThread) [custom_components.ble_monitor] async_setup_entry: domain {'bt_interface': ['00:1A:7D:DA:71:15'], 'discovery': False, 'devices': [{'mac': '0C:95:41:D7:4A:F8', 'report_unknown': False, 'restore_state': 'default', 'consider_home': 180, 'reset_timer': 35, 'track_device': False, 'use_median': 'default', 'tracker_scan_interval': 20}], 'report_unknown': 'Off', 'restore_state': False, 'batt_entities': True, 'period': 60, 'bt_auto_restart': False, 'hci_interface': [], 'active_scan': False, 'use_median': False, 'log_spikes': False, 'is_flow': False, 'ids_from_name': True}
2024-01-17 22:17:05.423 INFO (MainThread) [custom_components.ble_monitor] Available Bluetooth interfaces for BLE monitor: ["Don't use Bluetooth adapter"]
2024-01-17 22:17:05.423 ERROR (MainThread) [custom_components.ble_monitor] Bluetooth interface with MAC address 00:1A:7D:DA:71:15 is not available
2024-01-17 22:17:05.423 WARNING (MainThread) [custom_components.ble_monitor] No configured Bluetooth interface was found, using default interface instead
2024-01-17 22:17:05.424 DEBUG (MainThread) [custom_components.ble_monitor] HCI interface is ['disable']
2024-01-17 22:17:05.424 DEBUG (MainThread) [custom_components.ble_monitor] async_setup_entry: {'bt_interface': ['disable'], 'discovery': False, 'devices': [{'mac': '0C:95:41:D7:4A:F8', 'report_unknown': False, 'restore_state': 'default', 'consider_home': 180, 'reset_timer': 35, 'track_device': False, 'use_median': 'default', 'tracker_scan_interval': 20}], 'report_unknown': 'Off', 'restore_state': False, 'batt_entities': True, 'period': 60, 'bt_auto_restart': False, 'hci_interface': ['disable'], 'active_scan': False, 'use_median': False, 'log_spikes': False, 'is_flow': False, 'ids_from_name': True}
2024-01-17 22:17:05.427 DEBUG (MainThread) [custom_components.ble_monitor] Spawning HCIdump thread
2024-01-17 22:17:05.427 DEBUG (MainThread) [custom_components.ble_monitor] HCIdump thread: Init
2024-01-17 22:17:05.427 DEBUG (MainThread) [custom_components.ble_monitor] 0 encryptors mac:key pairs loaded
2024-01-17 22:17:05.430 DEBUG (MainThread) [custom_components.ble_monitor] sensor whitelist: [0C:95:41:D7:4A:F8]
2024-01-17 22:17:05.430 DEBUG (MainThread) [custom_components.ble_monitor] 1 sensor whitelist item(s) loaded
2024-01-17 22:17:05.430 DEBUG (MainThread) [custom_components.ble_monitor] 0 device tracker(s) being monitored
2024-01-17 22:17:05.431 DEBUG (Thread-4) [custom_components.ble_monitor] HCIdump thread: Run
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] Starting device tracker entry startup
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] BLE device tracker updater initialization
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] BLE device tracker updater initialized
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] Device Tracker entry setup finished
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Starting binary sensor entry startup
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] BLE binary sensors updater initialization
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] BLE binary sensors updater initialized
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Binary sensor entry setup finished
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Starting measuring sensor entry startup
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.sensor] BLE sensors updater initialization
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.sensor] BLE sensors updater initialized
2024-01-17 22:17:05.440 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Measuring sensor entry setup finished
2024-01-17 22:17:05.441 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] Device tracker updater loop started!
2024-01-17 22:17:05.441 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Binary entities updater loop started!
2024-01-17 22:17:05.441 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Entities updater loop started!
2024-01-17 22:17:05.442 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Entities updater loop stopped
2024-01-17 22:17:05.442 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Entities updater loop stopped
2024-01-17 22:17:05.442 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] Entities updater loop stopped
2024-01-17 22:17:05.443 DEBUG (Thread-4) [custom_components.ble_monitor] HCIdump thread: start main event_loop