An update. My wife has now got the same phone so I changed the settings accordingly & the restarted the services on the RPI’s. Both phones are now working & I’m not to sure why. I suspect it maybe the HA app I have on both our phones where I initially added location tracking & used that as well for the device_tracker.
On both iPhone 11’s I allowed all that it required for the HA to work (location, bluetooth etc) & at the time I believed that is why it was working. Since then I have removed the location tracking & it still works just with the ‘monitor’ setup.
So I’m kind new on this, im using smart things "presence " and sometimes works sometimes with a long delay, it’s annoying, so i want try this monitor, so i need get a new raspberry pi zero w isnt? this is not installed in my PI where im running HA right? just to understand hahaha, and this can work with my phone BLE as far as I understand right? thanks a lot for all people effort!!
@andrewjfreyer, first of thanks for a killer contribution to HASS!
I’m trying to debug my setup (running 3x raspberry pi’s with your monitor script) and I don’t seem to be getting any response from publishing an empty message to monitor/scan/echo or monitor/scan/arrive. Nothing in the logs (running journalctl -u monitor -r). Nothing posted back to $mqtt_topicpath/$mqtt_publisher_identity/echo as described in the README.
Wondering if there’s anything I can do to debug this more? Do you have any advice or ideas as to what might be wrong?
Have you tried using different flags when using monitor? If you sudo bash monitor.sh -h you get an overview of all possible options. When you use “-V” for “verbose” the output of the script will be much more detailed. Also, using “-a” will report all changes like confidence dropping from 100% to 90%, 45% and 0% as separate messages. This should give you more information.
If you want to update the way monitor is run at boot (through systemd) you start monitor with all your desired flags and add the “-u” flag to is. The output of the script will tell you that systemctl is updated. So for instance:
When I post anything to monitor/scan/[echo/restart/etc], nothing occurs and I get no reaction from the script or on MQTT. Is there something specific that I need to configure to get that to work. Also, I didn’t see it in the readme, but is there a place in the documents that describe the available flags (outside of the -h on the local machine)?
Have you checked the output of the monitor script when run with -V for Verbose and -a for all changes? Just in case you (or anyone else who reads this) don’t know how to do this, first stop the service:
sudo systemctl stop monitor.service
and then start the script manually from the monitor directory
sudo bash monitor.sh -V
And just watch what happens there, it should definitely pick up your mqtt messages. As to your last question, no there is no documentation on the different flags. But if you have any specific questions I’m glad to help.
Hello @brthrsam and @jzee
Did you resolve your problem with the detection issue stopping working after a couple of hours? I have the same problem that I can see on both iPhones and my Android phone. I have Andrew’s Presence running in parallel and this seems to work fine but my plan to migrate to Monitor is causing me some problems.
Regards,
Mark
I tried running one of my pi’s with sudo bash monitor.sh -Vrab, published a monitor/scan/echo message to the MQTT and I don’t get anything posted back to $mqtt_topicpath/$mqtt_publisher_identity/echo nor do I see anything new in the terminal. Am I misunderstanding something?
There doesn’t seem to be much activity in the logs on any of the pi’s, with the aforementioned command I only get 4-5 log entries in the first 30 seconds of it running and then nothing for 10 minutes. Restart the script and the same thing happens. Sometimes I get cycling bluetooth hardware on hci0. please wait a moment... and then nothing after that, but sometimes that doesn’t even pop up.
One of my pi’s is a Raspberry Pi B+ with a bluetooth dongle and the other two are Raspberry Pi Zero W, both models are showing similar results. I’ve got two phones being monitored, one is an iPhone and the other a Google Pixel 3.
You can check the status of the Bluetooth radio on your Pi by:
`Sudo service Bluetooth status
Maybe that gives some useful info?
Edit: I’m not a Linux expert, but when using multiple flags I write them out separately like monitor.sh -V -a, maybe that’s a thing? However, if you use the -t flag it requires additional flags, this flag forces the script to only trigger scans based on arrival or depart messages so the flag could be monitor.sh -tad for arrival and depart. This was a bit confusing to me in the beginning, maybe this has something to do with your problems.
Something else you could try to see if at least MQTT is setup correctly is to add a new bluetooth device through MQTT by publishing a mac address to /monitor/setup/ADD STATIC DEVICE with a message mac address and optional alias in the in this format 00:11:22:33:44:55 alias. If this works correctly the added mac should show up in the known_static_addresses file.
No I did not. Instead I plugged my Pi Zero W to a smart plug and created an automation to restart the Pi at night and when I’m not home. Have been working somewhat fine now but I don’t like the solution…
I have a couple of scripts to watch the health of the Pi Zero. One checks for monitor locking up (which as far as I can tell, is purely a Pi Zero issue since it never happens with my Pi 3), at which point it restarts monitor. The other checks for the Bluetooth device going unavailable, at which point it reboots the Pi.
Since doing that, things have been solid on the Zero. Both of these run from cron, every minute: