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

already checked all issues on github.
I have a raspberry with the script on but it keeps bailing out (+exit) after just a few minutes.
Reasons are either not stated or always different

Any other with the same experience?
I can respawn it but I suppose there is something wrong

Iā€™ve been using monitor for quite a while now and itā€™s been working great at tracking everyoneā€™s phones. Iā€™ve been trying to add a NUT Mini but havenā€™t been able to get it to work. Maybe someone can assist.
I used an app on my phone to discover the Nutā€™s mac address then added it to the known_beacon_address file. I tried running sudo bash monitor.sh but it doesnā€™t appear to ever scan for it. Also tried using -b but it still doesnā€™t scan for it.

Note** On startup it does show up as a known beacon right under the known devices.

Also, do I have to run -b all the time? If so, how would I make sure that it automatically runs -b when the pi reboots?

Have you tried adding the mac address to the known_static_addresses file?

If so, how would I make sure that it automatically runs -b when the pi reboots?

The ā€œ-uā€ flag updates the monitor.service with the current command line settings, so sudo bash monitor.sh -b -u should keep the setting across reboots.

Ok so it turns out the mac entry is case sensitive. I should have guessed that. Once I switched it to all lower case it started scanning for it. I think I remember seeing that somewhere in this thread.

New problem. 0% confidence. Iā€™m about 5ā€™ away from the Pi and I can always discover the nut with my phone so I know itā€™s still transmitting. Tried with and without -b. And I have the mac in both files. Known static addresses and known beacon addresses.

One thing I noticed is when I run monitor.sh I can see the scan for the known static devices, including the nut, but I donā€™t see anything reported for the known beacon addresses. The only thing I see is the line at the beginning about known beacon: xyz will report toā€¦ But once the scan starts I never see anything about the beacon. Is this normal or should I see some activity in the log?

Iā€™m using a Tile tracker, so canā€™t say whether this will work for Nut;

  1. I first added the mac address for the Tile into static and beacon files, and saw that the confidence was 0%.
  2. I commented out the mac addresses from both static and beacon, and restarted Monitor
    The Tile started appearing in HA as ā€œhomeā€.

Iā€™m not sure why this works, but you might want to try it.

I tried that and it didnā€™t work. You didnā€™t leave the Mac addresses commented out did you?

I did notice it shows up under CMD-RAND when the scan starts but it still doesnā€™t update HA. Iā€™ve tried several different configurations and I still canā€™t get it to update. Below is the known_beacon_addresses file and the known_static_addresses file and the output of the montior.sh -b. Maybe someone can see something Iā€™m missing. I only copied the scan up to the **** started arrival scan. [x1 max rep] ****

known_beacon_addresses

# ---------------------------
#
# BEACON MAC ADDRESS LIST; REQUIRES NAME
#
# ---------------------------
f2:1f:a3:2d:be:3c nut_mini

known_static_addresses

# ---------------------------
#
# PUBLIC MAC ADDRESS LIST
#
# ---------------------------

b4:f1:da:69:13:92 dannysphone
3c:2e:f9:27:ba:9e mindysphone
40:4d:7f:e0:4e:b4 kenzphone
68:ab:1e:9f:53:d1 morgansphone
pi@raspberrypi:~/monitor $ sudo bash monitor.sh -b
====================== DEBUG ======================
starting monitor.sh (v. 0.2.015)...
> removing web request caches
> removing public name cache
> generic bluetooth beacon, ibeacon, and known beacon address reporting mode enabled
> preference: using default mqtt protocol version
> 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
mkfifo: cannot create fifo 'packet_pipe': File exists
> b4:f1:da:69:13:92 publishes to: monitor/living room pi/b4:f1:da:69:13:92 (has not previously connected to hci0)
> 3c:2e:f9:27:ba:9e publishes to: monitor/living room pi/3c:2e:f9:27:ba:9e (has not previously connected to hci0)
> 40:4d:7f:e0:4e:b4 publishes to: monitor/living room pi/40:4d:7f:e0:4e:b4 (has not previously connected to hci0)
> 68:ab:1e:9f:53:d1 publishes to: monitor/living room pi/68:ab:1e:9f:53:d1 (has not previously connected to hci0)
> known beacon: f2:1f:a3:2d:be:3c publishes to: monitor/living room pi/f2:1f:a3:2d:be:3c
================== BEGIN LOGGING ==================
**0.2.015 08:06:18 am [CMD-RAND]  [passed filter] data: F2:1F:A3:2D:BE:3C pdu: SCAN_RSP rssi: -71 dBm flags: none man: unknown delay: 0**
0.2.015 08:06:18 am [CMD-INFO]  **** started arrival scan. [x1 max rep] ****

The Tile mac address is commented out from both static and beacon files, but the presence information is sent to HA.

Iā€™m following the instructions to set up Monitor on a Raspberry Pi Zero W. Iā€™ve installed Raspian Buster Lite, and Iā€™ve completed all the steps of the install except the very last oneā€¦I am failing on the very last step of the Mosquitto install. Iā€™m not sure what to do now. Any and all help will be much appreciated!

This is what my console shows:

pi@raspberrypi:/etc/apt/sources.list.d $ sudo apt-get install -f libmosquitto-dev mosquitto mosquitto-clients libmosquitto1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libev4 libuv1 libwebsockets8
Suggested packages:
  apparmor
The following NEW packages will be installed:
  libev4 libmosquitto-dev libmosquitto1 libuv1 libwebsockets8 mosquitto mosquitto-clients
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 612 kB of archives.
After this operation, 1,331 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://raspbian.mirror.constant.com/raspbian buster/main armhf libev4 armhf 1:4.25-1 [34.5 kB]
Get:3 https://repo.mosquitto.org/debian stretch/main armhf libmosquitto1 armhf 1.6.6-0mosquitto1~stretch1 [70.8 kB]
Get:2 http://raspbian.mirror.constant.com/raspbian buster/main armhf libuv1 armhf 1.24.1-1 [96.7 kB]
Get:5 https://repo.mosquitto.org/debian stretch/main armhf libmosquitto-dev armhf 1.6.6-0mosquitto1~stretch1 [62.0 kB]
Get:6 https://repo.mosquitto.org/debian stretch/main armhf mosquitto armhf 1.6.6-0mosquitto1~stretch1 [174 kB]
Get:7 https://repo.mosquitto.org/debian stretch/main armhf mosquitto-clients armhf 1.6.6-0mosquitto1~stretch1 [88.5 kB]
Get:4 http://raspbian-us.ngc292.space/raspbian buster/main armhf libwebsockets8 armhf 2.0.3-3 [85.6 kB]
Fetched 612 kB in 2s (401 kB/s)
Selecting previously unselected package libev4:armhf.
(Reading database ... 37640 files and directories currently installed.)
Preparing to unpack .../0-libev4_1%3a4.25-1_armhf.deb ...
Unpacking libev4:armhf (1:4.25-1) ...
Selecting previously unselected package libmosquitto1:armhf.
Preparing to unpack .../1-libmosquitto1_1.6.6-0mosquitto1~stretch1_armhf.deb ...
Unpacking libmosquitto1:armhf (1.6.6-0mosquitto1~stretch1) ...
Selecting previously unselected package libmosquitto-dev:armhf.
Preparing to unpack .../2-libmosquitto-dev_1.6.6-0mosquitto1~stretch1_armhf.deb ...
Unpacking libmosquitto-dev:armhf (1.6.6-0mosquitto1~stretch1) ...
Selecting previously unselected package libuv1:armhf.
Preparing to unpack .../3-libuv1_1.24.1-1_armhf.deb ...
Unpacking libuv1:armhf (1.24.1-1) ...
Selecting previously unselected package libwebsockets8:armhf.
Preparing to unpack .../4-libwebsockets8_2.0.3-3_armhf.deb ...
Unpacking libwebsockets8:armhf (2.0.3-3) ...
Selecting previously unselected package mosquitto.
Preparing to unpack .../5-mosquitto_1.6.6-0mosquitto1~stretch1_armhf.deb ...
Unpacking mosquitto (1.6.6-0mosquitto1~stretch1) ...
Selecting previously unselected package mosquitto-clients.
Preparing to unpack .../6-mosquitto-clients_1.6.6-0mosquitto1~stretch1_armhf.deb ...
Unpacking mosquitto-clients (1.6.6-0mosquitto1~stretch1) ...
Setting up libmosquitto1:armhf (1.6.6-0mosquitto1~stretch1) ...
Setting up libev4:armhf (1:4.25-1) ...
Setting up mosquitto-clients (1.6.6-0mosquitto1~stretch1) ...
Setting up libuv1:armhf (1.24.1-1) ...
Setting up libmosquitto-dev:armhf (1.6.6-0mosquitto1~stretch1) ...
Setting up libwebsockets8:armhf (2.0.3-3) ...
Setting up mosquitto (1.6.6-0mosquitto1~stretch1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/mosquitto.service ā†’ /lib/systemd/system/mosquitto.service.
Job for mosquitto.service failed because a fatal signal was delivered to the control process.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mosquitto, action "start" failed.
ā— mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: signal) since Mon 2019-09-23 02:50:17 BST; 106ms ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 941 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=killed, signal=SEGV)
 Main PID: 941 (code=killed, signal=SEGV)
dpkg: error processing package mosquitto (--configure):
 installed mosquitto package post-installation script subprocess returned error exit status 1
Processing triggers for systemd (241-7~deb10u1+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
Errors were encountered while processing:
 mosquitto
E: Sub-process /usr/bin/dpkg returned an error code (1)

I looked at the suggested information:

pi@raspberrypi:/etc/apt/sources.list.d $ systemctl status mosquitto.service
ā— mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: failed (Result: signal) since Mon 2019-09-23 02:50:23 BST; 3min 16s ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 1055 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=killed, signal=SEGV)
 Main PID: 1055 (code=killed, signal=SEGV)

Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 7.
Sep 23 02:50:23 raspberrypi systemd[1]: Stopped Mosquitto MQTT v3.1/v3.1.1 Broker.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Failed with result 'signal'.
Sep 23 02:50:23 raspberrypi systemd[1]: Failed to start Mosquitto MQTT v3.1/v3.1.1 Broker.
pi@raspberrypi:/etc/apt/sources.list.d $
pi@raspberrypi:/etc/apt/sources.list.d $ journalctl -xe
--
-- The process' exit code is 'killed' and its exit status is 11.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Failed with result 'signal'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit mosquitto.service has entered the 'failed' state with result 'signal'.
Sep 23 02:50:23 raspberrypi systemd[1]: Failed to start Mosquitto MQTT v3.1/v3.1.1 Broker.
-- Subject: A start job for unit mosquitto.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit mosquitto.service has finished with a failure.
--
-- The job identifier is 868 and the job result is failed.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Service RestartSec=100ms expired, scheduling restart.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 7.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Automatic restarting of the unit mosquitto.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Sep 23 02:50:23 raspberrypi systemd[1]: Stopped Mosquitto MQTT v3.1/v3.1.1 Broker.
-- Subject: A stop job for unit mosquitto.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A stop job for unit mosquitto.service has finished.
--
-- The job identifier is 929 and the job result is done.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Start request repeated too quickly.
Sep 23 02:50:23 raspberrypi systemd[1]: mosquitto.service: Failed with result 'signal'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit mosquitto.service has entered the 'failed' state with result 'signal'.
Sep 23 02:50:23 raspberrypi systemd[1]: Failed to start Mosquitto MQTT v3.1/v3.1.1 Broker.
-- Subject: A start job for unit mosquitto.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit mosquitto.service has finished with a failure.
--
-- The job identifier is 929 and the job result is failed.
Sep 23 02:50:26 raspberrypi sudo[764]: pam_unix(sudo:session): session closed for user root
lines 1829-1876/1876 (END)

Looks like the Mosquitto Debian Stretch version is getting installed for some reason instead of Buster.
Maybe try apt-get upgrade before apt-get install?

Thanks for your reply! I tried apt-get upgrade, and I tried
sudo wget http://repo.mosquitto.org/debian/mosquitto-buster.list and redoing the steps, but Iā€™m still having the same error. I think tomorrow I may start over and install Raspbian Stretch Lite instead, and see if that works any better. Iā€™d really like to get Monitor up and running!

That is a failure to start the mosquitto broker service on the Pi Zero. This does not matter at all usually, since monitor on a Pi Zero will likely publish to a broker on another machine. You should not need a broker on the Pi Zero

For example, I run my mosquitto broker on the same machine I use for hass. My instances of monitor on three Pi Zeroā€™s around my house all publish to that machine

Im having a small issue with a two node setup. I have a NUC upstairs and a pi0w downstairs. I set both of the up for MQTT with the following topics:

monitor/nuc/ā€œuserā€/device_tracker
monitor/pi0/ā€œuserā€/device_tracker

The users are the same on both, me and my wife. I added both (NUC & pi0) device trackers to my persons entities in HA. I have them set to trigger A & D by MQTT and have door sensors setup to send the MQTT A & D scan. For the most part it is working fine, but Iā€™ve been having instances with my pi0 getting hung up on a state. For example Iā€™ll arrive home and trigger the MQTT and NUC will show me home, but pi0 stays not_home. Even if I manually send the monitor/scan/arrive again standing next to my pi0 it will not update me to home. Not sure if it is failing to do an arrival scan since the NUC node set me to home or what. Is there any way to specifically trigger arrival and departs scans on each independently? Currently my arrive and departs are through monitor/scan/.

Thank you! I wondered why I would need a broker on the Pi zero, because I use the Mosquitto add-on in HA as my broker. Iā€™m going to work on this tonight and hopefully I can get it going.

Why canā€™t I figure out how to replace a device? I canā€™t seem to find any info on how to add static devices at all. We replaced our phones so I need to locate the ids and replace the old ones, whatā€™s the best way to do this?

I took a look at the Monitor install instructions, and it installs the Stretch version Mosquitto files. When you tried the steps above did you delete the mosquitto-stretch.list file from /etc/apt/sources.list.d/ that you originally installed, and then perform the following steps?

#update caches and install 
apt-cache search mosquitto
sudo apt-get update
sudo apt-get install -f libmosquitto-dev mosquitto mosquitto-clients libmosquitto1

If you are using a separate MQTT broker, I guess you can ignore the broker errors, but Stretch Mosquitto client files are installed in your Buster OS, so that will need to be fixed.

Thank you so much for helping me. Iā€™m just having all kinds of issues. I didnā€™t know how to clean up the mess with the mixed up versions, so I simply reflashed the SD card with Buster Lite again, and redid the install. I followed the Monitor install instructions exactly until I reached the step that says sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list. Instead of that, I did sudo wget http://repo.mosquitto.org/debian/mosquitto-buster.list. Then I did the rest of the listed steps:

apt-cache search mosquitto
sudo apt-get update
sudo apt-get install -f libmosquitto-dev mosquitto mosquitto-clients libmosquitto1

and I end up with the same problem:

pi@raspberrypi:/etc/apt/sources.list.d $ sudo apt-get install -f libmosquitto-dev mosquitto mosquitto-clients libmosquitto1

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following additional packages will be installed:

libev4 libuv1 libwebsockets8

Suggested packages:

apparmor

The following NEW packages will be installed:

libev4 libmosquitto-dev libmosquitto1 libuv1 libwebsockets8 mosquitto mosquitto-clients

0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.

Need to get 610 kB of archives.

After this operation, 1,327 kB of additional disk space will be used.

Do you want to continue? [Y/n] Y

Get:3 https://repo.mosquitto.org/debian buster/main armhf libmosquitto1 armhf 1.6.6-0mosquitto1~buster1 [70.9 kB]

Get:1 http://raspbian.mirror.constant.com/raspbian buster/main armhf libev4 armhf 1:4.25-1 [34.5 kB]

Get:2 http://raspbian.mirror.constant.com/raspbian buster/main armhf libuv1 armhf 1.24.1-1 [96.7 kB]

Get:5 https://repo.mosquitto.org/debian buster/main armhf libmosquitto-dev armhf 1.6.6-0mosquitto1~buster1 [62.1 kB]

Get:6 https://repo.mosquitto.org/debian buster/main armhf mosquitto armhf 1.6.6-0mosquitto1~buster1 [172 kB]

Get:7 https://repo.mosquitto.org/debian buster/main armhf mosquitto-clients armhf 1.6.6-0mosquitto1~buster1 [88.2 kB]

Get:4 http://raspbian-us.ngc292.space/raspbian buster/main armhf libwebsockets8 armhf 2.0.3-3 [85.6 kB]

Fetched 610 kB in 2s (352 kB/s)

Selecting previously unselected package libev4:armhf.

(Reading database ... 37640 files and directories currently installed.)

Preparing to unpack .../0-libev4_1%3a4.25-1_armhf.deb ...

Unpacking libev4:armhf (1:4.25-1) ...

Selecting previously unselected package libmosquitto1:armhf.

Preparing to unpack .../1-libmosquitto1_1.6.6-0mosquitto1~buster1_armhf.deb ...

Unpacking libmosquitto1:armhf (1.6.6-0mosquitto1~buster1) ...

Selecting previously unselected package libmosquitto-dev:armhf.

Preparing to unpack .../2-libmosquitto-dev_1.6.6-0mosquitto1~buster1_armhf.deb ...

Unpacking libmosquitto-dev:armhf (1.6.6-0mosquitto1~buster1) ...

Selecting previously unselected package libuv1:armhf.

Preparing to unpack .../3-libuv1_1.24.1-1_armhf.deb ...

Unpacking libuv1:armhf (1.24.1-1) ...

Selecting previously unselected package libwebsockets8:armhf.

Preparing to unpack .../4-libwebsockets8_2.0.3-3_armhf.deb ...

Unpacking libwebsockets8:armhf (2.0.3-3) ...

Selecting previously unselected package mosquitto.

Preparing to unpack .../5-mosquitto_1.6.6-0mosquitto1~buster1_armhf.deb ...

Unpacking mosquitto (1.6.6-0mosquitto1~buster1) ...

Selecting previously unselected package mosquitto-clients.

Preparing to unpack .../6-mosquitto-clients_1.6.6-0mosquitto1~buster1_armhf.deb ...

Unpacking mosquitto-clients (1.6.6-0mosquitto1~buster1) ...

Setting up libmosquitto1:armhf (1.6.6-0mosquitto1~buster1) ...

Setting up libev4:armhf (1:4.25-1) ...

Setting up mosquitto-clients (1.6.6-0mosquitto1~buster1) ...

Setting up libuv1:armhf (1.24.1-1) ...

Setting up libmosquitto-dev:armhf (1.6.6-0mosquitto1~buster1) ...

Setting up libwebsockets8:armhf (2.0.3-3) ...

Setting up mosquitto (1.6.6-0mosquitto1~buster1) ...

Created symlink /etc/systemd/system/multi-user.target.wants/mosquitto.service ā†’ /lib/systemd/system/mosquitto.service.

Job for mosquitto.service failed because a fatal signal was delivered to the control process.

See "systemctl status mosquitto.service" and "journalctl -xe" for details.

invoke-rc.d: initscript mosquitto, action "start" failed.

ā— mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker

Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)

Active: activating (auto-restart) (Result: signal) since Tue 2019-09-24 00:54:03 BST; 106ms ago

Docs: man:mosquitto.conf(5)

man:mosquitto(8)

Process: 959 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=killed, signal=SEGV)

Main PID: 959 (code=killed, signal=SEGV)

dpkg: error processing package mosquitto (--configure):

installed mosquitto package post-installation script subprocess returned error exit status 1

Processing triggers for systemd (241-7~deb10u1+rpi1) ...

Processing triggers for man-db (2.8.5-2) ...

Processing triggers for libc-bin (2.28-10+rpi1) ...

Errors were encountered while processing:

mosquitto

E: Sub-process /usr/bin/dpkg returned an error code (1)

I decided to keep going anyway, and set up Monitor according to the next set of instructions. I did not switch to the beta branch. I needed to install two packages and I did that. But now itā€™s telling me I donā€™t have a high enough version of mosquitto_pub and mosquitto_sub. Iā€™ve spent so many hours on this and Iā€™m just not understanding why this isnā€™t working.

pi@raspberrypi:~/monitor $ sudo bash monitor.sh
cat: .previous_version: No such file or directory
> updated monitor.sh (v. Unknown) -> (v. 0.2.197)...
> error: required package 'hcidump' not found. please install 'bluez-hcidump' (e.g., sudo apt-get install bluez-hcidump).
> error: required package 'bc' not found. please install 'bc' (e.g., apt-get install bc)
> warning: monitor.service not installed. Install service? (y/n)
n
> error: minimum required mosquitto_sub version 1.5+ not found. please update.
> error: minimum required mosquitto_pub version 1.5+ not found. please update.
> mosquitto preferences file created. please customize.
> public MAC address list file created. please customize.
> beacon MAC address list file created. please customize.
pi@raspberrypi:~/monitor $ sudo apt-get install bluez-hcidump
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  bluez-hcidump
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 148 kB of archives.
After this operation, 414 kB of additional disk space will be used.
Get:1 http://archive.raspberrypi.org/debian buster/main armhf bluez-hcidump armhf 5.50-1+rpt1 [148 kB]
Fetched 148 kB in 1s (190 kB/s)
Selecting previously unselected package bluez-hcidump.
(Reading database ... 38651 files and directories currently installed.)
Preparing to unpack .../bluez-hcidump_5.50-1+rpt1_armhf.deb ...
Unpacking bluez-hcidump (5.50-1+rpt1) ...
Setting up bluez-hcidump (5.50-1+rpt1) ...
Setting up mosquitto (1.6.6-0mosquitto1~buster1) ...
Job for mosquitto.service failed because a fatal signal was delivered to the control process.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mosquitto, action "start" failed.
ā— mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: signal) since Tue 2019-09-24 01:09:42 BST; 103ms ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 2130 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=killed, signal=SEGV)
 Main PID: 2130 (code=killed, signal=SEGV)
dpkg: error processing package mosquitto (--configure):
 installed mosquitto package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.8.5-2) ...
Errors were encountered while processing:
 mosquitto
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@raspberrypi:~/monitor $ sudo apt-get install bc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  bc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 101 kB of archives.
After this operation, 220 kB of additional disk space will be used.
Get:1 http://raspbian-us.ngc292.space/raspbian buster/main armhf bc armhf 1.07.1-2 [101 kB]
Fetched 101 kB in 1s (103 kB/s)
Selecting previously unselected package bc.
(Reading database ... 38658 files and directories currently installed.)
Preparing to unpack .../archives/bc_1.07.1-2_armhf.deb ...
Unpacking bc (1.07.1-2) ...
Setting up bc (1.07.1-2) ...
Setting up mosquitto (1.6.6-0mosquitto1~buster1) ...
Job for mosquitto.service failed because a fatal signal was delivered to the control process.
See "systemctl status mosquitto.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mosquitto, action "start" failed.
ā— mosquitto.service - Mosquitto MQTT v3.1/v3.1.1 Broker
   Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: signal) since Tue 2019-09-24 01:11:21 BST; 105ms ago
     Docs: man:mosquitto.conf(5)
           man:mosquitto(8)
  Process: 2311 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=killed, signal=SEGV)
 Main PID: 2311 (code=killed, signal=SEGV)
dpkg: error processing package mosquitto (--configure):
 installed mosquitto package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for install-info (6.5.0.dfsg.1-4+b1) ...
Errors were encountered while processing:
 mosquitto
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@raspberrypi:~/monitor $ sudo bash monitor.sh
> starting monitor.sh (v. 0.2.197)...
> warning: monitor.service not installed. Install service? (y/n)
Y
> error: minimum required mosquitto_sub version 1.5+ not found. please update.
> error: minimum required mosquitto_pub version 1.5+ not found. please update.
> error: please customize mqtt broker address in: mqtt_preferences
> warning: for security purposes, please consider changing 'username' in: mqtt_preferences
> warning: for security purposes, please consider changing 'password' in: mqtt_preferences
> warning: variable mqtt_publisher_identity does not appear in: mqtt_preferences. using hostname: raspberrypi.

Does anyone know how to get the static id addresses from iphones to add to the known_static_addresses file?

Check in your router or even the wifi connection on the phone

Well, I think my issues may have something to do with my Pi Zero W hardware. I redid the whole entire thing using Raspbian Stretch Lite and had the same issues. I decided to put the SD card into a Raspberry Pi 3B, I redid the steps for updating the caches and installing, and got a different error:

APT had planned for dpkg to do more than it reported back (0 vs 4).
   Affected packages: mosquitto:armhf

So I reinstalled just mosquitto, and then continued with the steps to set up Monitor. Lo and behold, I have it working! After playing with it for a while to get a feel for how it works with my Nut Mini, I tried moving the SD card back to the Pi Zero W. Well, it doesnā€™t work there - when I start Monitor, it complains about Mosquitto:

> error: minimum required mosquitto_sub version 1.5+ not found. please update.
> error: minimum required mosquitto_pub version 1.5+ not found. please update.

and stops. I put the card back in the Pi 3B and it works like a charm. I have no idea why this is the case. Iā€™m frustrated that I wasted so many hours, but at least now I have a working setup!

1 Like