Passive BLE Monitor integration

I think there are two ways.

Method 1 is disabling the entities in HA:
Go to your entity you don’t want to see anymore and Turn of the slider at Enable entity under Advanced settings. Do this for all the entities. I haven’t tried this method myself, so it might not work (as indicated in the picture, last line).

image

Method 2 is removing it from BLE monitor.

  • You will have to prevent the device from coming back first. Do this by setting the option discovery: false and click submit. Note that new devices won’t be added automatically anymore.
  • Next, reopen the ble montior options menu again and select the device you want to remove at the bottom at the devices option. Click submit and type a - at the mac address field. This should remove the device from the configuration (but not yet from HA, as it is still in the registry), so it won’t be updated anymore.
  • restart HA
  • After the restart, go to integrations, and open the devices button on the BLE monitor tile. Select your device (if still there) and click on each entity (temperature, humidity, etc) and click on remove entity
  • After all entities are gone, the final step is to remove the device. Unfortunately HA doesn’t have a remove device button, so we have created a service for that. Go to Developer Tools, services, and select ble_monitor.cleanup_entries. Click on call service and the device should be deleted.

2 Likes

Same issue as jonescc here, have you gone any further jones ?

Any more information on how to use device tracker functionalities?

I’ve added MAC of my iphone and watch into the Configuration UI. Ticked track device. Then waited many hours and restarted a few times, also had the phone in bluetooth searching mode during HA restart. The device never shows up as a device_tracker.

Mac comes from HA built-in device tracker, so is 100% correct. I had commented everything out in known-devices file and removed the HA bluetooth tracker.

Could it be phones doesn’t do BLE?

I think phones randomise BT mac address for security/privacy reasons, so not possible to track. Generic info here.

iPhone specific info here

1 Like

Hum… Yes you are right. Thank you for the links.

The previous device_tracker integration I used was bluetooth_tracker. So it was tracking via classic bluetooth, not BLE.

This integration is for tracking via BLE. That’s why it won’t work for me.

Time to find another bluetooth interface…

Just updated from an old version and am getting this

021-07-28 17:17:17 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 213, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 197, in async_configure
    user_input = cur_step["data_schema"](user_input)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 386, in validate_mapping
    cval = cvalue(key_path, value)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 741, in __call__
    'value must be one of {}'.format(sorted(self.container)))
TypeError: '<' not supported between instances of 'bool' and 'str'

when I try to save the config.

I’ll delete the component and reinstall but I’m rather afraid I will have to set up all my sensors again :frowning:

I reinstalled and now it is not finding anything.

I have these LYWSDCGQ devices. Before, the add-on just found them. New is not always better :frowning:

What do I need to do (nothing in logs).

It also seems to only be trying on one interface

2021-07-28 17:28:39 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] 0 MiBeacon BLE ADV messages processed for 0 binary sensor device(s) total. Priority queue = 0
2021-07-28 17:28:39 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] 0 BLE ADV messages processed last 60 seconds for 0 device tracker device(s).
2021-07-28 17:28:39 DEBUG (MainThread) [custom_components.ble_monitor.sensor] 0 BLE ADV messages processed for 0 measuring device(s).

So for some reason, I have the same mac address twice.

image

Now i see

2021-07-28 17:46:31 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] 0 MiBeacon BLE ADV messages processed for 0 binary sensor device(s) total. Priority queue = 0
2021-07-28 17:46:31 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] 0 BLE ADV messages processed last 60 seconds for 0 device tracker device(s).
2021-07-28 17:46:31 DEBUG (MainThread) [custom_components.ble_monitor.sensor] 0 BLE ADV messages processed for 0 measuring device(s).
2021-07-28 17:46:31 ERROR (Thread-110) [custom_components.ble_monitor] HCIdump thread: Runtime error while sending scan request on hci0: Event loop stopped before Future completed.
2021-07-28 17:46:31 DEBUG (Thread-110) [custom_components.ble_monitor] HCIdump thread: start main event_loop

still the mac address twice.

Robooted Blue.
Reinstalled add-on
reinstalled component

all to no avail!

[edit]
Managed to get rid of the duplicate Mac address - removed all BT devices, rebooted core, reloaded component, added in BT device, reloaded component and just one mac address loaded.

Still same errors and no devices found.

[edit]
Added in the second BT device (bought 2 at same time) and this reports as the same mac address so I now have both again :angry: .

Can we go back to HCI interfaces please?

So even though there are 2 physical devices attatched, ony one hci interface is being queried.

Two dongles with the same MAC will confuse the system. You could try to use YAMl configuration, YAML still supports configuration with hci numbers.

What the UI config does is asking the system for the available MACs by checking hci0, 1, 2 and 3 and when you select one, it will use the corresponding hci number. But if both dongles have the same MAC, I can understand the system gets upset and will only use the first hci.

Edit: it seems possible to change the MAC, maybe a better solution? Change your bluetooth device mac-address - petrilopia.net
It will reset however after unplugging, so it seems.

Or this link works on Debian [SOLVE] BlueTooth Dongle - Change mac address - Debian User Forums

1 Like

Thanks. I ended up doing an upgrade of core to latest and it all seems to be running again now. Just need to remind myself how to rename the entities so my current config picks them up.

1 Like

Important update 4.3.1

In the next Home Assistant update (2021.8) there will be a breaking change for custom components, including BLE monitor. Make sure you update BLE monitor to 4.3.1 (or higher), if you want BLE monitor to continue working after HA 2021.8.

Other updates

In the last few updates, we have added support for

  • Govee H5178
  • Teltonika Blue Puck RHT
  • Teltonika Blue Puck T

How the f you add Yeelight YLKG08YL to HA via BLE gui ?
I been banging my head to wall for couple of days now.
After pressing send button, Yeelight YLKG08YL wont appear to home assistant…

Any advise ?

You settings look ok, you can turn of report_unknown: "Xiaomi". You could try to enable debug logging to see if you have any errors. Do you have other sensors and are these working? Is your dimmer within the bluetooth range of your HA machine?

Thanks for fast reply. Do you mean i should put report_unknown: to false ?
It cant be blank or you cant press send button.

I have 6 LYWSD03MMC sensors and they are working fine. At this moment, i have yeelight next to my ha machine, so it is really close.

Yes, you can set it to false. But this setting doesn’t affect the working, it only reports unknown sensors that are not supported by ble_monitor yet, so it is for developing purposes only. Try to enable debug logging to see if you get any strange messages. The FAQ has an explanation on how to enable debug logging in HA.

Thanks for reply again.
Here is 60sec dumb from debug

Summary

2021-08-01 12:22:13 DEBUG (MainThread) [custom_components.ble_monitor.sensor] 6 BLE ADV messages processed for 6 measuring device(s).
2021-08-01 12:22:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: main event_loop stopped, finishing
2021-08-01 12:22:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: Scanning will be restarted
2021-08-01 12:22:13 DEBUG (Thread-3) [custom_components.ble_monitor] 703 HCI events processed for previous period.
2021-08-01 12:22:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: Run
2021-08-01 12:22:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: connected to hci0
2021-08-01 12:22:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: start main event_loop
2021-08-01 12:22:15 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘rssi’: -78, ‘mac’: ‘A4C1382116B3’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 17, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘temperature’: 22.5, ‘humidity’: 56.0}
2021-08-01 12:22:16 DEBUG (MainThread) [custom_components.ble_monitor.config_flow] async_step_init user_input: {‘bt_interface’: [‘B8:27:EB:22:98:48’], ‘period’: 60, ‘discovery’: True, ‘active_scan’: False, ‘decimals’: 1, ‘log_spikes’: False, ‘use_median’: False, ‘restore_state’: False, ‘report_unknown’: False, ‘devices’: ‘F8:24:41:C5:E8:22’}
2021-08-01 12:22:16 DEBUG (MainThread) [custom_components.ble_monitor.config_flow] async_step_init (after): {‘bt_interface’: [‘B8:27:EB:22:98:48’], ‘period’: 60, ‘discovery’: True, ‘active_scan’: False, ‘decimals’: 1, ‘log_spikes’: False, ‘use_median’: False, ‘restore_state’: False, ‘report_unknown’: False, ‘devices’: ‘F8:24:41:C5:E8:22’}
2021-08-01 12:22:17 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘rssi’: -69, ‘mac’: ‘A4C13833A86E’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 61, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘temperature’: 21.9, ‘humidity’: 56.0}
2021-08-01 12:22:28 DEBUG (MainThread) [custom_components.ble_monitor.config_flow] async_step_add_device: {‘mac’: ‘F8:24:41:C5:E8:22’, ‘encryption_key’: ‘9F2AA885D2734D3DFE7240EC’, ‘decimals’: ‘default’, ‘use_median’: ‘default’, ‘restore_state’: ‘default’, ‘reset_timer’: 1, ‘track_device’: False, ‘tracker_scan_interval’: 20, ‘consider_home’: 180, ‘temperature_unit’: ‘°C’}
2021-08-01 12:22:51 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {‘temperature’: 22.7, ‘humidity’: 59, ‘voltage’: 2.64, ‘battery’: 45, ‘data’: True, ‘rssi’: -84, ‘mac’: ‘A4C13809AACB’, ‘type’: ‘ATC’, ‘packet’: 30, ‘firmware’: ‘ATC (Atc1441)’}
2021-08-01 12:22:51 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘temperature’: 22.7, ‘humidity’: 59, ‘voltage’: 2.64, ‘battery’: 45, ‘data’: True, ‘rssi’: -84, ‘mac’: ‘A4C13809AACB’, ‘type’: ‘ATC’, ‘packet’: 30, ‘firmware’: ‘ATC (Atc1441)’}
2021-08-01 12:22:51 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {‘rssi’: -78, ‘mac’: ‘A4C1382116B3’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 18, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘battery’: 61, ‘voltage’: 2.749}
2021-08-01 12:22:51 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘rssi’: -78, ‘mac’: ‘A4C1382116B3’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 18, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘battery’: 61, ‘voltage’: 2.749}
2021-08-01 12:22:54 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {‘temperature’: 23.2, ‘humidity’: 58, ‘voltage’: 2.928, ‘battery’: 80, ‘data’: True, ‘rssi’: -68, ‘mac’: ‘A4C1389100F2’, ‘type’: ‘ATC’, ‘packet’: 150, ‘firmware’: ‘ATC (Atc1441)’}
2021-08-01 12:22:54 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘temperature’: 23.2, ‘humidity’: 58, ‘voltage’: 2.928, ‘battery’: 80, ‘data’: True, ‘rssi’: -68, ‘mac’: ‘A4C1389100F2’, ‘type’: ‘ATC’, ‘packet’: 150, ‘firmware’: ‘ATC (Atc1441)’}
2021-08-01 12:22:58 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {‘rssi’: -79, ‘mac’: ‘A4C13825ED87’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 174, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘battery’: 47, ‘voltage’: 2.623}
2021-08-01 12:22:58 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘rssi’: -79, ‘mac’: ‘A4C13825ED87’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 174, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘battery’: 47, ‘voltage’: 2.623}
2021-08-01 12:23:02 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] Data binary sensor received: {‘rssi’: -73, ‘mac’: ‘A4C13833A86E’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 62, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘battery’: 46, ‘voltage’: 2.6140000000000003}
2021-08-01 12:23:02 DEBUG (MainThread) [custom_components.ble_monitor.sensor] Data measuring sensor received: {‘rssi’: -73, ‘mac’: ‘A4C13833A86E’, ‘type’: ‘LYWSD03MMC’, ‘packet’: 62, ‘firmware’: ‘Xiaomi (MiBeacon V3)’, ‘data’: True, ‘battery’: 46, ‘voltage’: 2.6140000000000003}
2021-08-01 12:23:10 DEBUG (MainThread) [custom_components.ble_monitor.device_tracker] 0 BLE ADV messages processed last 60 seconds for 0 device tracker device(s).
2021-08-01 12:23:13 DEBUG (MainThread) [custom_components.ble_monitor.binary_sensor] 5 MiBeacon BLE ADV messages processed for 0 binary sensor device(s) total. Priority queue = 0
2021-08-01 12:23:13 DEBUG (MainThread) [custom_components.ble_monitor.sensor] 7 BLE ADV messages processed for 6 measuring device(s).
2021-08-01 12:23:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: main event_loop stopped, finishing
2021-08-01 12:23:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: Scanning will be restarted
2021-08-01 12:23:13 DEBUG (Thread-3) [custom_components.ble_monitor] 806 HCI events processed for previous period.
2021-08-01 12:23:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: Run
2021-08-01 12:23:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: connected to hci0
2021-08-01 12:23:13 DEBUG (Thread-3) [custom_components.ble_monitor] HCIdump thread: start main event_loop

EDIT: If i add dimmer via yaml, it will work like charm. But all LYWSD03MMC sensors wont work because i have added them via gui.

EDIT2: When i used yaml, it seems that passive ble integradion added my LYWSD03MMC sensors again with different entitity id. I just edit new entities id to old name and removed old entititys from HA.
I also disabled confid from yaml, but i still had to do edit. I can also see my yeelight dimmer now, so everything is working now. Very weird.

Switching back to YAML can cause BLE monitor to make new entities. Good that it works now, but indeed strange that it didn’t when configuring it in the UI. Should not make a difference. The only thing I notice now is that the temperature field is empty in the print screen. Normally the UI doesn’t like empty fields.

Hello everybody!
I’m new to HASS, and trying to use BLE Monitor with HASS on RPI3.
I have issues with built-in Bluetooth, and wanted to search for an USB dongle with full-size antenna, as described here: ble_monitor/faq.md at b2c14e47979e73127d51398e8fa432122f6c6b18 · custom-components/ble_monitor · GitHub

However, all I could find so far is this based on CC2540, which is advertised as a Bluetooth packet capture: Wireless Zigbee CC2531 CC2540 Sniffer Bare Board Packet Protocol Analyzer USB Interface Dongle Capture Packet Module + Antenna|Integrated Circuits| - AliExpress

Do you know if it can act as a “normal” bluetooth dongle? Are there any alternatives?
Search on Amazon and AliExpress doesn’t show a lot of options for bluetooth, there are just wifi dongles with an external antenna…

Gathering the encryption key does not appear to work for the CGDK2, unless I’m missing something. I have 4 of these devices, all stall at ‘Do Activation’. Before I try to reverse engineer the problem, are there extra steps not listed in the documentation that people have taken to get the encryption key?

Developer tools in chrome display this as the output after connecting and pressing “Do Activation”:

Send: a2000000
Enc_19: 000000000100
Send: 00000101
Enc_19: 010001000000
Send: 00000100
Send: 15000000
Send: 000000030400

At this point, the Web Tool sits and waits indefinitely.

From this post, I understand that @Magalex is using this antenna with good results.

For example, FSC-BP119 - this is what works for me, and in combination with a 9dbi omnidirectional antenna (looks like TL-ANT2409CL) it receives data from a sensor located behind three brick walls at a distance of about 20 meters with RSSI about 70 dBm.

1 Like

I’m suspecting that high number of RuuviTag events are causing slowness to history graphs. Loading 2-10 days of history can take 30 seconds and sometimes even longer on my Raspberry Pi 4. I’ve understood that Period configuration parameter should be limiting the number of events recorded and I’ve set it to 60. However, it might be that is not working properly. The max history I’m storing is 10 days and I have 7 RuuviTags.

I can listen state_changed events with developer tools and see the amount of events. In about 20 seconds I’m getting that max 30 events or so. From there I can see multiple (3-6) updates from the same sensors for motion and acceleration. For the other types of data I’m getting only one event. Is this as it should work or should the acceleration and motion be limited? On a quick and isolated test I disabled all motion and acceleration entities and the graphs were fast. After enabling couple of the motion sensors the slowness started to build.