[monitor] Reliable, Multi-User, Distributed Bluetooth Occupancy/Presence Detection

Someone above posted this. I saved it to my library in case I needed it… Lol

monitor-watcher.sh

Copy to clipboard
#!/bin/bash
LAST_ACTIVITY=$(date --date="$(journalctl -u monitor -n 1 -o short-iso --utc --quiet|awk ‘{ print $1 }’)" +"%s")

ELAPSED=$(echo “$(date +”%s") - ${LAST_ACTIVITY}"|bc)

if [ ${ELAPSED} -gt 300 ]; then
systemctl restart monitor
fi

system-watcher.sh

Copy to clipboard
#!/bin/bash
dmesg|tail -n 20|grep -q “Fixing recursive fault but reboot is needed!”
if [ ${?} -eq 0 ]; then
/sbin/reboot --no-wall
fi

Hi, I have problem with monitor. I’ve followed instalation guide and I was able to setup monitor.sh on my unused Pi 3B+. I’ve added my and wifes phones, configured Home assistant with sensors and input booleans. At first I thought it worked, because when started, monitor sucessfully found both phones and set confidence level to 100, which resulted in both input_booleans being turned on (so far so good).

Unfortunately, mqtt commands are not working. I want to use mqtt triggers, but without any success. I’ve checked logs, I’ve run monitor with -V flag. I’ve tried sending mqtt messages from HA and external mqtt clients - nothing works (but monitor is connected to mqtt, because it updates sensors one time in HA after start).
I’ve tried echo, adding new device, triggering arrive and departure - nothing works. Monitor isn’t logging anything, it’s just like there were no messages at all.

Please help?

Seems like a problem more people are reporting. I don’t know why, but it made a difference for me to add the -a flag that reports all changes. When I did that I suddenly saw the mqtt messages appearing in the logs. Worth a try I guess.

Unfortunately did not help :frowning:

So I think I got it up running well now. Installed the script above to look for lock ups thru cron. At the moment though, it pretty much never detects my OnePlus 6T. It gets it every now and then but then loses it again. I have had it with screen on right next to the Pi. It detects my wife’s Pixel 3a doing well.

Any ideas here? I thought about resetting my OnePlus 6T to see if that helps?

What does your PREF_PASS_FILTER_MANUFACTURER_ARRIVE look like?

It is empty. Should I call out my phone and my wife’s? I can do -V to see what it’s called?

Today it has been doing very well I will keep monitoring. History in the device_tracker tells me it’s history so I can compare with my wife when she’s home.

You can check the log/console output of monitor to see what’s going on. The fine tuning guide is also going to be helpful here.

How do I pull the log? Does it create a straight log? I suspect monitor is doing its job, just maybe one OnePlus isn’t always broadcasting it? I just updated it here (phone) I will see if that does anything.

Thanks for the help. I plan to donate for th cause here. Where can I do that?

How you grab the log depends on how you’re running it, but journalctl -f -u monitor may work. Failing that, just stop the service and use the command in the link.

Yes that works, but shows the same information that I get when I do the bash and watch. Anything I should be looking for? I also noticed for sure that it doesn’t work when I connect my bluetooth headphones to my phone. I guess the OnePlus 6T stops broadcasting. I suspect this is a 6T issue more than anything… I do have it running well on my Pi Zero now which is awesome. Ran for a few days now without any restarting using your script for checking if it is running. Grabbed a 3 B+ on ebay for cheap, I was considering that, you think that would be a good idea?

For now, I have 2 profiles, one for monitor and one for my router, so it checks both of these to confirm our location. I mainly wanted this to detect when I get home faster so the lights can be on. If it was good enough, maybe even open my garage, but that is not looking likely… Lol

Edit - when I run the bash again it does find my OnePlus 6T with headphones connected… Again, I think this is a 6T issue maybe.

Basically, you’re looking to see if your phone is detected. I’d agree with your summary though, this does sounds like a 6T issue :man_shrugging:

Do you guys have a place to donate?

Would the RP 3B have less WiFi interference where I can scan more often? Or is it more a function of the messages sent? Some guy shave 4 zeros and I was like, that has to be worse than scanning faster but I was getting some interference at faster scans.

Bluetooth will interfere with 2.4 GHz WiFi, that’s just physics.

So that in general is just one of the downsides here on using this scanner I guess eh? Definitely gives me a good secondary, I was hoping it would detect me faster than my home WIFI was. Either way, I am happy with it. Is there a coffee buying link or anything? Haha

Thanks
Joshua

Hello folks,

Think I’m being an idiot. That’s usually the case when I can’t figure something out for myself!

I’m @ version 0.2.197 on a rPi3B+ running nothing but monitor (eclipse mosquitto running in docker on another machine). Been happily using monitor since maybe July without issue.

I run with options: -x -r -a -b (I’ve just put in some xiaomi door sensors so will be switching to node-red-controlled arrival/departure scanning at some point in the near future.

I’ve recently (last two weeks) turned on the “-b” option as I’ve picked up some Tile trackers.

The problem:

There is one bloody public beacon with random MACs that I just can’t seem to correctly blacklist (I presume - but this could be a wrong presumption - that one of the purposes of address_blacklist is to prevent topics being published for stuff you are not interested in); so I keep getting this published MQTT topic: monitor/home/E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0

I’ve put this in address_blacklist along with as many of the MACs that I’ve so far found in association with it when trawling through the log (greping for BEAC), but it keeps reappearing and I’m tearing my hair out.

My address_blacklist contains this line (and one for each random beacon MAC i’ve so far put in):

E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0

This is the offending article extracted from the log:

pi@home:~/monitor $ sudo journalctl -u monitor | grep BEAC
Nov 27 21:18:55 home bash[26105]: [+] 0.2.197 27-11-2019 09:18:55 pm [CMD-RSSI]        BEAC 46:45:45:9A:09:7C RSSI: -103 dBm (initial reading | 97 dBm)
Nov 27 21:18:55 home bash[26105]: [+] 0.2.197 27-11-2019 09:18:55 pm [CMD-BEAC]        46:45:45:9A:09:7C E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 27 21:23:03 home bash[26105]: [+] 0.2.197 27-11-2019 09:23:03 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 257 seconds
Nov 27 21:23:03 home bash[26105]: [+] 0.2.197 27-11-2019 09:23:03 pm [DEL-PUBL]        BEAC 46:45:45:9A:09:7C expired after 257 seconds
Nov 28 08:41:52 home bash[26105]: [+] 0.2.197 28-11-2019 08:41:52 am [CMD-RSSI]        BEAC 7C:3E:5A:9B:65:EF RSSI: -99 dBm (initial reading | 101 dBm)
Nov 28 08:41:52 home bash[26105]: [+] 0.2.197 28-11-2019 08:41:52 am [CMD-BEAC]        7C:3E:5A:9B:65:EF E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 28 08:45:58 home bash[26105]: [+] 0.2.197 28-11-2019 08:45:58 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 252 seconds
Nov 28 08:45:58 home bash[26105]: [+] 0.2.197 28-11-2019 08:45:58 am [DEL-PUBL]        BEAC 7C:3E:5A:9B:65:EF expired after 252 seconds
Nov 28 08:50:59 home bash[26105]: [+] 0.2.197 28-11-2019 08:50:59 am [CMD-RSSI]        BEAC 7C:3E:5A:9B:65:EF RSSI: -98 dBm (initial reading | 102 dBm)
Nov 28 08:50:59 home bash[26105]: [+] 0.2.197 28-11-2019 08:50:59 am [CMD-BEAC]        7C:3E:5A:9B:65:EF E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0 Undeterminable
Nov 28 08:55:18 home bash[26105]: [+] 0.2.197 28-11-2019 08:55:18 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 259 seconds
Nov 28 08:55:18 home bash[26105]: [+] 0.2.197 28-11-2019 08:55:18 am [DEL-PUBL]        BEAC 7C:3E:5A:9B:65:EF expired after 259 seconds
Nov 28 09:30:29 home bash[26105]: [+] 0.2.197 28-11-2019 09:30:29 am [CMD-RSSI]        BEAC 52:8C:97:55:2C:AF RSSI: -100 dBm (initial reading | 100 dBm)
Nov 28 09:30:29 home bash[26105]: [+] 0.2.197 28-11-2019 09:30:29 am [CMD-BEAC]        52:8C:97:55:2C:AF E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 28 09:34:39 home bash[26105]: [+] 0.2.197 28-11-2019 09:34:39 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 260 seconds
Nov 28 09:34:39 home bash[26105]: [+] 0.2.197 28-11-2019 09:34:39 am [DEL-PUBL]        BEAC 52:8C:97:55:2C:AF expired after 260 seconds
Nov 28 15:31:18 home bash[26105]: [+] 0.2.197 28-11-2019 03:31:18 pm [CMD-RSSI]        BEAC 51:75:E6:B4:1F:46 RSSI: -101 dBm (initial reading | 99 dBm)
Nov 28 15:31:18 home bash[26105]: [+] 0.2.197 28-11-2019 03:31:18 pm [CMD-BEAC]        51:75:E6:B4:1F:46 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 28 15:35:26 home bash[26105]: [+] 0.2.197 28-11-2019 03:35:26 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 253 seconds
Nov 28 15:35:26 home bash[26105]: [+] 0.2.197 28-11-2019 03:35:26 pm [DEL-PUBL]        BEAC 51:75:E6:B4:1F:46 expired after 253 seconds
Nov 28 18:52:51 home bash[26105]: [+] 0.2.197 28-11-2019 06:52:51 pm [CMD-RSSI]        BEAC 50:2B:F7:24:9E:7A RSSI: -97 dBm (initial reading | 103 dBm)
Nov 28 18:52:51 home bash[26105]: [+] 0.2.197 28-11-2019 06:52:51 pm [CMD-BEAC]        50:2B:F7:24:9E:7A E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 28 18:56:51 home bash[26105]: [+] 0.2.197 28-11-2019 06:56:51 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 245 seconds
Nov 28 18:56:51 home bash[26105]: [+] 0.2.197 28-11-2019 06:56:51 pm [DEL-PUBL]        BEAC 50:2B:F7:24:9E:7A expired after 245 seconds
Nov 28 19:04:09 home bash[26105]: [+] 0.2.197 28-11-2019 07:04:09 pm [CMD-RSSI]        BEAC 50:2B:F7:24:9E:7A RSSI: -95 dBm (initial reading | 105 dBm)
Nov 28 19:04:09 home bash[26105]: [+] 0.2.197 28-11-2019 07:04:09 pm [CMD-BEAC]        50:2B:F7:24:9E:7A E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0 Undeterminable
Nov 28 19:08:11 home bash[26105]: [+] 0.2.197 28-11-2019 07:08:11 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 243 seconds
Nov 28 19:08:11 home bash[26105]: [+] 0.2.197 28-11-2019 07:08:11 pm [DEL-PUBL]        BEAC 50:2B:F7:24:9E:7A expired after 243 seconds
Nov 28 19:51:00 home bash[26105]: [+] 0.2.197 28-11-2019 07:51:00 pm [CMD-RSSI]        BEAC 5C:7B:65:8C:31:05 RSSI: -99 dBm (initial reading | 101 dBm)
Nov 28 19:51:00 home bash[26105]: [+] 0.2.197 28-11-2019 07:51:00 pm [CMD-BEAC]        5C:7B:65:8C:31:05 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 28 19:55:12 home bash[26105]: [+] 0.2.197 28-11-2019 07:55:12 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 260 seconds
Nov 28 19:55:12 home bash[26105]: [+] 0.2.197 28-11-2019 07:55:12 pm [DEL-PUBL]        BEAC 5C:7B:65:8C:31:05 expired after 260 seconds
Nov 28 20:14:28 home bash[26105]: [+] 0.2.197 28-11-2019 08:14:28 pm [CMD-RSSI]        BEAC 68:B8:63:0B:98:FF RSSI: -100 dBm (initial reading | 100 dBm)
Nov 28 20:14:28 home bash[26105]: [+] 0.2.197 28-11-2019 08:14:28 pm [CMD-BEAC]        68:B8:63:0B:98:FF E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 28 20:18:32 home bash[26105]: [+] 0.2.197 28-11-2019 08:18:32 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 250 seconds
Nov 28 20:18:32 home bash[26105]: [+] 0.2.197 28-11-2019 08:18:32 pm [DEL-PUBL]        BEAC 68:B8:63:0B:98:FF expired after 250 seconds
Nov 29 08:01:32 home bash[1770]: [+] 0.2.197 29-11-2019 08:01:32 am [CMD-RSSI]        BEAC 53:71:6A:A2:05:7E RSSI: -98 dBm (initial reading | 102 dBm)
Nov 29 08:01:32 home bash[1770]: [+] 0.2.197 29-11-2019 08:01:32 am [CMD-BEAC]        53:71:6A:A2:05:7E E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 29 08:05:37 home bash[1770]: [+] 0.2.197 29-11-2019 08:05:37 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 250 seconds
Nov 29 08:05:37 home bash[1770]: [+] 0.2.197 29-11-2019 08:05:37 am [DEL-PUBL]        BEAC 53:71:6A:A2:05:7E expired after 250 seconds
Nov 30 10:10:44 home bash[28823]: [+] 0.2.197 30-11-2019 10:10:44 am [CMD-RSSI]        BEAC 59:47:DD:81:2E:F6 RSSI: -95 dBm (initial reading | 105 dBm)
Nov 30 10:10:44 home bash[28823]: [+] 0.2.197 30-11-2019 10:10:44 am [CMD-BEAC]        59:47:DD:81:2E:F6 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 30 10:14:45 home bash[28823]: [+] 0.2.197 30-11-2019 10:14:45 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 246 seconds
Nov 30 10:14:45 home bash[28823]: [+] 0.2.197 30-11-2019 10:14:45 am [DEL-PUBL]        BEAC 59:47:DD:81:2E:F6 expired after 246 seconds
Nov 30 15:47:39 home bash[28823]: [+] 0.2.197 30-11-2019 03:47:39 pm [CMD-RSSI]        BEAC 71:FC:AB:40:8D:4C RSSI: -101 dBm (initial reading | 99 dBm)
Nov 30 15:47:39 home bash[28823]: [+] 0.2.197 30-11-2019 03:47:39 pm [CMD-BEAC]        71:FC:AB:40:8D:4C E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Nov 30 15:51:39 home bash[28823]: [+] 0.2.197 30-11-2019 03:51:39 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 246 seconds
Nov 30 15:51:39 home bash[28823]: [+] 0.2.197 30-11-2019 03:51:39 pm [DEL-PUBL]        BEAC 71:FC:AB:40:8D:4C expired after 246 seconds
Dec 01 12:32:37 home bash[31215]: [+] 0.2.197 01-12-2019 12:32:37 pm [CMD-RSSI]        BEAC 48:52:E6:CC:0B:75 RSSI: -101 dBm (initial reading | 99 dBm)
Dec 01 12:32:37 home bash[31215]: [+] 0.2.197 01-12-2019 12:32:37 pm [CMD-BEAC]        48:52:E6:CC:0B:75 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 01 12:36:40 home bash[31215]: [+] 0.2.197 01-12-2019 12:36:40 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 251 seconds
Dec 01 12:36:40 home bash[31215]: [+] 0.2.197 01-12-2019 12:36:40 pm [DEL-PUBL]        BEAC 48:52:E6:CC:0B:75 expired after 251 seconds
Dec 01 15:12:02 home bash[31286]: [+] 0.2.197 01-12-2019 03:12:02 pm [CMD-RSSI]        BEAC 67:5C:89:B6:0E:22 RSSI: -101 dBm (initial reading | 99 dBm)
Dec 01 15:12:02 home bash[31286]: [+] 0.2.197 01-12-2019 03:12:02 pm [CMD-BEAC]        67:5C:89:B6:0E:22 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 01 15:15:58 home bash[31286]: [+] 0.2.197 01-12-2019 03:15:58 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 241 seconds
Dec 01 15:15:58 home bash[31286]: [+] 0.2.197 01-12-2019 03:15:58 pm [DEL-PUBL]        BEAC 67:5C:89:B6:0E:22 expired after 241 seconds
Dec 02 08:45:52 home bash[26808]: [+] 0.2.197 02-12-2019 08:45:52 am [CMD-RSSI]        BEAC 40:D4:D7:9A:A9:62 RSSI: -97 dBm (initial reading | 103 dBm)
Dec 02 08:45:52 home bash[26808]: [+] 0.2.197 02-12-2019 08:45:52 am [CMD-BEAC]        40:D4:D7:9A:A9:62 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 02 08:49:55 home bash[26808]: [+] 0.2.197 02-12-2019 08:49:55 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 250 seconds
Dec 02 08:49:55 home bash[26808]: [+] 0.2.197 02-12-2019 08:49:55 am [DEL-PUBL]        BEAC 40:D4:D7:9A:A9:62 expired after 250 seconds
Dec 02 09:06:38 home bash[26808]: [+] 0.2.197 02-12-2019 09:06:38 am [CMD-RSSI]        BEAC 42:1B:FD:39:F0:B8 RSSI: -100 dBm (initial reading | 100 dBm)
Dec 02 09:06:38 home bash[26808]: [+] 0.2.197 02-12-2019 09:06:38 am [CMD-BEAC]        42:1B:FD:39:F0:B8 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 02 09:10:35 home bash[26808]: [+] 0.2.197 02-12-2019 09:10:35 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 242 seconds
Dec 02 09:10:35 home bash[26808]: [+] 0.2.197 02-12-2019 09:10:35 am [DEL-PUBL]        BEAC 42:1B:FD:39:F0:B8 expired after 242 seconds
Dec 02 15:57:07 home bash[14086]: [+] 0.2.197 02-12-2019 03:57:07 pm [CMD-RSSI]        BEAC 52:F1:BE:EC:5F:BF RSSI: -100 dBm (initial reading | 100 dBm)
Dec 02 15:57:07 home bash[14086]: [+] 0.2.197 02-12-2019 03:57:07 pm [CMD-BEAC]        52:F1:BE:EC:5F:BF E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 02 16:01:21 home bash[14086]: [+] 0.2.197 02-12-2019 04:01:21 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 260 seconds
Dec 02 16:01:21 home bash[14086]: [+] 0.2.197 02-12-2019 04:01:21 pm [DEL-PUBL]        BEAC 52:F1:BE:EC:5F:BF expired after 260 seconds
Dec 02 16:27:57 home bash[14086]: [+] 0.2.197 02-12-2019 04:27:57 pm [CMD-RSSI]        BEAC 49:DC:B6:D3:88:50 RSSI: -100 dBm (initial reading | 100 dBm)
Dec 02 16:27:57 home bash[14086]: [+] 0.2.197 02-12-2019 04:27:57 pm [CMD-BEAC]        49:DC:B6:D3:88:50 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 02 16:32:01 home bash[14086]: [+] 0.2.197 02-12-2019 04:32:01 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 254 seconds
Dec 02 16:32:01 home bash[14086]: [+] 0.2.197 02-12-2019 04:32:01 pm [DEL-PUBL]        BEAC 49:DC:B6:D3:88:50 expired after 254 seconds
Dec 03 09:08:38 home bash[18380]: [+] 0.2.197 03-12-2019 09:08:38 am [CMD-RSSI]        BEAC 6A:DD:CE:CC:05:3C RSSI: -97 dBm (initial reading | 103 dBm)
Dec 03 09:08:38 home bash[18380]: [+] 0.2.197 03-12-2019 09:08:38 am [CMD-BEAC]        6A:DD:CE:CC:05:3C E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 03 09:12:35 home bash[18380]: [+] 0.2.197 03-12-2019 09:12:35 am [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 244 seconds
Dec 03 09:12:35 home bash[18380]: [+] 0.2.197 03-12-2019 09:12:35 am [DEL-PUBL]        BEAC 6A:DD:CE:CC:05:3C expired after 244 seconds
Dec 03 13:16:31 home bash[8645]: [+] 0.2.197 03-12-2019 01:16:31 pm [CMD-RSSI]        BEAC 4A:F7:56:78:11:6A RSSI: -99 dBm (initial reading | 101 dBm)
Dec 03 13:16:31 home bash[8645]: [+] 0.2.197 03-12-2019 01:16:31 pm [CMD-BEAC]        4A:F7:56:78:11:6A E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 03 13:20:32 home bash[8645]: [+] 0.2.197 03-12-2019 01:20:32 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 250 seconds
Dec 03 13:20:32 home bash[8645]: [+] 0.2.197 03-12-2019 01:20:32 pm [DEL-PUBL]        BEAC 4A:F7:56:78:11:6A expired after 250 seconds
Dec 03 14:55:13 home bash[18889]: [+] 0.2.197 03-12-2019 02:55:13 pm [CMD-RSSI]        BEAC 46:04:A0:FB:04:2C RSSI: -100 dBm (initial reading | 100 dBm)
Dec 03 14:55:13 home bash[18889]: [+] 0.2.197 03-12-2019 02:55:13 pm [CMD-BEAC]        46:04:A0:FB:04:2C E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 03 14:59:23 home bash[18889]: [+] 0.2.197 03-12-2019 02:59:23 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 260 seconds
Dec 03 14:59:23 home bash[18889]: [+] 0.2.197 03-12-2019 02:59:23 pm [DEL-PUBL]        BEAC 46:04:A0:FB:04:2C expired after 260 seconds
Dec 03 15:10:48 home bash[18889]: [+] 0.2.197 03-12-2019 03:10:48 pm [CMD-RSSI]        BEAC 7C:1A:F3:23:8E:C7 RSSI: -107 dBm (initial reading | 93 dBm)
Dec 03 15:10:48 home bash[18889]: [+] 0.2.197 03-12-2019 03:10:48 pm [CMD-BEAC]        7C:1A:F3:23:8E:C7 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 03 15:14:43 home bash[18889]: [+] 0.2.197 03-12-2019 03:14:43 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 243 seconds
Dec 03 15:14:43 home bash[18889]: [+] 0.2.197 03-12-2019 03:14:43 pm [DEL-PUBL]        BEAC 7C:1A:F3:23:8E:C7 expired after 243 seconds
Dec 03 15:18:18 home bash[18889]: [+] 0.2.197 03-12-2019 03:18:18 pm [CMD-RSSI]        BEAC 49:25:BE:D3:23:F4 RSSI: -101 dBm (initial reading | 99 dBm)
Dec 03 15:18:18 home bash[18889]: [+] 0.2.197 03-12-2019 03:18:18 pm [CMD-BEAC]        49:25:BE:D3:23:F4 E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 03 15:22:23 home bash[18889]: [+] 0.2.197 03-12-2019 03:22:23 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 250 seconds
Dec 03 15:22:23 home bash[18889]: [+] 0.2.197 03-12-2019 03:22:23 pm [DEL-PUBL]        BEAC 49:25:BE:D3:23:F4 expired after 250 seconds
Dec 03 16:04:55 home bash[18889]: [+] 0.2.197 03-12-2019 04:04:55 pm [CMD-RSSI]        BEAC 67:62:90:F7:84:BF RSSI: -98 dBm (initial reading | 102 dBm)
Dec 03 16:04:55 home bash[18889]: [+] 0.2.197 03-12-2019 04:04:55 pm [CMD-BEAC]        67:62:90:F7:84:BF E2C56DB5-DFFB-48D2-B060-D0F5A71096E0 0 0
Dec 03 16:09:04 home bash[18889]: [+] 0.2.197 03-12-2019 04:09:04 pm [DEL-BEAC]        BEAC E2C56DB5-DFFB-48D2-B060-D0F5A71096E0-0-0 expired after 254 seconds
Dec 03 16:09:04 home bash[18889]: [+] 0.2.197 03-12-2019 04:09:04 pm [DEL-PUBL]        BEAC 67:62:90:F7:84:BF expired after 254 seconds

Is it even possible to get rid of it (stop monitor from publishing the beacon UUID+random MACs to new topics)?
What am I missing/doing wrong?

How do I get this automatically running at startup with the -b option?

Thanks

Create a startup script to make it do that :man_shrugging:

This is my systemd unit file, in /etc/system/systemd/monitor.service

[Unit]
Description=Monitor Service
After=network.target

[Service]
User=root
ExecStart=/bin/bash /opt/monitor/monitor.sh -x -b -tdr &
WorkingDirectory=/opt/monitor
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target network.target

monitor is installed in /opt/monitor - if you installed it elsewhere change that part accordingly. Change the flags to suit you.

There’s an easier way, just run the bash script with all the flags you want and add “-u” to the end. This way the monitor script will update the systemd file. So your case would be “sudo bash monitor.sh -x -u”, that’s it.

1 Like