I looked at the docs at
As the to_state
variable is ‘required’ I’d suggest you need it (makes sense) and the examples are wrong (in some cases).
But in the docs ut says “ requiring below
and/or above
instead of to_state
.”
So I shouldn’t be needing to_state, hm. I have also seen other examples from users with, from what I can tell, functional Bayesian sensor using the same code.
Just a question, Since you are using a Bayesian sensor im assuming that you are using multiple means of presence detection?? I just use the Min_max sensor…
- platform: min_max
name: "Home Occupancy Benji"
type: mean
round_digits: 0
entity_ids:
- sensor.benji_living_room
- sensor.benji_bedroom
- sensor.benji_bedroom1
Here is what one sensor looks like
- platform: mqtt
state_topic: 'location/bedroom/ff:ff:ff:ff:ff:ff'
value_template: '{{ value_json.confidence }}'
unit_of_measurement: '%'
name: 'Benji Bedroom'
availability_topic: "location/bedroom/status"
payload_available: "online"
payload_not_available: "offline"
json_attributes:
- id
- name
- rssi
- version
- manufacturer
- type
- timestamp
- retained
- confidence
This is my automation
- id: Benji_Home
alias: Benji Home
trigger:
- above: '30'
entity_id: sensor.home_occupancy_benji
platform: numeric_state
- entity_id: input_boolean.benji_home
platform: state
to: 'on'
condition:
- below: '25'
condition: numeric_state
entity_id: sensor.home_occupancy_otheruser
action:
- entity_id: script.Benji_Home
service: script.toggle
Hopefully this helps you a little…
Thanks a bunch for your help!
Actually I don’t use any more than monitor MQTT right now. But went with a Bayesian so that I eventually with ease could expand using more presence detections.
Shouldn’t it work with just one observation?
That really wasn’t called for - remember, you were once a newbie who was told to do their homework in the following post after asking a question… Need help with tasker
The reason I asked about the -E option is because I didn’t see any MQTT messages when arrive or depart scans occur. I’ve just double checked again now and still can’t see where this would appear.
I would expect an MQTT message saying /monitor/scan/arrive/start
when *** Started arrival scan. [x2 max rep] ****
appears in the log, and a /monitor/scan/arrive/end
when logs show it finishes **** Completed arrival scan. ****
, but I’m seeing nothing related to this when using sudo bash monitor.sh -E
.
I’m monitoring my MQTT broker using -t "monitor/#"
but only seeing the usual messages from monitor.
I’m not quite sure why you highlighted this as it doesn’t seem related to one of my questions. I’ve been using MQTT for a long time now and have all my Zigbee devices reporting to it.
I should have explained why I was asking - zigbee2mqtt retains MQTT messages either locally (for when HA is rebooting to send when back up) or asks the broker to retain them (so that HA remembers the on/off status of a device), so I wondered which method Monitor uses.
Yes true, there’s many different ways to use these options. I just didn’t know about the useful combination of -tr and -tad at first.
Let’s agree to disagree.
Yes true, it probably is asking for too much here, the info provided is plenty good enough to get started with. I really like your mqtt_depart sequence above too.
I haven’t been happy with my current GPS-based presence tracking and this looks like a very interesting solution.
Can it be run on a Pi 3 Model B, or a laptop with a bluetooth dongle? Any particular hardware requirements or dongle recommendations?
Hi,
I have a question. If I am using an iPhone with the latest IOS, how do I get the correct MAC address that is being discovered by the scan?
as far as I have read, iPhone change the MAC address periodically to prevent tracking.
I am very interested to make this work for me as this will make the perfect presence monitoring/detection in my house.
It will run on a Pi 3 Model B or a Raspberry Pi Zero W. My guess is it would also run on Pi2 with a dongle
The github page has instructions for installation.
Settings > General > About Scroll about halfway down and you’ll see “Bluetooth Address” - this is the address to add to the known_static_addresses
file
Thanks, I’ll give it a shot!
didn’t mean for anything to bash so I do apologize for that. I just know a lot of work has gone into this. Yes he does need to improve documentation but I feel the same way about the entire HASS project. Documentation on every component is lacking. I just felt you were asking a lot but ill keep that to myself. I just dont want the dev to get mad and stop developing because this is literally the only bluetooth detection that actually works consistently IMHO. Anyways we are all here to help each other, if you need any help we got you. (not that im an expert by ANY means lol)
I would say to find out what your goals are with this project and then you can see what parameters you need. Personally I think im using monitor -trd on all of my pi’s this way once my door opens a departs sequence is started (multiple sequences actually). I do departs ONLY on a trigger just in case my phone dies at home.
Question. If I send multiple depart scans does monitor Queue them up OR just rejeect if its in the middle of a scan.
I keep getting an issue where ill have two pi’s at 0 confidence and one will be at 100. So i have to go and vpn to my home and run a depart scan again. Yeah I ould make a rule that fixes this but hoping there is a better way.
It’ll reject a scan if one is scanning. Increase the delays between your triggered scans. As a general rule, a worst-case scenario takes 5 seconds per scan plus whatever your inter-scan delay is. Default is three. So, if you have four devices, you’re looking at 29 seconds per ‘depart’ scan if all four of your devices leave at the same time (e.g., 4*5 + 3*(4 - 1)
). If only one device leaves and three remain home, you’re looking at maybe 14 seconds (5*1 + 3*3
).
I have two devices and I’ve put about 20 seconds between each of my depart scans.
hmmm. I have done that initially but that MAC address is not showing in the scanned devices. it shows some mac address for other devices and everything is showing as unknown
is there any special setting to change?
I had really reliable results the first days but I must have done something or something else happened. Because now this is what I got yesterday when I was home + this night. What could I do to make it more or less perfect as it was before? Before sometimes the only things that happened was 100% to 50% now it’s more unreliable as you can see (:
Using this to scan an iPhone if that matters. Wasn’t low on battery and the night hours I had it charging.
I’ve managed to get this up and running, but I’d like to connect it to my existing MQTT server which is running on the same laptop as Home Assistant (Monitor is running on a separate Pi).
I’ve tried entering the MQTT server details of the laptop and that didn’t work, and neither did attempting to bridge the laptop’s MQTT server to the one running on the Pi.
Has anyone had success with this kind of setup, who’d be kind enough to post their config?
Morning all. I’ve been using Monitor for the past few weeks with the default settings but I’ve notice that the script takes approx 3-5 mins to recognize both an arrival and a depart, any suggestions to speed this up? Previously i had been using the Presence script and it only took 5-10 seconds to connect.
Thanks
Yes mqtt_preferences
# IP ADDRESS OF MQTT BROKER
mqtt_address=192.168.X.X
# MQTT BROKER USERNAME (OR BLANK FOR NONE)
mqtt_user=iamauser
# MQTT BROKER PASSWORD (OR BLANK FOR NONE)
mqtt_password=myuserpassword
# MQTT PUBLISH TOPIC ROOT
mqtt_topicpath=monitor
# PUBLISHER IDENTITY
mqtt_publisher_identity='ha-monitor'
# MQTT PORT
mqtt_port='1883'
# MQTT CERTIFICATE FILE (LEAVE BLANK IF NONE)
mqtt_certificate_path=''
Did you restart Monitor?