Using Tasker for Room Presence when monitor and ha-bt-proximity wont work

I’ve been trying to get a room presence detection set up to work without having to buy additional hardware.
Currently each room that I want to track has a google home and a computer with a bluetooth le adapter.

  1. Tried the google home device tracker method. This doesn’t work because from what I understand google changed the api, so this doesn’t work reliably anymore.
  2. Tried the monitor project. Although the set up was simple and it works well. I do not get RSSI values from the script. So it can tell that I am home but not how close I am to the bluetooth receiver.
  3. Tried the ha-bt-proximity project. After the install, it worked for a bit but then started showing the connection to my MAC Address as “-100.” I restart the the bluetooth services, the machine, etc. No luck. I think because the key part of the app is this command: hcitool cc ${owner} && hcitool rssi ${owner}. When I try to run this command separately i keep getting this error:

hcitool cc 88:9F:6F:D1:C8:AB && hcitool rssi 88:9F:6F:D1:C8:AB
Can’t create connection: Connection timed out
Not connected.

So lastly it brought me to rigging up something through tasker in the interim:

Profile: Broadcast RSSI (95)
    	Location: HOME / 50.0m
    	State: Not Power [ Source:Any ]
    	Time: From 12:05AM every 5m Till 11:55PM
    Enter: BT RSSI (111)
    	A1: Get State [ Configuration:media_player.audiogroup Timeout (Seconds):10 ] 
    	A2: Variable Set [ Name:%audiogroup To:%par1 Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ] 
    	A3: If [ %audiogroup ~ playing ]
    	A4: Stop [ With Error:Off Task: ] 
    	A5: End If 
    	A6: Bluetooth Connection [  Action:Connect Device:Living Room Audio Timeout (Seconds):30 ] 
    	A7: Bluetooth Info [  Type:Single Device Device:Living Room Audio Timeout (Seconds):5 ] 
    	A8: Publish MQTT Message [ Configuration:Home - MYURL : location/livingroom/88:9F:6F:D1:C8:AB : {
    "proximity": "%bt_signal_strength", "id":  "Tasker"
    } : 0 : false Timeout (Seconds):0 ] 
    	A9: Bluetooth Connection [  Action:Disconnect Device:Living Room Audio Timeout (Seconds):60 ] 
    	A10: Bluetooth Connection [  Action:Connect Device:Bedroom Audio Timeout (Seconds):30 ] 
    	A11: Bluetooth Info [  Type:Single Device Device:Bedroom Audio Timeout (Seconds):5 ] 
    	A12: Publish MQTT Message [ Configuration:Home - MYURL: location/bedroom/88:9F:6F:D1:C8:AB : {
    "proximity": "%bt_signal_strength", "id":  "Tasker"
    } : 0 : false Timeout (Seconds):0 ] 
    	A13: Bluetooth Connection [  Action:Disconnect Device:Bedroom Audio Timeout (Seconds):60 ]

Although this method works, I dislike the fact that every time it connects to the google home devices it makes the bluetooth connection sound. So with this task running every 5 minutes, this is going to get annoying very quickly. Also if audio on the speakers is playing, I have set it to not run because the bluetooth connection would kill the audio.

Any suggestions appreciated. Thanks!

Like you I went down many rabbit holes looking for a solution that I liked. Just last week I found FIND3 and so far it’s been perfect. I use Tasker and AutoTools to trigger a task when motion is detected so it’s resource friendly. I am using the active mode of FIND3. My next step is to setup my own FIND3 server.

I tinkered with FIND3 yesterday.
Using their server was very simple but I wasnt able to send the data to my mqtt server. I wish they had an option for that.
Then setting up up my own server was a trial. The docker install method wiped my HA installation. So then I did the manual method and got it up and running but with that method there wasnt an area to point to the MQTT server either.
:confused:

Did you see this github link? https://github.com/schollz/find3/issues/52

I went in a different direction for tracking, instead of using the FIND3 app to track movement I use a tasker profile with AutoTools on my phone to send HTTPS when the phone detects movement. This way the phone resources are only being used when the phone is moving & I’m using https commands (no mqtt) to update the FIND3 server.

Haven’t found the time yet to move to my own FIND3 server, thanks for the tip about how you installed it.

The key to going this way was seeing the transactions generated by the FIND3 app.
Take a look at https://cloud.internalpositioning.com/view/location/yourFAMILY/yourDEVICE
In Tasker, AutoTools Connectivity can build all the data and then it’s just a matter of formatting and HTTP Request.

Let me know if I can explain further. .

I would love you see your tasker profile, if you dont mind. I’ve never had to use autotools and wouldn’t begin to know how to configure it.

I tried to set up main to use mqtt locally. it was a mess.

No problem, I am trying to figure out how to export my task and then I’ll cut & paste it to the forum. I just started using AutoTools myself and couldn’t believe my luck when I saw the data that the wifi connectivity option gave me. It really made this task simple.

Just a little overview, I have 2 profiles and 3 task.

  1. Profile: FIND3 Moving run the task FIND3 when the phone is moving. Triggered by Shake High sensitivity.

  2. Profile FIND3 Wifi Near Triggered when I am near my Home SSID. Runs task FIND3 ON and FIND3 OFF When I’m not home no need for the FIND3 Moving Profile to be active

  3. Task FIND3 Moving - get the autoTools data, reformat and HTTP

  4. Task FIND3 ON Activate FIND3 Moving Profile

  5. Task FIND3 OFF Deactivate FIND3 Moving Profile

AutoTools has so much to offer really worth the cost. Once you install the plugin, in a test task hit plugins, autotools, connectivity, configuration, wifi, check wifi Networks and then flash the %atwifinetworks field.

FIND3

A1: Variable Set [ Name:%Json To:{ "d":"yourDEVICE", "f":"yourFAMILY", "s": { "bluetooth": { }, "wifi": { Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ]

 

A2: AutoTools Connectivity [ Configuration:Check Wifi Networks: true Timeout (Seconds):120 Continue Task After Error:On ] 

A3: AutoTools Json Read [ Configuration:Simple Mode: true

Json: %atwifinetworks

Fields: wifis()

Separator: , Timeout (Seconds):60 ] 

A4: For [ Variable:%index Items:1:%wifis(#) ] 

A5: AutoTools Json Read [ Configuration:Simple Mode: true

Json: %wifis(%index)

Fields: mac,level

Separator: , Timeout (Seconds):60 Continue Task After Error:On ] 

A6: Goto [ Type:Action Label Number:1 Label:ErrExit ] If [ %err Set ]

A7: Variable Set [ Name:%Json To:%Json "%mac":%level, Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ] 

A8: Variable Set [ Name:%home To:y Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ] If [ %mac eq b0:xx:xx:xx:xx ]

A9: End For 

A10: Test Variable [ Type:Length Data:%Json Store Result In:%length ] 

A11: Variable Subtract [ Name:%length Value:1 Wrap Around:0 ] 

A12: Variable Section [ Name:%Json From:1 Length:%length Adapt To Fit:Off Store Result In: ] 

A13: Variable Set [ Name:%Json To:%Json } } } Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:0 ] 

A14: HTTP Request [ Method:POST URL:https://cloud.internalpositioning.com/data Headers: Query Parameters: Body:%Json File To Send: File To Save With Output: Timeout (Seconds):30 Trust Any Certificate:Off ] If [ %home eq y ]

<ErrExit>

A15: Variable Set [ Name:%err To:%err Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] 

A16: Flash [ Text:%http_response_code Long:Off ]

I went ahead replicated your task but I keep getting a json error about
"Input is not valid JSON data for A5 and the %http_response_code isnt producing anything.

my clone:

    FIND3 (115)
    	A1: Variable Set [ Name:%Json To:{ "d":"XXXX", "f":"XXXX", "s": { "bluetooth": { }, "wifi": { Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] 
    	A2: AutoTools Connectivity [ Configuration:Check Wifi Networks: true Timeout (Seconds):120 Continue Task After Error:On ] 
    	A3: AutoTools Json Read [ Configuration:Simple Mode: true
    Json: %atwifinetworks
    Fields: wifis()
    Separator: , Timeout (Seconds):60 ] 
    	A4: For [ Variable:%index Items:1:wifis(#) ] 
    	A5: AutoTools Json Read [ Configuration:Simple Mode: true
    Json: %wifis(%index)
    Fields: mac,level
    Separator: , Timeout (Seconds):60 Continue Task After Error:On ] 
    	A6: Goto [ Type:Action Label Number:1 Label:ErrExit ] If [ %err Set ]
    	A7: Variable Set [ Name:%Json To:%Json "%mac":%level Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] 
    	A8: Variable Set [ Name:%home To:y Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] If [ %mac eq b0:xx:xx:xx:xx ]
    	A9: End For 
    	A10: Test Variable [ Type:Length Data:%Json Store Result In:%length ] 
    	A11: Variable Subtract [ Name:%length Value:1 Wrap Around:0 ] 
    	A12: Variable Section [ Name:%Json From:1 Length:%length Adapt To Fit:Off Store Result In: ] 
    	A13: Variable Set [ Name:%Json To:%Json Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] 
    	A14: HTTP Request [  Method:PATCH URL:https://cloud.internalpositioning.com/data Headers: Query Parameters: Body:%Json File To Send: File To Save With Output: Timeout (Seconds):30 Trust Any Certificate:Off ] If [ %home eq y ]
    	<ErrExit>
    	A15: Variable Set [ Name:%err To:%err Recurse Variables:Off Do Maths:Off Append:Off Max Rounding Digits:3 ] 
    	A16: Flash [ Text:%http_response_code Long:Off ] 

I get that on occasion but I haven’t figured out why. I’m thinking that it might be after I leave home (before the Wifi Near turns off the profile) and the connectivity command doesn’t get any data. I’ll have to go for a ride to verify.

Most of the time the response code is 200 and it updates FIND3 server. Put in an AutoTools Dialog after A2, Dialog type = List, Text = %atwifinetworks, %err, %errmsg This stops the screen waiting for a reply…so much better than Flash

%atwifinetworks shows all the Routers in the area including mac addresses & SSID’s (don’t publish on forum). Which is exactly the information you need for FIND3

Are you getting any information in these fields?
How about the err codes?
Does the %atwifinetworks look like JSON?

If you bring up the FIND3 location raw data screen (https://cloud.internalpositioning.com/view/location/yourFAMILY/yourDEVICE) while you are testing Tasker, you can see if your Tasker generated transactions. Keep an eye on the last updated time.

Update: Looks like you are missing % in A4 before wifis

I had to run a comparison tool but fixed all of the differences.
https://text-compare.com/

It’s working now :smiley:

Now I just have to set up a mqtt bridge to connect the find3 info to my existing hassio mqtt set up :sweat:

I’m glad you got it to work! I’m using a rest sensor instead of mqtt for this sensor. It just seemed easier.

- platform: rest
  resource: https://cloud.internalpositioning.com/api/v1/location_basic/yourFamily/yourDevice
  value_template: '{{ value_json.data.loc }}'
  method: GET
  name: Room Location
  scan_interval: 10
1 Like

Thanks! You truly have been a tremendous help and it has been really appreciated.

You’re Welcome.

Are you getting a for 404 error cloud.internalpositioning.com? It would such a bummer if the service has been decommissioned.

The server does appear to be down. Guess we will need to install the service on our own equipment sooner rather than later.

Took the night but I just got mine up and running using the same rest sensors and tasker task.

I still have this on my to do list. I have an old rPi2 that I was thinking of using. I have one more project to get off my desk then will find the time to install the server, lol

Did you install in Docker?
Are you Hassbian or Hassio?
Did you use these instructions?
https://www.internalpositioning.com/doc/server_setup.md
Easy way or Hard?
Any gotchas you want to share?

Thanks

I run everything off vm’s because I can go back to a snapshot if I mess something up.
The find3 machine and hassio are separate and both run an ubuntu base.

I’d recommend the docker (easy) method since we aren’t using the find3 mqtt method. The other method can be a pain. I run the find3 docker on a separate vm because the first time i installed it, i messed up something and it wiped out my hassio containers. Also by using portainer, I can view the status of all docker containers on both machines.

good to know, thanks

Good day,

I’m tempted to implement this for my home, but wanted to know if this set up still works? And if it does, what the latest implementation looks like? It’s kind of hard to follow on what all the pieces involved are.

Thanks!

WOW, has it been 7 months? I still need to install my own server but other things got in the way. The FIND3 server isn’t reliable but if you install your own then it works as we talked about in the above post. I don’t think I’ve made any changes to it in those 7 months.