Hello,
following this tutorial, I’m trying to setup Bluetooth presence detection with the help of MQTT. I’ve had Mosquitto running already as I’m using two tasmota devices to control them via HA. Thus, a username and password have been setup already. Next, I installed the addon Bluetooth Presence Monitor and configured it as follows:
mqtt:
broker: 127.0.0.1
port: 1883
username: username_from_mosquitto
password: password_from_mosquitto
topic_root: monitor
publisher: main
known:
beacons: []
static:
- 'xx:xx:xx:xx:xx:xx Some Alias'
blacklist: []
log_level: debug
Next, I added a device tracker in my configuration.yaml:
device_tracker:
- platform: mqtt
source_type: 'bluetooth'
devices:
name_bt_mobile: 'monitor/main/some_alias/device_tracker'
After rebooting HA. I expected to find device_tracker.name_bt.mobile under Dev-Tools --> Entities, but there wasn’t. I installed MQTT Explorer on my laptop and subscribed to my MQTT Broker, rebooted the BPM Addon and indeed saw things being posted on topic “monitor/main/some_alias/device_tracker”. I conclude from that, that the addon is working, seeing my phone and transmitting data properly via MQTT.
BPM Log:
From https://github.com/andrewjfreyer/monitor
+ 87d433b...ec0496b master -> origin/master (forced update)
Previous HEAD position was 87d433b Merge pull request #289 from hmmbob/patch-1
HEAD is now at ec0496b Merge pull request #353 from icouper/patch-1
Already up to date.
[16:48:05] INFO: Starting Bluetooth Presence Monitor...
> updated monitor (v. Unknown) -> (v. 0.2.200)...
> using custom config directory [/opt/monitor]
> warning: verbose logging is enabled. this setting is only for informational and debugging purposes
using /opt/monitor as config dir
> preference: minimum time between the same type of scan = 15
> preference: regex filter for flags to accept = .*
> preference: regex filter for flags to reject = NONE
> preference: regex filter for manufacturers to accept = .*
> preference: regex filter for manufacturers to reject = NONE
> preference: maximum sequential arrive scan attempts = 1
> preference: maximum sequential depart scan attempts = 2
> preference: selected HCI device = hci0
> mqtt trigger: monitor/scan/ARRIVE
> mqtt trigger: monitor/scan/DEPART
> xx:xx:xx:xx:xx confidence topic: monitor/main/some_alias (has not previously connected to hci0)
> xx:xx:xx:xx:xx device_tracker topic: monitor/main/some_alias/device_tracker [not_home or home]
> log listener pid = 500
> btle scan pid = 501
> btle text pid = 502
> btle listener pid = 504
> mqtt listener pid = 507
> packet listener pid = 508
> beacon database time trigger pid = 511
/usr/local/bin/monitor: line 1987: [: : integer expression expected
/usr/local/bin/monitor: line 1987: [: : integer expression expected
[-] 0.2.200 29-12-2020 04:48:16 PM [CMD-INFO] **** started arrival scan [x1 max rep] ****
[-] 0.2.200 29-12-2020 04:48:16 PM [CMD-SCAN] (No. 1) xx:xx:xx:xx:xx arrival?
[-] 0.2.200 29-12-2020 04:48:17 PM [CMD-MQTT] monitor/main/some_alias/device_tracker home
[-] 0.2.200 29-12-2020 04:48:17 PM [CMD-MQTT] monitor/main/some_alias
{
"id":"xx:xx:xx:xx:xx",
"confidence":"100",
"name":"Some Alias",
"manufacturer":"Unknown",
"type":"KNOWN_MAC",
"retained":"false",
"timestamp":"Tue Dec 29 2020 16:48:17 GMT+0100 (CET)",
"version":"0.2.200"
}
[-] 0.2.200 29-12-2020 04:48:17 PM [CMD-INFO] **** completed arrival scan ****
In the Mosquitto Log, I have a few of this, not sure if it’s supposed to be that or not:
1609259103: New client connected from 172.30.32.1 as main13139 (p2, c1, k60, u'mqttuser').
1609259103: Client main13139 disconnected.
1609259103: New connection from 172.30.32.1 on port 1883.
1609259103: New client connected from 172.30.32.1 as main13155 (p2, c1, k60, u'mqttuser').
1609259103: Client main13155 disconnected.
1609259103: New connection from 172.30.32.1 on port 1883.
1609259103: New client connected from 172.30.32.1 as main13161 (p2, c1, k60, u'mqttuser').
1609259103: Client main13161 disconnected.
There is nothing else interesting there, just that my laptop listens via MQTT Explorer.
The HA log does not say ANYTHING about the mqtt device_tracker. I’m not posting the log as there might be sensitive data. It does state that it’s subscribed to the topic monitor.
Also, when I go to Settings --> integrations --> MQTT --> Configure --> Listen to “monitor/#” and reboot the BPM addon, it receives data and says that my phone is home (Bluetooth on).
So, everything seems to be configured correctly, but for some reason the mqtt device tracker does not show up. I assume that it should be visible through the entities page, right?