Homekit/iPhone Multi-user Presence Detection Using Homebridge

Why do you created the HB user in /lib ?
sudo mkdir /var/lib/homebridge
and not in /home
sudo mkdir /home/homebridge

Homeassistant setup put its user in /home for example…
/home/homeassistant

A couple of corrections to these otherwise excellent instructions when not using hass.io:

  1. The JSON for config.json is invalid as # is not a comment in JSON, suggest
     {
     	"_comment": "you should edit username and pin",
     	"bridge": {
     		"name": "Home Assistant",
     		"username": "B8:27:EB:BE:E6:52",
     		"port": 51826,
     		"pin": "xxx-xx-xxx"
     	},
     	"description": "Homebridge for Home Assistant",
     	"accessories": [],
     	"platforms": [{
     		"platform": "HomeAssistant",
     		"name": "HomeAssistant",
     		"host": "http://192.168.0.5:8123",
     		"password": "myHApass",
     		"default_visibility": "visible",
     		"supported_types": [
     			"input_boolean",
     			"switch"
     		],
     		"logging": true
     	}]
     }
  1. sudo chown homebridge: homebridge /var/lib/homebridge/config.json has an erroneous space, should be homebridge:homebridge.

Could you suggest an approach for counting the number of people at home in hass via HomeKit events?

Good day all,

I am interested in moving over to the Home Assistant native setup. I would first like to undo everything I did to get things setup in HomeKit so as to not have any conflicts. It’s been so long I forgot and the github page just shows deprecated. Greatly appreciate any help.

I realize the instructions are listed above, just not sure what to undo and not undo.

Thanks

I think all you need to do is disable home bridge from starting up at boot, so try running the following commands:

sudo systemctl stop homebridge
sudo systemctl disable homebridge

I would also remove the HomeAssistant accessory from the HomeKit app so that you can add a new one once you’ve set up the integrated version of homekit.

I too am now using the integrated HomeKit native setup and it still works great with multi-user presence detection. In case it helps, these are the only yaml entries I need to make it work:

homekit:
  auto_start: False
  filter:
    include_entities:
      - input_boolean.wearehome

automation:
  - alias: 'Start HomeKit'
    trigger:
      - platform: homeassistant
        event: start
    action:
      - delay: 00:01
      - service: homekit.start

The PIN for adding this as a new accessory should appear as a card in HomeAssistant, but if not it should be in the logs.

P.S. Unfortunately I can’t edit the first post anymore to remove the old homebridge instructions

1 Like

@jarrah why do you have the automation to start the home kit ? Do I need to set autostart to false and then use an automation or was there another reason ?

The reason is because if not all entities are loaded in HA before Homekit starts they won’t be loaded in Homekit (and it will remove the settings in Homekit for those entities).

E.g. say we have an entity, named light.zwave. This light is in the kitchen in Homekit and is assigned to a specific scene or automation. Now if Homekit starts before light.zwave is loaded it will not show in Homekit. But not only that, the next time you start Homekit in HA with the entity loaded it will be like it is a new device and will set it back to the default room and all automations/scenes associated with this entity will be removed (in Homekit ofc not in HA itself).

Delaying Homekit will give HA the time to load all domains and their associated entities before Homekit starts.