How does this set your status to home though? doesnt a device tracker have to report home?
Step 4 is what I don’t get. Once I leave, my iPhone is no longer connected to my HA homebridge and it can’t turn off the switch (I know, I’m dense )
Thanks,
Tom
you need an apple tv for homekit automations to work outside
Darbos is right on. An iPad with iOS 10 could also work as a hub.
Mike thanks for all the help, is that sensor template your using telling home assistant you are home? Ive been so obsessed with having device tracker change and i dont think i even need that lol. I can just change my automations based on the status of that input boolean:/ i want the last 3 hours of my life back lol
No, I guess HA doesn’t really know that I am home. The template sensor doesn’t do anything for the map for instance. But since the HomeKit method has proven much more reliable in my case, I don’t think an actual device_tracker is really necessary. If you wanted one set up for location tracking, you could always set up the HA iOS app or Owntracks along side. Just know that they might not always be accurate.
Thanks again. I used owntracks for about a month with about 95% success. Just the past two weeks have been very bad. 50%. I was really over thinking it last night. I could care less about the map I just changed my automations that we’re using my phone to use the ib. Seems to be working good so far. A lot better than owntracks.
I guess the topic is a little bit misleading then (“Requires no Homekit-hardware!”)
Hi Mike, can you include the yaml code showing your group booleans please?
And just to confirm, I guess you aren’t using homebridge-cmdswitch2 plugin?
Hi Jarrah, Right, I am not using the home bridge-cmdswitch2 plugin at all.
Here is all my yaml code pertaining to the input booleans. I have a template sensor for each of use just to display pretty in the frontend. It is not necessary though.
input booleans and template sensors in configuration.yaml:
input_boolean:
mike_home:
name: Mike is Home
eliza_home:
name: Eliza is Home
sensor:
- platform: template
sensors:
mike_home_sensor:
friendly_name: 'Mike'
value_template: >
{% if is_state('input_boolean.mike_home', 'on') %}
home
{% else %}
not home
{% endif %}
eliza_home_sensor:
friendly_name: 'Eliza'
value_template: >
{% if is_state('input_boolean.eliza_home', 'on') %}
home
{% else %}
not home
{% endif %}
group in groups.yaml:
home_booleans:
name: Home Booleans
entities:
- input_boolean.mike_home
- input_boolean.eliza_home
example automation based on the group:
- alias: 'Arm Alarm when noone is home'
trigger:
- platform: state
entity_id: group.home_booleans
from: 'on'
to: 'off'
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.security
data:
code: !secret security_pin
Super, thank you very much!!!
I really like this solution, it makes complete sense and there’s no need to install the cmdswitch2 plugin, create any scripts or try to get curl working on Hass.io. Homebridge simply just passes the “input_boolean” as an accessory that HomeKit can turn on or off itself, which in turn flips the switch/boolean in Hass.io that can be picked up by an automation script.
I just wanted to clarify things for anyone else following this thread because it took me a couple of reads to understand why we don’t need to follow any of the instructions from the original poster.
And as a bonus, as I now have iOS 11 with an Apple TV 4th gen acting as the hub, I set up an Automation on HomeKit to switch the boolean accessory when the last person leaves and the first person arrives between my wife and I. So in effect there’s now no need to have the dual input boolean.
Thank you so much Mike for posting your solution - a much better and more elegant, reliable way for presence detection - something I’ve been after for a long time. iOS11 is the final solution we’ve been waiting for.
- You should be fine to run Homebridge on the same rPi3 without issue. I know many on Hassio are running the Homebridge add-on with success. I personally am running home bridge on a separate device, but on;y because that was what was convenient for me when i set it up initially
- There was an update to the iOS app a couple months ago, but I don’t know if the presence detection saw significant improvement. I still us the iOS presence detection for information purposes, but I still use the HomeKit method for my main solution
- The AppleTV is needed as a hub for Apple’s Home app, allowing for remote control of your home. Without an AppleTV (or an iPad), you can only control your home when you are on the local wifi. On it’s own, AppleTV won’t do anything for you for presence detection. According to some in the thread, if you want to use this method, an AppleTV or iPad is necessary, so the switch can be turned on and off when you arrive and leave home. I haven’t ever tried it without, since I already had an AppleTV.
I have been using this method (slight variation of using input_booleans instead of the cmd_switch) for presence detection for over 6 months now, and it is very reliable. I don’t know if I would call any method rock solid, but this has worked best for me. I’ve only had one instance of weird behavior with this, where both mine and my wife’s input_booleans were flipped on and off continuously while we were home. Seemed to be a temporary issue with the HomeKit zone. After we let the home zone and came back, it was resolved.
No worries, hopefully I can clarify. This method relies on Homebridge. So no matter what, you need Homebridge. What Homebridge does is allow the iOS Home App and Home Assistant to talk to each other. Without it, HomeKit and Home Assistant have no way to communicate.
The AppleTV is just a hub for HomeKit, it doesn’t do any sort of presence detection. All it does is allow the Home app on your iPhone to function when you are not connected to your local wifi. According to others in this thread, without the AppleTV, this method doesn’t work, because as soon as you are disconnected from the local wifi, HomeKit is unable to trigger the home/away automation. This is what I can’t confirm, but it makes sense to me.
So, to sum it up:
- You definitely need Homebridge
- You probably need an AppleTV
- or (I think) an iPad
I use an iPad mini of 2013 vintage - works just fine
Have you also installed the homebridge-homeassistant plugin, and configured it to connect to HA? If not, you’ll need to do that. (https://github.com/home-assistant/homebridge-homeassistant)
If you already have, you can post your homebridge config here (remove the sensitive bits) and we can see if there is anything missing.
I’m not sure if you are on Hassio or not. If you are, you might want to check one of the Homebridge Hassio add on posts to see how to get it up and running. I’m not on Hassio, so I’m not sure of the details.
Hi!
I’ve also used this method for quite some time, with and without scripts and stuff and it was always very reliable. Since iOS 11 I only use Boolean and they’ve never missed.
Suddenly it doesn’t work and rereading a bunch of stuff I found this. Did you ever found out what happened when your switches were flipping in Homekit location to trigger automations in Home-assistant, using a software switch. Requires no Homekit-hardware!? I’m guessing it’s the same issue I have Suddenly erratic Homebridge "device tracker" but it doesn’t seem to stop.
Any ideas?
/Johan
I never figured out what was going on with the booleans flipping back and forth. It only happened the one time,and as soon as my wife and i left the home zone, it resolved itself. I suspect it was a glitch with the HomeKit geofencing, repeatedly triggering the HomeKit automation to flip the boolean.
I did have another issue with HomeKit, where my AppleTV hub would not show as connected on my wife’s phone, making her automations not work. That was eventually resolved, but not sure what did it. I recreated my home configuration several times, but also had an iOS update during that time.
Thanks. Yeah, someone waived the magic wand I guess… All good again!
Anyone have suggestions on how to use this method of presence detection with some sort of extended away? Obviously, automations that run when everyone is away will work fine but automation that run when everyone is home will no longer work.
Thanks in advance.