Almost there with room presence using beacons!

Hello!

I have a few rooms with a motion sensor (Aeotec Multisensor 6) to turn on lights and it’s working great, however there’s some times when lights will turn off because no motion is detected (but you are in the room and need the light on) so I thought I could also use presence detection using beacons as I carry around my phone everyday with me.

I’ve seen @keatontaylor’s video on youtube but for now is not usable as I don’t live alone, but it’s a great idea anyway. I also saw @bruhautomation’s video but he’s moving a beacon around while I want beacons to be static and report connection to them through my iPhone with Owntracks


So for now I’m here:

I’ve got these 2 beacons setup in Owntracks, and they seem to work more or less ok

Also have HA setup with Owntracks and Mosquito and they are showing up in my HA


But from now I’m totally lost

  1. How can I update my location based on these beacons and also trigger the automations I’ve in place with the lights and the motion sensors? So here it will replace “home” with “office” or “salon”
    see current status -->
  2. And most important, many times happens that I’m connected to both beacons (even if I lower the power transmission, my apartment is not huge) so is there a way to tell HA to keep the location of the bacon based on the signal strength?

Thanks for any ideas!

PD: I’ve been taking a look at mqtt_room_presence and room_assistant but it seems this is also for beacons moving around and not what I’m trying to do

I have been thinking that maybe I’m just complicating things too much, the idea is simple: I would like to turn on and off lights as presence is detected, and of course keep them on until people is gone from that room but the execution seems really hard as there’s a lot of variables to consider. The idea would be like the autonomous vehicle for your house, you walk in and out of rooms and it just works, would love to have a house without wall switches but I guess it’s something too radical

I am thinking about this since I started the HA experience …

This has plagued me as well, even with a working solution as a single occupant. Mostly I couldn’t stand having the lights on a timer to turn off when motion wasn’t detected because it never failed that no matter how long I set the timeout, they would turn off when I was standing in the room.

I’ve discussed this before, but my opinion is that no one solution is going to solve this problem. The collection of data from many sources is what is going to make the occupancy detection much better. The combination of BLE beacons, motion sensors and movement data from worn or carried device seems best suited to make educated decisions, but this is something that hasn’t really been developed into a cohesive solution.

I’ve got this “working”

My set-up is:
1 Beacon in my bedroom
1 Beacon in my living room
1 Beacon in my kitchen.

The “trick” was to use fixed region parameters outside your home range.

Below is the setup for the living room beacon.
In Owntracks:
Radius For Region (m): 0
Latitude 1
Longitude 1

In Home Assistant:
name: Living Room
latitude: 1
longitude: 1
radius: 5

Then I did the same for the Master Bedroom Beacon but used 2 for Longitude & Latitude and 3 for the Kitchen.

I (or you :slight_smile: )have to read the documentation of owntracks, but I think owntracks sends out the position of the last detected beacon.

I’ve placed my beacons as far as possible opposite each other and set the transmit power to a minimum, this gives me hardly any overlap and constantly gives me the correct location of my phone (bedroom/living room/kitchen)

I have to play a little bit with the advertising rate to get an acceptable response time vs. battery life.

(note that I am waiting until Happy Bubbles are available again to buy a couple of those)

1 Like

Thanks for sharing this! Since all my automations currently rely on being detected in my home zone, I would need to add these new room zones somehow to these automations too right? Or will HASS locate you in the home and in the room zone?

Indeed, you will have to create those zones in HA and then use these zones in your automation.
(Make sure you’re zones created in HA match exact same longitude and latitude as the Regions made in OwnTracks)

Example of a Automation Scene:

trigger:
- platform: zone
entity_id: device_tracker.iphone
zone: zone.living_room
event: enter
action:
- service: tts.google_say
entity_id:
- media_player.living_room_home
data:
message: " Welcome in the living room! "

An idea I thought of but cant try due to lack of beacons is to have your phone figure out what beacon you are closest to (based off signal strength) and transmit an MQTT message and when a different signal becomes stronger it sends a kill message like “room/all” payload “off” to turn off every room then send a new signal immediately afterwards to turn on the new room so its only dark for less than a second. I think this is MUCH more reliable than owntracks. I havent had the best experience with owntracks. It is slow, and doesnt always auto update. If you try this let me know how it goes! and if you figure out a better way then PLEASE let me know

I swithed over to Room-Assistance.
I found that Owntracks just drained the battery of my phone
I’ve set up Raspberry Pi Zero W’s around my home, one in every room, with the Room-Assistance application.
The other positive side is that I don’t need to have my phone constanly in my pocket, I just need to wear one beacon.