sudo bash monitor.sh -tdr
Which basically means depart scan only on trigger and continuously scan for arrival.
Regards
sudo bash monitor.sh -tdr
Which basically means depart scan only on trigger and continuously scan for arrival.
Regards
Super thank you.
I’m trying to get this running on a NUC running Ubuntu 18.04, but the most recent version of mosquitto I am able to install is 1.4.15 and thus is not satisfying the greater than version 1.5 check. Any thoughts?
Have you tried adding the mosquitto-dev PPA to your repositories list?
See the very bottom of this page: https://mosquitto.org/download/
FYI i’m currently on 0.2.194 and this script has been very consistent.
Ive probably posted this already but this is the section I use for departing which I do on a Door trigger.
sudo bash monitor.sh -u -tdr -x
do_nothing:
sequence:
- delay: 00:00:01
mqtt_depart:
sequence:
- data_template:
topic: location/scan/arrive
service: mqtt.publish
- 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
- service_template: "{% if states.sensor.benji_bedroom.state | float != states.sensor.benji_living_room.state | float %} script.mqtt_restart {% elif states.sensor.bridget_bedroom.state | float != states.sensor.bridget_living_room.state | float %} script.mqtt_restart {% else %} script.home_status {% endif %}"
mqtt_restart:
sequence:
- data_template:
topic: location/scan/restart
service: mqtt.publish
- delay: 00:00:40
- service_template: "{% if states.sensor.benji_bedroom.state | float != states.sensor.benji_living_room.state | float %} script.mqtt_notify_fail {% elif states.sensor.bridget_bedroom.state | float != states.sensor.bridget_living_room.state | float %} script.mqtt_notify_fail {% else %} script.home_status {% endif %}"
home_status:
sequence:
- delay: 00:00:01
- service_template: "{% if states.sensor.home_occupancy_benji.state | float == 100 %} script.benji_home_state {% elif states.sensor.home_occupancy_benji.state | float == 0 %} script.benji_not_home_state {% else %} script.do_nothing {% endif %}"
- service_template: "{% if states.sensor.home_occupancy_bridget.state | float == 100 %} script.bridget_home_state {% elif states.sensor.home_occupancy_bridget.state | float == 0 %} script.bridget_not_home_state {% else %} script.do_nothing {% endif %}"
alias: Home_Status
mqtt_notify_fail:
sequence:
- service: script.home_status
- service: notify.benji
data:
title: Sensor Mismatch
message: Your sensors are missmatched after a restart
I just thought I’d add my thanks to the Andrew and the others who have developed this great solution. I’ve had it installed for about a week, and it’s working fabulously. I’ll add a couple of notes in case others encounter anything similar:
I have 3 Rpi’s running Monitor nodes. 2 are Pi 3 B+'s connected via Ethernet and one is a Pi-sero W connected via Wifi. It seems like there is a huge difference in detection range between these. The Pi-W is good for about one room whereas the Pi 3’s are good even across two floors of the house. I know many are running Pi 0 W’s without difficultly, so it may be the difference between WiFi connection versus wired connection. I’ve ordered an Ethernet adaptor for the zero-W just to see if going wired increases the range.
I use motion detection on my Hikvision cameras triggered by a webhook from my Synology Sureveillance Station software to trigger the departure scan. So far, this is working flawlessly. For information on the Surveillance Station implementation, see here: https://community.home-assistant.io/t/surveillance-station-camera-motion-detection-in-hass/70680/33. There is some controversy on the thread about whether this works, but it’s flawless for me.
I have been struggling with configuring Monitor but I seem to be getting closer. One question I have which may be a very obvious one but does your phone need to ‘connect’ to the Pi (ie be paired and then connect)?
I know in the standard Bluetooth integration it did not need to pair or connect to the Pi.
The reason I ask is that I can pair my phone but cannot connect. I get the message Failed to connect - no usable services on this device. Using a Pi3.
Thanks
No, I’ve not paired, and there’s no need to connect.
Pairing is only needed if you want the RSSI figures as far as I know.
Thanks for confirming that. Looks like I need to do some more investigation.
I have Monitor setup with “PREF_DEVICE_TRACKER_REPORT=true”
as I only have one Pi3 and I want to use it for presence detection. I have the two entities for both our phones in HASS but they are not changing from home to not_home.
I’ll keep looking at it and post if I get really stuck
Hi
Anybody know how to debug bluetooth if it doesnt work.
Right now im getting confidence 0 on all my added devices.
When i try to run sudo hcitool lescan i dont get any devices either. Im setup is a pi 3b with ethernet connection and adguard home.
@andrewjfreyer I have added a Chipolo: https://chipolo.net/en/, must be unpaired with phone and found mac with command sudo bash monitor.sh -b
, but it is found only few moments, then is confidence 0. If i run sudo bash monitor.sh -b
it get back for moment, but iphones and watches works fine. Chipolo found few times: https://imgur.com/a/gU8oJyF. I think it only turn on bluetooth when I press the button on Chipolo!? Because the monitor find it/update then fro 5 minutes. Is this fixable?
I paired my Chipolo with my phone, which improved the visibility later. It still regularly drops off visibility, even if it’s not moving - watching the logs shows that it doesn’t beacon that regularly, and sometimes goes quiet.
I now treat them the same as any other BT device - if a door didn’t open, it can’t have left.
When its paired with phone, and added to known_static_addresses
in monitor I get always confidence 0 or wont find Chipolo, how have you workaround this?
Maybe it needs unpaired on the phone end?
Have again unpaired. If i delete mac address from known_static_addresses
or/and known_beacon_addresses
it change mqtt mac address from _
to :
. Phones have _
. So I have now 2 sensors for testing. But still I must click on Chipolo to get detected and it drops connection after 5min and never come back again. Or when I unpair it from phone, it get instant visible for 5min.
Interesting that the Chipolo does that…have you tried deleting its app as well? The Tiles I have do not work well at all if I have the app on the phone, but once it’s removed they’re rock-solid, never had a dropout from them in nearly 5 months.
This is extremely promising. Two questions I have after tinkering around. I have a NUC as my main device and a pi3 as the second with default settings on both.
Yes, deleted too. If paired wont work, only unpaired and only when I press button, works for 5min. Without button pressed, no detection at all! I think iphone wont advertise beacons!?
But I don’t see what this has to do with the iPhone…I found out the Tile’s MAC, put it in configuration.yaml and the only connection that goes on is between the Pi and the Tile - Monitor is constantly scanning and whenever it detects the Tile’s MAC within its range, it sets me to Home, no phone involved at all.
Few reported that they had working with phones. Have it done exactly as you, but with button press. monitor
also found the old Mi band 2, an alternative for car, can also charge it there, battery life was then about 35days.
Update: Have installed monitor
on Kodi OSMC on rPI 3B+. same procedure. Happy to use Kodi with monitor
!
NUT and iTAG-ebay working great!