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

automation
mqtt
Tags: #<Tag:0x00007fd07c9c9e98> #<Tag:0x00007fd07c9c9d30>

#427

That should be an easy task for this project. LEt me know if you want me to help you remotely. DOnt worry I wouldnt charge you or anything. What you could try is
hcitool name 00:00:00:00:00:00

This will show you if the name scans are working properly.


#428

thanks… I wasn’t saying you would and I do appreciate it! :slight_smile:

yep name scans work perfectly and arrival scans also work via the schedule in the preference setting. Just need to find out how to trigger them so I know monitor detect our phone as we get close to the house. BT is detected well into the street.


#429

if you are using Monitor.sh -trd -x this will trigger on bluetooth advertisement AND trigger with a message sent to the MQTT server $mqtt_topicpath/scan/DEPART

if your name scans are working properly then there really should be an issue unless your phone doesnt follow the BLE spec which would be something before 2011 i think


#430

yeah this is exactly what I am running at the moment. just tested sat here… BT off , manually sent the depart message via HA, count down to 0 - perfect.
wait 10 minutes, turn BT back on…5 minutes later, so no arrive ran. It is a 2018 Huawei mate 10 pro phone.


#431

Are you still getting the HCI errors in the log?

have you tried sending $mqtt_topicpath/scan/ARRIVE from HASS. If this doesnt trigger the arrive that might help us determine whats wrong.


#432

since I did a rebuilt the HCI errors have gone and running the arrive MQTT from HA works perfectly as well


#433

Try running a test to make sure that you phone actually broadcasts random advertisements.

In one ssh session, run the command sudo hcitool lescan while you run in another session sudo hcidump -a. Wait for a moment for the second command to settle down. Then, watch the output when you toggle Bluetooth on and off on your phone.

You should see a “new” device show up every time you toggle. It’ll appear as a random advertisement.


#434

I can confirm that on the beta branch and version 0.1.707 my Nut 3 Mini is now detected correctly with mac address in uppercase in known_static_addresses and with the -g flag.

Now the only undetected device I have is an Apple Watch 4 - anyone successfully detected one of those?


#435

How do you git clone the beta? When I try it, it says it’s not a valid repository :frowning:


#436

just run monitor normally and go to HASS and send a MQTT trigger

location/scan/UPDATEBETA

This will automatically update your instance


#437

Thanks :slight_smile: that seems to work :slight_smile:

Hmm nope it’s still at 0.1.622


#438

I just bought one for testing, so I’ll get it working.


#439

Oh you are on 0.1.622!!!

you need to do

git pull

and update to the latest stable which is 0.1.675

after this you can send the mqtt command to

location/scan/UPDATEBETA


#440

Try this to upgrade to beta:

git fetch
git checkout beta
git pull

#441

git fetch git://github.com/andrewjfreyer/monitor/tree/beta
fatal: remote error:
andrewjfreyer/monitor/tree/beta is not a valid repository name
Email [email protected] for help

I’ve now upgraded to 0.1.675

but publishing to monitor/scan/UPDATEBETA doesn’t do anything monitor just repeats the mqtt message back to me

EDIT: ok thanks guys got it to work now, I was using an old version of my mqtt pref file :frowning: from when I was using presence :stuck_out_tongue: )

EDIT 2: my nut mini still comes up with confidence 0

{“id”:“D7:XX:XX:XX:6D:28”, “retained”:“false”, “version”:“0.1.707”, “confidence”:“0”,“name”:“Nut “,“timestamp”:“Sun Nov 04 2018 00:38:19 GMT+0000 (GMT)”,“manufacturer”:“Unknown”,“type”:“KNOWN_MAC”,“rssi”:””}


#442

Does anybody schedule a reboot of their nodes? I have an issue that on occasion they can become unresponsive. I might add a cron job but wasn’t sure if their was a better way.


#443

Thanks
ahh nope nothing at all. Could it be android 8?


#444

this is what I do. (modified from earlier)
When my door opens I tell it to cancel mqtt_depart script just in case is still running from the last time someone closed the door. Once the door closes this depart script runs. On the last line it restarts the service.

Restarting of the service seems to have kept mine up and running.

mqtt_depart:
  sequence:
  - delay: 00:00:10
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:20
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:30
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:40
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:50
  - data_template:
      topic: location/scan/depart
    service: mqtt.publish
  - delay: 00:00:60
  - data_template:
      topic: location/scan/restart
    service: mqtt.publish

If you really want an actual Reboot im sure @andrewjfreyer could easily add this OR you could modify Line 731 of Monitor.sh. (assuming you are on 0.1.675)

			#RESTART SYSTEM
			sudo reboot

#445

I have the exact same implementation (created from hints in your previous comments, thanks again). Whats the longest you’ve been up and running without requiring a reboot? Since leaving them alone I estimate mine lock up around once a week. Being able to issue a reboot this way will allow me to add some logic to when it takes place.

As if you haven’t already done enough would you mind adding this @andrewjfreyer ? If its added your end I can keep on pulling future changes.


#446

now that I think about it I had one that was getting HCI errors about two weeks ago so one of my values was Unavailable.

When it locks up does it show Unavailable ?