Reliable presence detection but not bluetooth

Yes, I meant Bayesian. Thanks! Darn auto-correct
.

I might try Life360 and Google Maps a go and combine with either Ping or nmap to see how I get on.
I have been looking into and trying to configure Monitor but it is not that easy to work out and has been driving me mad trying to get it to work.

I will report back with finding.

Thanks for all the advise.

@pnbruckner has a composite device tracker that integrates several device trackers.

I use an appdaemon script (since the composite didn’t exist when I needed this) to do something similar; it:

  1. Only uses Ping to change state to “home” (so if my phone disconnects, it won’t show me as “away”)
  2. Uses both google maps and life360 (though any one of them seems sufficient)
  3. Can integrate any other sensor you’d like.

I modified this from a script by arsaboo.

I haven’t tried the composite, but the script works great for me (android). I’ve had a few false “away” reports from my girlfriend (iOS). The only thing different in out setup is that she also uses the iOS component. But for pure android life360/google maps/ping, I’ve never had a false report.

Have you tried a bluetooth dongle on USB and pass it through Proxmox to your home assistant config? This will probably work (haven’t tried it myself though). The internal bluetooth adapter of the NUC is for as I know not usable.

Glad it’s not just me that can’t get their head around getting Monitor set up.
Shame there isn’t a youtube video showing the process of getting it up and running (I understand flags etc have changed over time, but from what I can gather the general process itself remains much the same?) and then a link to the latest flags and their uses.

If it helps, here are the steps I followed to get Monitor running: Bluetooth LE Tracker issues

1 Like

Thanks for the details on Monitor. I will give it another try. Would be good the get a detail YouTube on the setup of this as many are finding it difficult.

I set up Ping just to get things working without the Bluetooth and also added Life360 which I promptly uninstall as it killed my phone battery.
I don’t need to track our phones outside of home so until some sort of battery friendly solution is available I’m happy not to have this functionality.

If I still have problems with Monitor then I might try a USB dongle in the NUC and see if I can pass that through with Proxmox and then use that and Ping. The problem with a USB dongle is that there are not many with good compatible with Linux.

I’ll update on progress as I go and thanks for all the suggestions

I use the ASUS BT400 as a Bluetooth stick on my server and Linux itself doesn’t seem to have a problem with it, for presence detection it seemed more a case of HA’s BT trackers not working correctly on anything other than the Pi’s BT.

I am currently using it to connect to a Mi Flora sensor and it seems generally OK, though might be tempted to set up Plant Gateway, as it would appear to be more reliable.

Hi,
I am still having issues with setting up Monitor. I looked at the link to your post but I am getting an error on behavior_preferences file. I could not find this file so I created it in the monitor directory. Is this correct or does it exist and I just cannot find it? I’m getting the error.
behavior_preferences: line 1: “PREF_DEVICE_TRACKER_REPORT=true”: command not found
Any ideas?

Start it once with sudo bash monitor.sh, I guess I didn’t realize I had started it previously, the first start should create it.

I have sorted this out. Systems asked me to create default file after failure which it did and I can now see the correct behavior_preferences file

Thanks John.
I’m still confused with the mqtt_preferences and the entry in configuration.yaml for the device tracker. Could you take a look at the following and tell me if I am in the right direction?

In configuration.yaml

  - platform: mqtt
    devices:
        colleen_android: 'monitor/android/[C0:EE:FB:F6:1A:4A]/device_tracker'

The mqtt_preferences file

# MOSQUITTO PREFERENCES
#								
# ---------------------------

# IP ADDRESS OR HOSTNAME OF MQTT BROKER
mqtt_address=192.168.1.xx

# MQTT BROKER USERNAME
mqtt_user=mqtt

# MQTT BROKER PASSWORD
mqtt_password=xxxx

# MQTT PUBLISH TOPIC ROOT 
mqtt_topicpath=monitor

# PUBLISHER IDENTITY 
mqtt_publisher_identity='android'

# MQTT PORT 
mqtt_port='1883'

# MQTT CERTIFICATE FILE
mqtt_certificate_path=''

#MQTT VERSION (EXAMPLE: 'mqttv311')
mqtt_version=''

Any help welcome

OK, I still did not have any luck with Monitor but the good news is that I configured Ping and it has been working flawlessly for the last couple of days. I have no dropouts or problems with both our Android phones going to sleep. I will run with this for a week and see how it goes.

I am going to give up with Monitor and remove the Pi3 as it is not ideal to have an additional box anyway and if I ever figure out how to pass through the Bluetooth from the NUC running Proxmox then maybe I will move back to Bluetooth as well.

I would like to add an additional form of presence detection so it is reliable, so I may still look at adding other options. In the meantime, I will run with Ping.
I would be interested to see what the new Android app brings that is being developed which may solve some problems for many of us.

A little off-topic but moving to a NUC and Proxmox was a great move. Hassio runs great in its VM and I have another VM running Windows 10 which runs my Plex server and newsgroup programmes. Previously these ran on a Pi3 and an old Thinkpad T420 for Plex etc. Now both replaced with a small NUC running both. I also love the fact I can easily back these VMs up or even clone them so test new versions of Hassio without breaking the production one.

Thanks for all your input into this discussion. It’s such a great community and one I am happy to be part of.

I’ve always found that GPS based trackers are less than ideal for home/away detection. They can take some time to update, so you don’t get shown as home or away for 5, 10, 15 minutes (or more, depending on the configuration of your GPS tracker). With monitor it takes maybe 30 seconds to detect home/away.

:slight_smile: 5 minutes is a long time to stumble around in the dark or wait for the heating!

Yes, I am not keen on GPS as the apps suck the life out of the battery. I have enough apps running on my phone without another power hungry one.
Like you say, updating can take some time but I guess if you want to track where you phones are outside of home they can be useful. Combining with something quicker to update is also a good option.

When I was using Bluetooth I found it to be very reliable and the updating was very fast. I would pull up on the drive and I was updated as home in seconds. It is a shame I am unable to use it with my NUC and Proxmox setup now but you never know, I might still figure it out!

Sorry for the late reply, 2 things in your configuration.yaml that come to mind:

  • colleen_android should be indented only 2 spaces after “devices”, it should start under the letter “v”, whereas in your case it seems to start under the letter “c”

  • the MAC address there should not be between brackets, it should be ‘monitor/android/C0:EE:FB:F6:1A:4A/device_tracker’

Looks fine other than that…

Also, before I used to manually run it on the Pi after every restart (because I wanted it to run with flag -b), but the advice given here solved that issue, just do this: [monitor] Reliable, Multi-User, Distributed Bluetooth Occupancy/Presence Detection - replace “vi” with “nano”, though, for a smoother text editing experience :smiley:

Hi
Thanks for your reply.
I noticed the error in the spacing and now have the following.

  - platform: mqtt
    devices:
      colleen_android: 'monitor/android/colleen/device_tracker'
      martin_android: 'monitor/android/martin/device_tracker'

I also realised the error with the [ ] and removed these and used the alais instead.
I can see the entities for the phones in Hass but they remain at not_home even when Bluetooth is connected on our phones.

In the MQTT addon log I can see the following

1563738101: New connection from 192.168.1.xx on port 1883.
1563738101: New client connected from 192.168.1.xx as android14249 (p2, c1, k60, u'mqtt').

so I assume messages are getting through but the state is not changing from not_home to home.
I keep looking to see if I can find the issue but if you can think of anything else please let me know.
Thanks

When you run the script manually with -b, do you see your phones in the list of BLE items it is finding?

Yes it finds the phones which is why I could not work out the problem.
I’ll post so further details from the terminal tonight.
Thanks.