Giter VIP home page Giter VIP logo

presence's Introduction

presence

Note: as of presence 0.5.1, triggered scans, guest scanning, and beacon scanning are removed from presence.sh for simplification. Please consider using monitor instead for beacon scanning and detection and for generic device detection. It is unlikely that presence will receive substantive updates after version 0.5.1.


TL;DR: Bluetooth-based presence detection useful for mqtt-based home automation. More granular, responsive, and reliable than device-reported GPS. Cheaper, more reliable, more configurable, and less mqtt-spammy than Happy Bubbles. Does not require any app to be running or installed. Does not require device pairing. Designed to run as service on a Raspberry Pi Zero W.

Note that the more frequently you scan for devices, the more 2.4GHz bandwidth you will use. This script may cause interference with Wi-Fi or other bluetooth devices for particularly short delays between scans.

Summary

A JSON-formatted MQTT message is reported to a broker whenever a specified bluetooth device responds to a name query. If the device responds, the JSON message includes the name of the device and a confidence of 100.

After a delay, another name query is sent and, if the device does not respond, a verification-of-absence loop begins that queries for the device (on a shorter interval) a set number of times. Each time, the device does not respond, the confidence is reduced, eventually to 0.

A configuration file defines 'owner devices' that contains the mac addresses of the devices you'd like to regularly ping to determine presence.

Topics are formatted like this:

 location/pi_zero_location/00:00:00:00:00:00 

Messages are JSON formatted and contain name and confidence fields, including a javascript-formatted timestamp and a duration of a particular scan (in ms):

 { confidence : 100, name : Andrew’s iPhone, scan_duration_ms: 500, timestamp : Sat Apr 21 2018 11:52:04 GMT-0600 (MDT)}
 { confidence : 0, name : Andrew’s iPhone or Unknown, scan_duration_ms: 5000, timestamp : Sat Apr 21 2018 11:52:04 GMT-0600 (MDT)}

Example Use with Home Assistant

The presence script can be used as an input to a number of mqtt sensors in Home Assistant.. Output from these sensors can be averaged to give a highly-accurate numerical occupancy confidence.

In order to detect presence in a home that has three floors and a garage, we might include one Raspberry Pi per floor. For average houses, a single well-placed sensor can probably work, but for more reliability at the edges of the house, more sensors are better.

- platform: mqtt
  state_topic: 'location/first floor/00:00:00:00:00:00'
  value_template: '{{ value_json.confidence }}'
  unit_of_measurement: '%'
  name: 'Andrew First Floor'

- platform: mqtt
  state_topic: 'location/second floor/00:00:00:00:00:00'
  value_template: '{{ value_json.confidence }}'
  unit_of_measurement: '%'
  name: 'Andrew Second Floor'

- platform: mqtt
  state_topic: 'location/third floor/00:00:00:00:00:00'
  value_template: '{{ value_json.confidence }}'
  unit_of_measurement: '%'
  name: 'Andrew Third Floor'

- platform: mqtt
  state_topic: 'location/garage/00:00:00:00:00:00'
  value_template: '{{ value_json.confidence }}'
  unit_of_measurement: '%'
  name: 'Andrew Garage'

These sensors can be combined/averaged using a min_max:

- platform: min_max
  name: "Andrew Home Occupancy Confidence"
  type: mean
  round_digits: 0
  entity_ids:
    - sensor.andrew_garage
    - sensor.andrew_third_floor
    - sensor.andrew_second_floor
    - sensor.andrew_first_floor

So, as a result of this combination, we use the entity sensor.andrew_home_occupancy_confidence in automations to control the state of an input_boolean that represents a very high confidence of a user being home or not.

As an example:

- alias: Andrew Occupancy 
  hide_entity: true
  trigger:
    - platform: numeric_state
      entity_id: sensor.andrew_home_occupancy_confidence
      above: 10
  action:
    - service: homeassistant.turn_on
      data:
        entity_id: input_boolean.andrew_occupancy

Installation Instructions (Raspbian Jessie Lite Stretch):

Setup of SD Card

  1. Download latest version of jessie lite stretch here

  2. Download etcher from etcher.io

  3. Image jessie lite stretch to SD card. Instructions here.

  4. Mount boot partition of imaged SD card (unplug it and plug it back in)

  5. [ENABLE SSH] Create blank file, without any extension, in the root directory called ssh

  6. [SETUP WIFI] Create wpa_supplicant.conf file in root directory and add Wi-Fi details for home Wi-Fi:

country=US
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1

network={
    ssid="Your Network Name"
    psk="Your Network Password"
    key_mgmt=WPA-PSK
}
  1. [FIRST STARTUP] Insert SD card and power on Raspberry Pi Zero W. On first boot, the newly-created wpa_supplicant.conf file and ssh will be moved to appropriate directories. Find the IP address of the Pi via your router. One method is scanning for open ssh ports (port 22) on your local network:
nmap 192.168.1.0/24 -p 22

Configuration and Setup of Raspberry Pi Zero W

  1. SSH into the Raspberry Pi (password: raspberry):
ssh pi@theipaddress
  1. Change the default password:
sudo passwd pi
  1. [PREPARATION] Update and upgrade:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo rpi-update
sudo reboot
  1. [BLUETOOTH] Install Bluetooth Firmware:
#install bluetooth drivers for Pi Zero W
sudo apt-get install pi-bluetooth

#verify that bluetooth is working
sudo service bluetooth start
sudo service bluetooth status
  1. [OPTIONAL: BLUEZ UPGRADE] Compile/install latest bluez

This is not strictly required anymore, as pi-bluetooth appears to have been updated to support bluez 0.5.43.


#purge old bluez
sudo apt-get --purge remove bluez

#get latest version number from: https://www.kernel.org/pub/linux/bluetooth/
#current version as of this writing is 5.49
cd ~; wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.49.tar.xz
tar xvf bluez-5.49.tar.xz

#update errythang again
sudo apt-get update

#install necessary packages
sudo apt-get install libusb-dev libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev

#move into new unpacked directory
cd bluez-5.49

#set exports
export LDFLAGS=-lrt

#configure 
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-library -disable-systemd

#make & install
make
sudo make install

#cleanup
cd ~
rm -r bluez-5.49/
rm bluez-5.49.tar.xz

#update again
sudo apt-get update
sudo apt-get upgrade

#verify bluez version 
bluetoothd -v
  1. [REBOOT]
sudo reboot
  1. [INSTALL MOSQUITTO]

# get repo key
wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key

#add repo
sudo apt-key add mosquitto-repo.gpg.key

#download appropriate lists file 
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list

#update caches and install 
apt-cache search mosquitto
sudo apt-get update
sudo aptitude install libmosquitto-dev mosquitto mosquitto-clients
  1. [INSTALL PRESENCE]
#install git
cd ~
sudo apt-get install git

#clone this repo
git clone git://github.com/andrewjfreyer/presence

#enter presence directory
cd presence/
  1. [CONFIGURE PRESENCE] create file named mqtt_preferences and include content:
nano mqtt_preferences

Then...

mqtt_address="ip.address.of.broker"
mqtt_port="optional broker network port number. Defaults to 1883"
mqtt_user="your broker username"
mqtt_password="your broker password"
mqtt_topicpath="location"
mqtt_room="your pi's location"
  1. [CONFIGURE PRESENCE] create file named owner_devices and include mac addresses of devices on separate lines.
nano owner_devices

Then...

00:00:00:00:00 #comments 
00:00:00:00:00
  1. [CONFIGURE SERVICE] Create file at /etc/systemd/system/presence.service and include content:
sudo nano /etc/systemd/system/presence.service

Then...

[Unit]
Description=Presence service

[Service]
User=root
ExecStart=/bin/bash /home/pi/presence/presence.sh &
WorkingDirectory=/home/pi/presence
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

  1. [CONFIGURE SERVICE] Enable service by:
sudo systemctl enable presence.service
sudo systemctl start presence.service

That's it. Your broker should be receiving messages and the presence service will restart each time the Raspberry Pi boots.

presence's People

Contributors

andrewjfreyer avatar melhoj avatar vivianlink avatar x99percent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

presence's Issues

RPI Zero W keep connecting and disconnecting from home assistant Mosquitto broker

Hello, i installed all the packeges and the RPI is working and accessable via ssh, i added my BT mac addresses and fired up the system but i dont get topics with the addresses, the mqtt log showing that the device keep connecting with the username and passwords but disconnect right after.1587456234: New client connected from 192.168.1.25 as mosq-idMm4T4OJZS0Hdq7El (p2, c1, k60, u'user').
1587456234: Client mosq-idMm4T4OJZS0Hdq7El disconnected.

FR: Add support for Mi Flora bluetooth plant sensors

Love your work. Building this tonight to test as like you, tried everything else. Now I know this is left field but hear me out. I see quite a few HA users (myself included) moving away from Pi's and into either Intel NUC's or Docker (me both) leaving us without bluetooth support or at least not easily.

I was going to deploy another Pi3 just for the purpose of bluetooth tracking my plant sensors then connect this to my main HA instance using MQTT Eventstream; one on each floor.

Then I came across your solution on the HA forums so I though goly, wouldn't it be great if this could do that too. You have both bluetooth tracking, WiFi and MQTT so here is my official feature request. Feel free to laugh :)

Guest mode

Is there a mode at all that would let me search continuously for all devices without predefining them and receiving the id and name of the device on the mqtt topic?

need help

I have a MiBand 3 Xiaomi and i want to use it with your program but i have this issue:location/owner/habitacion1/EC:89:64:02:CC:54 {"confidence":"0","name":"Invalid device: No such device","scan_duration_ms":"5071","timestamp":"Sun Sep 09 2018 08:52:17 GMT+0200 (CEST)"} .
in my mqtt i have this:
mqtt_address="my broker" mqtt_port="1883" mqtt_user="myuser" mqtt_password="mypassword" mqtt_topicpath="location" mqtt_room="habitacion1"

and in my owner_devices i have:

EC:89:64:02:CC:54 #mywatch

in Hassio sensor i have:
- platform: mqtt state_topic: 'location/owner/habitacion1/EC:89:64:02:CC:54' value_template: '{{ value_json.confidence }}' unit_of_measurement: '%' name: 'Habitacion'
but my sensor.habitacion he still 0% and i was in my room with my watch.

Can you help me plz? sorry for my language.i leave in spain.

Can topic name not using MAC? I can't let openhab read this info

location/pi_zero_location/00:00:00:00:00:00 , as I think openhab not able to read topic name with:
in owner_devices, you set as "00:00:00:00:00:00 #My-Phone", can the mac address be assign on second part? My_Phone as below
location/pi_zero_location/My_Phone

Enhance OpenHAB compatibility without colons

While this is an incredibly awesome script I do have a hard time to use these MQTT messages in openHAB because of the colons in topic.

OpenHAB uses colons in MQTT binding and so mac addresses with lots of colons don’t work:

Item myItem {mqtt="[:::], [:::], ..."}

Would be great if there would be an option to change the topic title to not use colons or just bring that piece of information into payload.

Installing pi-bluetooth forces reinstall of older bluez

Hello and thank you for this great project. I'm working on setting it up on an RPi3, but I'm having an issue related to installing the newer bluez version.

make works fine. Then I run sudo make install, which appears to complete without errors:

pi@MyPi:~/bluez-5.49 $ sudo make install
make --no-print-directory install-am
 /bin/mkdir -p '/usr/lib'
 /bin/bash ./libtool   --mode=install /usr/bin/install -c   lib/libbluetooth.la '/usr/lib'
libtool: install: /usr/bin/install -c lib/.libs/libbluetooth.so.3.18.16 /usr/lib/libbluetooth.so.3.18.16
libtool: install: (cd /usr/lib && { ln -s -f libbluetooth.so.3.18.16 libbluetooth.so.3 || { rm -f libbluetooth.so.3 && ln -s libbluetooth.so.3.18.16 libbluetooth.so.3; }; })
libtool: install: (cd /usr/lib && { ln -s -f libbluetooth.so.3.18.16 libbluetooth.so || { rm -f libbluetooth.so && ln -s libbluetooth.so.3.18.16 libbluetooth.so; }; })
libtool: install: /usr/bin/install -c lib/.libs/libbluetooth.lai /usr/lib/libbluetooth.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/bin'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c client/bluetoothctl monitor/btmon tools/rctest tools/l2test tools/l2ping tools/bccmd tools/bluemoon tools/hex2hcd tools/mpris-proxy tools/btattach '/usr/bin'
libtool: install: /usr/bin/install -c client/bluetoothctl /usr/bin/bluetoothctl
libtool: install: /usr/bin/install -c monitor/btmon /usr/bin/btmon
libtool: install: /usr/bin/install -c tools/rctest /usr/bin/rctest
libtool: install: /usr/bin/install -c tools/l2test /usr/bin/l2test
libtool: install: /usr/bin/install -c tools/l2ping /usr/bin/l2ping
libtool: install: /usr/bin/install -c tools/bccmd /usr/bin/bccmd
libtool: install: /usr/bin/install -c tools/bluemoon /usr/bin/bluemoon
libtool: install: /usr/bin/install -c tools/hex2hcd /usr/bin/hex2hcd
libtool: install: /usr/bin/install -c tools/mpris-proxy /usr/bin/mpris-proxy
libtool: install: /usr/bin/install -c tools/btattach /usr/bin/btattach
 /bin/mkdir -p '/usr/libexec/bluetooth'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c src/bluetoothd obexd/src/obexd '/usr/libexec/bluetooth'
libtool: install: /usr/bin/install -c src/bluetoothd /usr/libexec/bluetooth/bluetoothd
libtool: install: /usr/bin/install -c obexd/src/obexd /usr/libexec/bluetooth/obexd
 /bin/mkdir -p '/usr/lib/cups/backend'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c profiles/cups/bluetooth '/usr/lib/cups/backend'
libtool: install: /usr/bin/install -c profiles/cups/bluetooth /usr/lib/cups/backend/bluetooth
 /bin/mkdir -p '/etc/dbus-1/system.d'
 /usr/bin/install -c -m 644 src/bluetooth.conf '/etc/dbus-1/system.d'
 /bin/mkdir -p '/usr/include/bluetooth'
 /usr/bin/install -c -m 644 lib/bluetooth.h lib/hci.h lib/hci_lib.h lib/sco.h lib/l2cap.h lib/sdp.h lib/sdp_lib.h lib/rfcomm.h lib/bnep.h lib/cmtp.h lib/hidp.h '/usr/include/bluetooth'
 /bin/mkdir -p '/usr/share/man/man1'
 /usr/bin/install -c -m 644 tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1 tools/hid2hci.1 '/usr/share/man/man1'
 /bin/mkdir -p '/usr/share/man/man8'
 /usr/bin/install -c -m 644 src/bluetoothd.8 '/usr/share/man/man8'
 /bin/mkdir -p '/usr/lib/pkgconfig'
 /usr/bin/install -c -m 644 lib/bluez.pc '/usr/lib/pkgconfig'
 /bin/mkdir -p '/lib/udev/rules.d'
 /usr/bin/install -c -m 644 tools/97-hid2hci.rules '/lib/udev/rules.d'
 /bin/mkdir -p '/lib/udev'
  /bin/bash ./libtool   --mode=install /usr/bin/install -c tools/hid2hci '/lib/udev'
libtool: install: /usr/bin/install -c tools/hid2hci /lib/udev/hid2hci

Then I run sudo apt-get update and sudo apt-get upgrade -y, which doesn't install or update anything.

There's no bluetoothd in my path at this point, but it does exist in src/bluetoothd:

pi@MyPi:~/bluez-5.49 $ which bluetoothd
pi@MyPi:~/bluez-5.49 $ bluetoothd -v
-bash: bluetoothd: command not found
pi@MyPi:~/bluez-5.49 $ src/bluetoothd -v
5.49

Then I run sudo apt-get install pi-bluetooth, but instead of being given the option to skip bluez installation during setup, an older version of bluez (5.43) is forced on me (only one file conflicts):

pi@MyPi:~ $ sudo apt-get install pi-bluetooth
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  bluez
Suggested packages:
  pulseaudio-module-bluetooth
The following NEW packages will be installed:
  bluez pi-bluetooth
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/725 kB of archives.
After this operation, 3,467 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package bluez.
(Reading database ... 73012 files and directories currently installed.)
Preparing to unpack .../bluez_5.43-2+rpt2+deb9u2_armhf.deb ...
Unpacking bluez (5.43-2+rpt2+deb9u2) ...
Selecting previously unselected package pi-bluetooth.
Preparing to unpack .../pi-bluetooth_0.1.7_all.deb ...
Unpacking pi-bluetooth (0.1.7) ...
Processing triggers for systemd (232-25+deb9u2) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for dbus (1.10.26-0+deb9u1) ...
Setting up bluez (5.43-2+rpt2+deb9u2) ...

Configuration file '/etc/dbus-1/system.d/bluetooth.conf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** bluetooth.conf (Y/I/N/O/D/Z) [default=N] ? n
Created symlink /etc/systemd/system/dbus-org.bluez.service → /lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service → /lib/systemd/system/bluetooth.service.
Setting up pi-bluetooth (0.1.7) ...
Created symlink /etc/systemd/system/multi-user.target.wants/hciuart.service → /lib/systemd/system/hciuart.service.
Processing triggers for dbus (1.10.26-0+deb9u1) ...
Processing triggers for systemd (232-25+deb9u2) ...

Once I go through with installation and allow sudo apt-get install pi-bluetooth to install bluez, I end up with an older version of bluez:

pi@MyPi:~ $ bluetoothd -v
5.43

I saw one other mention of a similar issue in the HA discussion forum, but they were able to resolve it by trying again. I've run through the steps 3 times now with the same result each time.

I've tried rebooting, running make multiple times, sudo make install multiple times, etc. Do you have any suggestions on things to try? I'm hoping I'm doing something dumb... In the meantime I will continue with the older version of bluez.

Thanks again!

Distance / RSSI

Thank you for this awesome piece of work. I'm looking into rolling it out with a Pi in each room, but would like to be able to differentiate in which room a person is. I recall mentioned somewhere, you might look at the possibility of including RSSI in the JSON payload. Is this still on the cards?

Installation step problem?

hi,

[ENABLE SSH] Create blank file, without any extension, in the root, in. How do you understand this step?

After the SD card is written to the IMG file, it is re inserted on the PC. In the boot partition, root directory is found.

False Occupancy Event

Version

0.4.11

Description

False entry events are triggered

Steps to Reproduce:

Unknown

Eventually stops detecting devices, confidence reports as zero until I reboot

When presence is running for awhile, if then stops reporting confidence. Always zero until I reboot which then fixes it.

My behavior_preferences file is this:

#DELAY BETWEEN SCANS OF OWNER DEVICES WHEN AWAY FROM HOME
delay_between_owner_scans_away=6

#DELAY BETWEEN SCANS OF OWNER DEVICES WHEN HOME
delay_between_owner_scans_present=20

#HOW MANY VERIFICATIONS ARE REQUIRED TO DETERMINE A DEVICE IS AWAY
verification_of_away_loop_size=6

#HOW LONG TO DELAY BETWEEN VERIFICATIONS THAT A DEVICE IS AWAY
verification_of_away_loop_delay=3

#PREFERRED HCI DEVICE
hci_device='hci0'

If i then check the status using systemctl, I get network errors:

pi@pi-presence:~/presence $ sudo systemctl status presence.service
● presence.service - Presence service
   Loaded: loaded (/etc/systemd/system/presence.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-07-15 19:37:57 BST; 27min ago
 Main PID: 229 (bash)
   CGroup: /system.slice/presence.service
           ├─ 229 /bin/bash /home/pi/presence/presence.sh &
           ├─4450 /bin/bash /home/pi/presence/presence.sh &
           ├─4451 /bin/bash /home/pi/presence/presence.sh &
           ├─4452 hcitool -i hci0 name 38:53:9C:9A:BC:02
           ├─4453 grep -v not available
           └─4454 grep -vE hcitool|timeout|invalid|error

Jul 15 19:47:18 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:47:20 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:55:18 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:55:26 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:55:27 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:55:29 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:55:29 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:55:38 pi-presence bash[229]: Error: Network is unreachable
Jul 15 19:56:09 pi-presence bash[229]: Error: Network is unreachable
Jul 15 20:00:25 pi-presence bash[229]: Error: Network is unreachable

If I then restart, I seem to get back into a good state:

pi@pi-presence:~/presence $ sudo systemctl status presence.service
● presence.service - Presence service
   Loaded: loaded (/etc/systemd/system/presence.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-07-15 20:05:29 BST; 3s ago
 Main PID: 4513 (bash)
   CGroup: /system.slice/presence.service
           ├─4513 /bin/bash /home/pi/presence/presence.sh &
           ├─4526 /bin/bash /home/pi/presence/presence.sh &
           ├─4527 /bin/bash /home/pi/presence/presence.sh &
           ├─4528 hcitool -i hci0 name 3C:28:6D:1D:8E:66
           ├─4529 grep -v not available
           └─4530 grep -vE hcitool|timeout|invalid|error

Jul 15 20:05:29 pi-presence systemd[1]: Started Presence service.```

This might be unrelated but trying to figure out why it will suddenly stop detecting devices.

Using -t1 option spawns a ridiculous amount of mosquito_sub processes

Over time, the amount of mosquitto_sub processes continues to grow. This hammers the mosquitto broker, with its logs showing a bunch of PINGREQ and PINGRESP messages.

2018-06-18T18:44:43.050523971Z 1529347483: Sending PINGRESP to mosqsub|17759-Beacon2
2018-06-18T18:44:43.050587044Z 1529347483: Received PINGREQ from mosqsub|18451-Beacon2
2018-06-18T18:44:43.050647668Z 1529347483: Sending PINGRESP to mosqsub|18451-Beacon2
2018-06-18T18:44:43.050708761Z 1529347483: Received PINGREQ from mosqsub|20206-Beacon2
2018-06-18T18:44:43.050765635Z 1529347483: Sending PINGRESP to mosqsub|20206-Beacon2
2018-06-18T18:44:43.050821989Z 1529347483: Received PINGREQ from mosqsub|20548-Beacon2
2018-06-18T18:44:43.050880582Z 1529347483: Sending PINGRESP to mosqsub|20548-Beacon2
2018-06-18T18:44:43.050936675Z 1529347483: Received PINGREQ from mosqsub|20736-Beacon2
2018-06-18T18:44:43.050994071Z 1529347483: Sending PINGRESP to mosqsub|20736-Beacon2
2018-06-18T18:44:43.581670083Z 1529347483: Received PINGREQ from mosqsub|21844-Beacon2
2018-06-18T18:44:43.582061173Z 1529347483: Sending PINGRESP to mosqsub|21844-Beacon2
2018-06-18T18:44:43.583568814Z 1529347483: Received PINGREQ from mosqsub|6840-Beacon2
2018-06-18T18:44:43.583715219Z 1529347483: Sending PINGRESP to mosqsub|6840-Beacon2
2018-06-18T18:44:43.784707727Z 1529347483: Received PINGREQ from mosqsub|6493-Beacon2
2018-06-18T18:44:43.785003870Z 1529347483: Sending PINGRESP to mosqsub|6493-Beacon2
2018-06-18T18:44:43.785106108Z 1529347483: Received PINGREQ from mosqsub|16358-Beacon2
2018-06-18T18:44:43.785203191Z 1529347483: Sending PINGRESP to mosqsub|16358-Beacon2
2018-06-18T18:44:43.785301315Z 1529347483: Received PINGREQ from mosqsub|20910-Beacon2
2018-06-18T18:44:43.785400324Z 1529347483: Sending PINGRESP to mosqsub|20910-Beacon2
2018-06-18T18:44:43.858785575Z 1529347483: Received PINGREQ from mosqsub|17412-Beacon2
2018-06-18T18:44:43.859020364Z 1529347483: Sending PINGRESP to mosqsub|17412-Beacon2
2018-06-18T18:44:43.859403850Z 1529347483: Received PINGREQ from mosqsub|21083-Beacon2

Installing new version of BlueZ

I have a older version of Bluez running on my device.
root@ubuntu:~# bluetoothd -v
5.37
How do I update this to a newer version.
I followed the instructions on how to install a new bluez version and then downloaded and installed bluez v 5.50.
But it seems that my system still uses older version of bluez. How do i delete the older version or specify to use new version?
I followed the steps of installation from:
https://learn.adafruit.com/install-bluez-on-the-raspberry-pi/installation

Note that I'm not using raspberry pi. I'm using linux inside a container.

Presence confirmed after reboot

Hi, I'm using your solution with succes on 4 raspberry pui 0.

Sometimes my PI need a reboot, but when it restarts, the presence script evidence a presence "on" also if before the presence was "off". of course after some seconds the presence is set again "off".

Is it possible modify the script to avoid this?

Thanks

Guido

Incorrect Name from Cache

Version

0.4.11

Description

Names of devices from cache are incorrectly reported

Steps to Reproduce:

Unknown

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.