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

Sorry what is the -x option? … Why would I want to retain?

Typo, I meant “-b” instead

Does anyone here have the RSSI values correctly being reported? My Monitor keeps reporting values of “-99” regardless of where the device is. Can’t be right…I don’t think.

I’m linking my reply on github - I’ve manage to make mqtt commands work! Maybe this will help someone:

1 Like

I wonder if someone can point me in the right direction.

The MQTT messages I’m getting from monitor look like this, with an extra new line character at the beginning of the “name” value:

{"id":"B4:F1:DA:28:AD:00","confidence":"45","name":"
steves_phone_ksa","manufacturer":"LG Electronics Mobile Communications","type":"KNOWN_MAC","retained":"false","timestamp":"Wed Dec 11 2019 04:09:35 GMT-0800 (PST)","version":"0.2.197"}
{"id":"B4:F1:DA:28:AD:00","confidence":"0","name":"
steves_phone_ksa","manufacturer":"LG Electronics Mobile Communications","type":"KNOWN_MAC","retained":"false","timestamp":"Wed Dec 11 2019 04:09:38 GMT-0800 (PST)","version":"0.2.197"}
{"id":"A8:87:B3:EB:09:00","confidence":"100","name":"
dennis_phone_ksa","manufacturer":"Samsung Electronics CoLtd","type":"KNOWN_MAC","retained":"false","timestamp":"Wed Dec 11 2019 04:10:43 GMT-0800 (PST)","version":"0.2.197"}

As a result, none of my sensors work. Here’s how those are set up:

  - platform: mqtt
    state_topic: 'monitor/pi1/steves_phone_ksa/confidence'
    value_template: '{{ value_json.confidence }}'
    unit_of_measurement: '%'
    name:  pi1_stevesphone

I’m very new at this and I have no clue what could be causing this. Can anyone help?

Hello, we’re you able to find the cause of the echo loop issue? I seem to be having it as well. Thanks.

Use the beta channel
https://github.com/andrewjfreyer/monitor/commit/36a05b38656279dfdfdbb8ca7efd381bbca2fd26

Do you mean that I need to switch to the beta version of the software? Is it stable enough for a beginner to use?

Yes, i think the only stuff that’s changed is some readme and the echo-loop.

Ok, thanks, I’ll give it a shot. I’m scared. But I’ll give it a shot. Haha.

Well, that seemed to work exactly as it should. Thanks for your help.

Fixed it with node-red in a really draconian manner - don’t judge me :wink:.
It has been working for 48hrs now with no annoying growing list of random mac addresses and that annoying beacon at the root of it. I’ve accepted there are things I can’t get rid of easily if i use the -x and -b options, so this solution works for me.

Monitor is fab BTW!

This is the code in case it helps anyone:

[{"id":"a55f5ba2.482e38","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"7997d56a.011454","type":"mqtt in","z":"a55f5ba2.482e38","name":"","topic":"monitor/living_room/#","qos":"2","datatype":"auto","broker":"cb142582.48a888","x":160,"y":200,"wires":[["243b92fb.1348ee"]]},{"id":"54d14628.a1512","type":"debug","z":"a55f5ba2.482e38","name":"keep","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"topic","targetType":"msg","x":890,"y":220,"wires":[]},{"id":"17f882c4.202875","type":"debug","z":"a55f5ba2.482e38","name":"clear","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"topic","targetType":"msg","x":890,"y":280,"wires":[]},{"id":"bfb3e9ea.9df9f8","type":"change","z":"a55f5ba2.482e38","name":"clear payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":340,"wires":[["91e61c5.ca48fe","17f882c4.202875","853b04c6.09b29","5232feab.8098e"]]},{"id":"91e61c5.ca48fe","type":"mqtt out","z":"a55f5ba2.482e38","name":"delete retained","topic":"","qos":"0","retain":"true","broker":"cb142582.48a888","x":860,"y":340,"wires":[]},{"id":"243b92fb.1348ee","type":"rbe","z":"a55f5ba2.482e38","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"topic","x":370,"y":220,"wires":[["ec5d5e68.c5519"]]},{"id":"df922420.2ec5d","type":"switch","z":"a55f5ba2.482e38","name":"filter topics","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":"(iphone|ipad|ipod|key|band3pro|fitbit|skoda|wallet|status|scan|setup|work|reset|spare)","vt":"str","case":true},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":710,"y":220,"wires":[["54d14628.a1512"],["3dbbd07e.746f88"]]},{"id":"3dbbd07e.746f88","type":"delay","z":"a55f5ba2.482e38","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":560,"y":280,"wires":[["bfb3e9ea.9df9f8"]]},{"id":"853b04c6.09b29","type":"change","z":"a55f5ba2.482e38","name":"topic cleared","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"Topic Cleared: \"&msg.topic","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":400,"wires":[["b2b954d1.3bf0c"]]},{"id":"b2b954d1.3bf0c","type":"flogger","z":"a55f5ba2.482e38","name":"info","logfile":"nodered.log","inputchoice":"object","inputobject":"payload","inputobjectType":"msg","inputmoustache":"Recieved payload {{payload}} and topic {{topic}}","loglevel":"INFO","logconfig":"f673e95e.e1ef","sendpane":true,"x":510,"y":400,"wires":[["a6148391.d557c8"]]},{"id":"a6148391.d557c8","type":"change","z":"a55f5ba2.482e38","name":"topic cleared","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"The topic: \"&msg.topic&\" has been cleared from MQTT\"","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"\"Topic Cleared: \"&msg.topic","tot":"jsonata"},{"t":"set","p":"sound","pt":"msg","to":"none","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":400,"wires":[["9bb4bf25.431b78"]]},{"id":"ec5d5e68.c5519","type":"switch","z":"a55f5ba2.482e38","name":"","property":"reset","propertyType":"msg","rules":[{"t":"eq","v":"reset","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":530,"y":220,"wires":[[],["df922420.2ec5d"]]},{"id":"f7e74a3e.f109f8","type":"change","z":"a55f5ba2.482e38","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":260,"wires":[["243b92fb.1348ee"]]},{"id":"5232feab.8098e","type":"delay","z":"a55f5ba2.482e38","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":360,"y":300,"wires":[["f7e74a3e.f109f8"]]},{"id":"dcf24b32.c508c","type":"mqtt out","z":"a55f5ba2.482e38","name":"","topic":"monitor/living_room/delete_me_now","qos":"1","retain":"true","broker":"cb142582.48a888","x":490,"y":560,"wires":[]},{"id":"eb1e78d2.5fb6a","type":"inject","z":"a55f5ba2.482e38","name":"dummy device tracker","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":540,"wires":[["dcf24b32.c508c","2a744779.f9ce58","87789d6c.450a28","729dea7b.93f7fc"]]},{"id":"2a744779.f9ce58","type":"mqtt out","z":"a55f5ba2.482e38","name":"","topic":"monitor/living_room/delete_me_now/device_tracker","qos":"1","retain":"true","broker":"cb142582.48a888","x":530,"y":500,"wires":[]},{"id":"eb97644f.332758","type":"mqtt in","z":"a55f5ba2.482e38","name":"","topic":"monitor/office/#","qos":"2","datatype":"auto","broker":"cb142582.48a888","x":180,"y":260,"wires":[["243b92fb.1348ee"]]},{"id":"87789d6c.450a28","type":"mqtt out","z":"a55f5ba2.482e38","name":"","topic":"monitor/office/delete_me_now/device_tracker","qos":"1","retain":"true","broker":"cb142582.48a888","x":520,"y":620,"wires":[]},{"id":"729dea7b.93f7fc","type":"mqtt out","z":"a55f5ba2.482e38","name":"","topic":"monitor/office/delete_me_now","qos":"1","retain":"true","broker":"cb142582.48a888","x":470,"y":680,"wires":[]},{"id":"9bb4bf25.431b78","type":"pushover api","z":"a55f5ba2.482e38","d":true,"keys":"b8684a67.560198","title":"","name":"","x":880,"y":400,"wires":[]},{"id":"cb142582.48a888","type":"mqtt-broker","z":"","name":"mosquitto","broker":"ubuntu1.localdomain","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"f673e95e.e1ef","type":"config-log","z":"","logname":"standard-logging","logdir":"/usr/src/node-red/logs","stamp":"utc","logstyle":"plain","logrotate":true,"logcompress":true,"logrotatecount":"31","logsize":"1000"},{"id":"b8684a67.560198","type":"pushover-keys","z":"","name":"node-red api"}]

Hello @StephenSimon,

It is to use the dev version, it has a fix for this issue in it.

Regards

Unfortunately, this didn’t work for me. Echo and Restart both get no reply. Is there any sort of heartbeat message that goes out that I can link to a node-red automation?

My understanding is that echo IS the heartbeat function you’re looking for. I don’t think restart is supposed to receive a response.

Thank you. Has anyone found a solution for the problem of the script not detecting the known devices after a couple hours? I saw a thread on GitHub, but I didn’t see any solution. Also, is monitor still being developed? Seems like it’s been pretty quiet for awhile

Does anyone know of a guide/instructions to add the Monitor utility to a Hassio setup? Or is it not worth the hassle and better to run it on a separate unit (RPi, PiZero, etc)?

Thx!

Run it on a separate Pi - it means you can put it where the detection is best

1 Like

I was hoping to re-use a RPi I already have in the garage to detect presence within the garage only (its far enough from the main house to not pick up stray BT connections). If its too much hassle I’ll probably just go for a Pi Zero.

I would go for the model A+ https://www.raspberrypi.org/products/raspberry-pi-3-model-a-plus/
I’ve had troubles with my zeros, replaced them by A+ and all my troubles where gone.

1 Like