Looking for presence detection that works every time for a non-programmer

Yeah I was using Bluetooth tracker (not the LE version) but it slowed down my Pi3 too much, didn’t even dare try the LE version due to the warning posted. That’s why I’m wondering if I can use Bluetooth LE on my spare Pi3 and then have it talk to my main HA Pi, but not sure that’s possible/might be too complicated for me to figure out.

I tried different methods over the months and found the iOS app works the best. Wonder why yours isn’t working. I’d personally just try to troubleshoot it (I don’t mind helping) and save your money for some other cool tech. The only thing I ran into, was whenever my phone rebooted etc. it thought I was away. I just adjusted the timeout before it considers me away and now it works exactly as I hoped.

I’m looking for the same thing and had the same experience with icloud/owntracks/etc. I’m also going to the same solution which is to attach a BLE tag to the keychain (solves another problem too: wife leaving her phone at home). It seems that the best bet now is happybubbles, but since it would take some time to order and get one presence detector here, I will try the openmqttgateway (https://github.com/1technophile/OpenMQTTGateway) as i have a few esp8266 lying at my desk and the bluetooth module just arrived. I even hope that it can detect my garmin vivoactive watch as it has BLE and is active all the time.

1 Like

I haven’t tested this out myself yet (planning on trying it out over the next few weeks), If you have homebridge set up, you can create a binary switch and use the home app on the iphone to turn the switch on when you arrive home and turn it off when you leave home. You can then use an automation to set home/away status based on that switch. I have been testing my arrival home by turning a light on when I arrive and it has been working very well so far.

my best guess why it’s not working is due to having older version of HA right now, I’m wondering if I can get it working with a newer version using my spare Pi3 so I can troubleshoot things without worrying about breaking anything on HA Pi3 that runs everything. What version of HA are you running? How reliable is it for you when detecting home and away?

Would love to learn more about whatever you end up doing but would need a super dumbed down version explained to me :wink:

That’s most likely the issue. I always upgrade to the latest version and everything is rock solid. There’s the odd time something breaks but I try to figure it out and fix it soon after.

As for the reliability of the location tracking. I have to say its very good. There’s the odd time I go into the app and it hasn’t updated my location or I need to refresh to connect but other than that it works reliably for my home/away scenes. I combine into a template sensor with my wife’s location so it tracks whether someone is home with a sensor.home_occupancy. I can post that later tonight when I’m home. That way if one of us leaves, it doesn’t turn off the TV, lights, etc. on the other person.

I’m running on a Mac Mini so I can’t much help getting it installed on a Pi3. But with that said, my old Mac Mini is getting quite old now and I was thinking of moving everything to a Pi3 one day. I want to have another instance ready to go in the event my Mac HD just goes kapoot on me.

I use the following to help make my occupancy the most accurate possible. The first thing I do is use these sensors to track if individuals are home or not. Each are a combination of the iOS app device_tracker and my router’s device_tracker. This redundancy I found helps in the case the iOS app stops reporting location, the router determines the status and vice versa:

sensor:     
  - platform: template
    sensors: 
      jeremy_home:
        value_template: '{% if is_state("device_tracker.jeremys_iphone", "home") or is_state("device_tracker.jeremysiphone", "home" ) %}home{% else %}away{% endif %}'
      anja_home:
        value_template: '{% if is_state("device_tracker.anja_iphone", "home") or is_state("device_tracker.iphone", "home" ) %}home{% else %}away{% endif %}'

The last sensor here then combines the preceeding two sensors and has a status of home if at least one of us is home and away if both are away.

      occupancy_status:
        value_template: '{% if is_state("sensor.jeremy_home", "home") or is_state("sensor.anja_home", "home" ) %}home{% else %}away{% endif %}'

Finally I have these automations to enable my home and away scenes. Note, for away, my sensor.occupancy_status has to be away for 10 minutes. This prevents false away triggers.

  - alias: 'Auto Occupancy - Home Mode'
    initial_state: on
    trigger:
      platform: state
      entity_id: sensor.occupancy_status
      from: 'away'
      to: 'home'
    action:
      - service: script.turn_on
        entity_id: script.ecobee_home_mode
      - service: script.turn_on
        entity_id: script.lights_home_mode
      - service: script.turn_on
        entity_id: script.welcome_home_mode
      - service: script.turn_on
        entity_id: script.media_home_mode

  - alias: 'Auto Occupancy - Away Mode'
    initial_state: on
    trigger:
      platform: state
      entity_id: sensor.occupancy_status
      from: 'home'
      to: 'away'
      for:
        hours: 0
        minutes: 10
        seconds: 0
    action:
      - service: script.turn_on
        entity_id: script.ecobee_away_mode
      - service: script.turn_on
        entity_id: script.lights_away_mode
      - service: script.turn_on
        entity_id: script.media_away_mode
      - service: scene.turn_on
        entity_id: scene.away

Just found that I got a unsupported (?) clone of the bluetooth shield. I will have to wait a bit longer to this solution.

so I started messing with my spare Pi3 and my old iPhone tonight, going to see if I can give this another try… I’ve got my spare Pi3 running 0.43.0 now and iOS app loaded and enabled tracking and I’ve got check marks in status under “iOS component loaded” & “Device Tracker Component Loaded” & “iOS Notify Platform Loaded” Inside the app on the map I see a blue dot at my current location too. However there isn’t any device_tracker showing up inside the “< >” area on HA for this phone. Do I need to do something more than putting in the ios: inside the configuration.yaml file? Do I need to add something to known_devices.yaml or device_trackers.yaml?

Hmm. It should automatically add the entry to the known_devices.yaml. Try changing your Device ID in the settings of the iOS app and restart Home Assistant. You can also rename the known_devices.yaml file and see if it creates a new one.

@JtotheDub77 The other thing I forgot to mention was, you know you can also revert to a previous version of Home Assistant by running the command sudo pip3 install homeassistant==0.XX.X

I use this fairly often when something in the new version messes up my setup. Not sure how far back versions are kept but this may also help to keep you a little more up to date with HA.

Thanks, I think it’s working now (I rebooted the Pi3 and after that was done inside the App I sent a one time location update and then it showed up as a known device), going to try to update my main Pi3 to version 0.43.2 later today and see if I can get location working on it with my main system (really I’m trying to avoid a big update on my main Pi3 so I don’t have to go through figuring out any major breaks, maybe later this year when I have time off I’ll venture into a newer version at that time).

Awesome! Glad it’s working.

I find keeping up to date fixes more things than it breaks. I understand the pain when it messes up your home automation. I too, rely on HA for pretty much everything. I did a quick count of the lines of code in my yaml files and it’s over 8000! I find, it gets addictive adding more and more functionality and the more I add the greater the chance stuff will break each update. But like I said, I find more fixes. Also by keeping up to date, it’s easier to fix the little broken things than figure out what’s changed in 6 months. Worst case scenario you can always revert to older versions (which I have had to do on occasion until a fix came).

Anyways, hopefully device tracking will finally work for you so you can spend your cash on other cool tech!! :wink:

I’ll chime in by recommending using your RasPi3 as an iBeacon. I commented about it in another thread you might find useful. It’s been very reliable for me.

Thanks for the share, I’ll have to look into that as a future project, right now my time is going to be spent getting more up to date, I probably shouldn’t let it sit for so long and get so far behind and miss out on cool features!

HI Solo,

Is it still working fine? Could you explain how this works?

Am i right that the Raspberry becomes a iBeacon witch can detect en iphone ? The iphone has an builtin ibeacon (right?). So there can be a precense detection between the RasPi and the iphone over bluetooth…?
Or do you need a little beacon device for it?
Could you perhaps setup a little tutorial how to configure this in HA?

Thanks!

Yes the Raspberry Pi becomes the iBeacon. The iPhone has bluetooth and can detect bluetooth broadcasts.
Essentially the way I believe it works is that you setup the iBeacon (as described in my other post) and it advertises over bluetooth. In Owntracks you associate the iBeacon UUID with map coordinates for the location where that iBeacon is located. So now when Owntracks see a bluetooth broadcast from that UUID it knows the map coordinates of that device and sends it to my Mosquitto broker and is then picked up by HomeAssistant.

Are you referring to Bluetooth BLE tracking? Instead you should be able to use the normal Bluetooth function and track the Bluetooth MAC i think. Bluetooth BLE tracking has a nasty CPU issue currently

Is there any documentation anywhere on how to use beacons with the HA iOS app? I know the old way was to use Owntracks installed on the phone as well but this shouldn’t be necessary anymore I think?