HomeKit integration questions

Hi all,

Context

I am sorry if this is a silly or repeated question, I’ve made a few searches but couldn’t really figure my head around this.
So to give a little insight, I was using the HomeBridge integration for HomeKit but I’ve become a little fed up with plugins that don’t work and a very slow response (and most times insufficient) from the community.
Some example of things that didn’t work there, my Panasonic Viera TV, couldn’t even add it, Home Assistant was a zero effort config, Broadlink RM4 Pro there didn’t give me temperature and humidity information, here is always up to date, and so on.

At the same time I’ve recently started discovering Home Assistant, I was very positively surprised by seeing that adding all these devices was a simple and zero effort task, everything works well, just wasn’t connected to the HomeKit, instead been using the Home Assistant app on iOS. So I had sort of the systems in parallel. Now, I’m shutting down HomeBridge and would like to make everything work via Home Assistant.

Configuration steps

I removed the bridge of homebridge and all sub-bridges and all devices were removed from HomeKit this way.
Next I went to Home Assistant, added a HomeKit Bridge, and selected:

HomeKit Mode: bridge
Inclusion Mode: include
Domains to include:

  • Alarm Control Panel, Binary Sensor, Climate, Cover, Fan, Humidifier, Light, Lock, Remote, Sensor, Switch, Vacuum;

Entities to be included: I’ve selected SOLELY:

  • RM4 Pro Humidity (sensor.broadlink_rm4_pro_humidity);
  • RM4 Pro Temperature (sensor.broadlink_rm4_pro_temperature);
  • iRobot (vacuum.irobot);
  • iRobot Bin Full (binary_sensor.irobot_bin_full);
  • iRobot Battery Level (sensor.irobot_battery_level);
  • Smoke detectores (several - binary_sensor.smoke_detector_X sensor.smoke_detector_X_battery and sensor.smoke_detector_X_smoke_amount);

Advanced Configuration - Device (Triggers):

  • I have selected NONE.

My objective on this first stage lets call it that, is to ONLY ADD these to my HomeKit / Home App: sensors and the iRobot.

Results

So I was expecting to get the sensor information from the sensors of RM4 Pro, the iRobot vacuum state (working, stopped, bin, battery); and from the smoke sensors. This is like the first step starting with easy stuff that was working well with Homebridge PLUS the temperature and humidity sensors from the Broadlink device.

When I scanned the bridge QR code, it added:

  • An Airport Express that is on the network, completely useless add);
  • The Bedroom Apple TV (its an Apple TV 3);
  • My 4K Apple TV which is already on Home;
  • The iRobot;
  • The Panasonic TV;
  • Broadlink RM4 Pro REMOTE (beside the sensors)

All of these show as “No response” on the Home App.
I have “8 Accessories No Response”.

I didn’t ask or selected the broadlink remote - only the sensors, I didn’t select the Panasonic TV, I didn’t select any Apple TV’s. So, why is this throwing me all these bunch of stuff I never selected to appear?

The smoke alarms don’t show. The Broadlink RM4 Pro temperature and humidity show as “no response” as well.

Any hints appreciated, thank you!

EDITS: text styling and some corrections

Follow up question;

I was reading here: HomeKit - Home Assistant

But my configuration.yaml only has this:

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Looking for the configuration entries for HomeKit, I’ve come across these:

.storage/core.config_entries:177:        "domain": "homekit_controller",
.storage/core.config_entries:462:        "domain": "homekit",
.storage/core.device_registry:552:            "homekit",
.storage/core.device_registry:554:            "homekit.bridge"
.storage/core.device_registry:558:        "model": "HomeKit Bridge",
.storage/core.device_registry:705:            "homekit",
.storage/core.device_registry:707:            "homekit.bridge"

file core.device_entries and core.device_registry.

Which is the correct place for the mentioned configuration?

Ok guys this is a wonderful monologue and I’ve been loving the community support. Feeling really welcome, specially after the conversation with @discobot.

In the meanwhile I’ve added a manual config to configuration.yaml just like the suggested HomeKit snippet, now whenever Home Assistant starts I have the HomeKit entry from configuration.yaml but each time I restart I get two HomeKit bridges, one in the port I chose on the config file, and some default 21063 port which I can’t get rid of.

Also, when I look into core.config_entries I see that the filters, domains and entities I’ve selected on the YAML config, are not under the port I selected, but rather on that configuration with the port 21063. What gives?

Setup failed for homekit: Invalid config.
23:31:51 – (ERROR) setup.py
Invalid config for [homekit]: contains duplicate items: [21063] for dictionary value @ data['homekit']. Got [OrderedDict([('filter', OrderedDict([('include_domains', ['alarm_control_panel', 'climate', 'fan', 'humidifier', 'light', 'lock', 'remote', 'switch', 'vacuum']), ('include_entity_globs', ['binary_sensor.smoke_detector_*', 'sensor.*_battery', 'sensor.broadlink_rm4_pro*']), ('include_entities', ['vacuum.iaspiras', 'sensor.iaspiras_battery_level', 'binary_sensor.iaspiras_bin_full']), ('exclude_entity_globs', ['binary_sensor.iphone_*', 'binary_sensor.pfsense_*', 'sensor.canon_*', 'sensor.iphone_.... (See /config/configuration.yaml, line 20). Please check the docs at https://www.home-assistant.io/integrations/homekit
23:31:51 – (ERROR) config.py

I tried commenting the port on YAML, and I get this error.

Hi! To find out what I can do, say @discobot display help.

There’s a lot to digest here. I would start fresh by removing your yaml and non-yaml bridges to see if you can get rid of that error. Then create a new bridge, starting simple with one device. Also, just my personal preference - I don’t like to include entire domains. You’ll start getting all sorts of random crap that you don’t want in HomeKit. I also prefer yaml over the gui. To me, it’s a little easier and cleaner to add exactly what you want.

I saw in your config sample that you’re using includes. I have my homekit integrations all in yaml, and use an include:

homekit: !include homekit.yaml

Then in that file I have several bridges, broken down into categories. The port is required, I believe. I just kind of pick random numbers in the 50000 range. Each bridge needs its own port number. Here are some examples from my homekit.yaml file:

- name: Security
  port: 5XXXX
  filter:
    include_entities:
      # Alarm
      - alarm_control_panel.alarm
      - binary_sensor.front_door
      - binary_sensor.back_door
      - binary_sensor.kitchen_door
      - binary_sensor.kitchen_window
      - binary_sensor.living_room_window
      - binary_sensor.master_bedroom_window

- name: Lights
  port: 5YYYY
  filter:
    include_entities:
      # Upstairs 
      - light.loft_lights
      - light.loft_stairway_light
      - light.loft_ceiling_fan_light
      
      # Downstairs
      - light.kitchen_lights
      - light.kitchen_table_lights
      - light.group_kitchen_sink_lights
      - light.group_family_room_lights
      - light.family_room_tv_lights
      - light.family_room_ceiling_fan_light

Start with something simple and see if you’re able to get anything working. Also, you’re going to find the roomba integration is a little disappointing in HomeKit. I think you basically just get switches. It took a lonnnnng time, but I ended up creating HA scripts for each of my rooms and then pushed each of those into HomeKit. Scripts are rendered as switches in HomeKit. So now I can tell Siri “Clean the kitchen” and it will execute that script and start vacuuming. I wish my wife was as compliant…

1 Like

Hi @_Mike thanks a lot for your reply!!

Ok so, about “removing your YAML and non-YAML bridge”
I restarted HA, went to the devices and deleted the HomeKit bridges that showed there.
Then I went to /config/.storage/core.config_entries and removed all entries regarding HomeKit bridges. Then rebooted.
When it comes up it automatically adds a HomeKit bridge, that with the 21063 port. I have no idea how to remove that bridge or why it keeps showing each time I restart, but it just does.

Currently my Home Assistant install is the VirtualBox image from here:

I’ve been considering doing a new install using this method instead, should it be better? Or it’s not really worth it?

I see that the Home Assistant image has “Home Assistant Supervised” and the manual install has a warning saying:

This way of running Home Assistant will require the most of you. It also has strict requirements you need to follow.
Unless you really need this installation type, you should install Home Assistant OS (this can also be a virtual machine), or Home Assistant Container.

I’m seeing that this is only compatible with debian but I only do the el rpm fam, so I’m wondering, do you guys use HA with this supervised component, or not really? Cause I’ve also been wondering if this supervised component is what keeps creating that extra HomeKit bridge.

About the HomeKit ports you mentioned on your example, that does seem like a neat way of keeping things organised, but then what happens? Do you get a bridge for each port, and add all those bridges?

Thank you!

So 21063 is the default homekit port. My guess is that you still have homekit: in your config, even if you have removed the details from it. If you remove that, I bet your bridge goes away. You really shouldn’t have to dig into the core config files. They should clean themselves up.

The only installation method I am really familiar with is the one I use - Docker container running on a Synology NAS.

Yep. You get a bridge for each port. You would add each one separately in your Home app. This is not something you HAVE to do; I just like it as a way of organization. There is HomeKit limit of (I think) 150 devices per bridge so if you get to that many devices you would in fact have to split them into multiple bridges.
image

Once again @_Mike I really appreciate your feedback!

Ok so regarding the install option, I used the full image provided as I figured it would be … “superior”, as its a full install? but then I come in the forums and I see command suggestions starting with “hass-cli”, which does not exist here:

[core-ssh ~]$ ls -la /usr/bin/ha* /usr/sbin/ha*
ls: /usr/sbin/ha*: No such file or directory
-rwxr-xr-x    1 root     root       9195520 Aug 29 17:57 /usr/bin/ha
-rwxr-xr-x    1 root     root           112 Aug 29 17:55 /usr/bin/hassio

and hassio commands are different from hass-cli, for example i was trying this command found on the forums to list domains:

[core-ssh ~]$ hassio --no-header service list | grep notify
The 'hassio' command is deprecated, please use 'ha' instead!
Error: unknown command "list" for "ha"

Did you mean this?
	host

Run 'ha --help' for usage.
FATA[0000] Error while executing rootCmd: unknown command "list" for "ha"

Did you mean this?
	host 
[core-ssh ~]$ ha --no-header service list | grep notify
Error: unknown command "list" for "ha"

Did you mean this?
	host

Run 'ha --help' for usage.
FATA[0000] Error while executing rootCmd: unknown command "list" for "ha"

Did you mean this?
	host 

so looking through solutions from the forums here and trying to apply them on my system, which is the full fledged machine with supervised from the image provided by home assistant, feels like a waste of time. it’s like no one is using it…

anyway, I have homekit:in my config, but only the entry I added on the YAML. so by creating this one entry, it will create two bridges? trying to understand the logic here, and basing off your comment "you still have homekit: on your config, so this snippet here: HomeKit - Home Assistant
Does provoke that double bridge creation, the first bridge spun from the initial HomeKit reference, and the second from the bridge declared in the end. Why is that Bridge declared on that given example?

Anyway, I still didn’t do any changes to it today as I was working, but I’ll take a look into it now, using the homekit.yaml method you suggested.

About the sub-bridges, I do like that organization system, and I’m ok with using several bridges, on homebridge it was recommended for better performance and stability, so its perfect!

EDIT: If I remove one bridge that had been added previously from the Home app, how do I access its QR code again on Home Assistant? Thanks!

Ok so this is my config now, using the homekit: !include homekit.yaml method:

- name: Living Room
  port: 71080
  filter:
    include_entity_globs:
      - sensor.broadlink_rm4_pro_*
    include_entities:
      - remote.broadlink_rm4_pro_remote
  entity_config:
    sensor.broadlink_rm4_pro_humidity:
      name: RM4 Pro S1
    sensor.broadlink_rm4_pro_temperature:
      name: RM4 Pro S1
- name: Smoke Sensors
  port: 71081
  filter:
    include_entity_globs:
      - binary_sensor.smoke_detector_*
      - sensor.smoke_detector_*_battery
  entity_config:
    binary_sensor.smoke_detector_s1:
      name: Smoke Detector S1
      linked_battery_sensor: sensor.smoke_detector_s1_battery
      low_battery_threshold: 15
    binary_sensor.smoke_detector_c:
      name: Smoke Detector C
      linked_battery_sensor: sensor.smoke_detector_c_battery
      low_battery_threshold: 15
    binary_sensor.smoke_detector_e:
      name: Smoke Detector E
      linked_battery_sensor: sensor.smoke_detector_e_battery
      low_battery_threshold: 15
    binary_sensor.smoke_detector_ar:
      name: Smoke Detector AR
      linked_battery_sensor: sensor.smoke_detector_ar_battery
      low_battery_threshold: 15
- name: Vacuum
  port: 71082
  filter:
    include_entities:
      - vacuum.irobot
      - sensor.irobot_battery_level
      - binary_sensor.irobot_bin_full
  entity_config:
    vacuum.irobot:
      name: iRobot
      linked_battery_sensor: sensor.irobot_battery_level
      #linked_occupancy_sensor: binary_sensor.irobot_bin_full
    binary_sensor.irobot_bin_full:
      name: iRobot Bin

Seems like it’s all great, only added what was supposed to, now I just have to figure out why all devices show as No response at the Home App…
Many many thanks for your suggestions and your help with this!

I’m glad it is (sort of) working! So you’re saying ALL of your devices are showing as No Response? Questions:

  • Are you using HomeKit with any other devices that are natively HomeKit compatible? Are they working?
  • Is your Apple TV configured as an active HomeKit hub?

All of my devices are showing as no response. The iRobot and smoke sensors integration was working perfectly using homebridge tho, but that’s gone anyway :stuck_out_tongue:

So yes I have an Apple TV 4K which is also HomeKit hub. The Apple TV works well does all its supposed to.

It sounds like it should work. I don’t know a ton about networking, but your port #s of 71000+ seem high. Could you have gone outside of the allotted range? That might be a stupid question; I just don’t know. What if you try using the default 21063 port for one of your bridges? Does it work then?

heh actually those are not my ports, they’re in the 3XXXX i just replaced them for obfuscation.
the maximum port number is 65535

anyway, i have a pfSense router with the Avahi daemon. I even added a rule to allow all to all on the interface where home assistant and the IoT devices are. It really should be working I believe. (I already tried rebooting the router as suggested on another thread, but did nothing.

At least with homebridge, this part worked well. It created the bridges, added the devices, zero effort. I didn’t change network configurations.
My issue with hb was plugin compability, like the TV plugin sucked, the broadlink plugin sucked, etc. Apart from that, as you added the bridge and things were there, they worked.

I thought I was onto something! Well, I think we have reached the end of my ability to help. I wish you luck, though. Please let me know if/when you figure it out!

1 Like

Thanks a lot @_Mike you were indeed super helpful. I’ll probably open another thread on that issue.
Have a great one!

1 Like

Howdy @_Mike hope I’m not bothering but actually wanted to share a closure to the follow-up issue from this thread - the “No response” on HomeKit;

So we got this sorted 3 days ago and only had the Home app issue left. These past days I was up to my head in work so I didn’t really pay any attention to the integration, except yesterday morning while was having a cup of coffee opened the app and everything was there:
sensors, sensors informations, the vacuum, bin status, batteries, everything.

So I got like “w0000t” and started checking my router’s options.
One of the options I had disabled looking around in the forums was to disable the IPv6 support in Avahi.
Well, I did it for the sake of testing but I have IPv6 and would like Ahavi to actually function in both stacks not only IPv4. So started looking into that and trying to understand why wasn’t it working.

(almost forgetting to mention my router/firewall is a pfSense)
So in the meanwhile I found this very interesting thread at the Netgate Forums about an IPv6 bug with Avahi.

So, while having IPv6 support enable on Avahi, I ended up adding a floating rule (quick action) for the interfaces where mDNS should be reflected allowing network fe80::/10 to single host ff02:fb UDP port 5353.
I also ended up adding a rule immediately below from the same source and same destination but ANY traffic instead of UDP 5353 because of MLD (multicast listener discovery) as honestly it’s described to be an IGMP v2/v3 or sorts and I’m really not full in how it works (nor have the time to read technical docs about it now), but since that’s not an option on the protocol macros I just wanted to be sure if something would be broken without that rule, so made it and been monitoring state creation. (so far none created).

These last configs were done last night actually and today morning it didn’t seem to be working yet, as I still had the no response on the Home.app.
Now I don’t know if it was a coincidence or not (and honestly I’m with little time to dwell on the specifics, it’s working and I hope this suggestions may help someone else in the future) the only other thing that got altered on the network this morning was a windows machine (the only of its kind on the network) that my wife got for wfh to access some xpto internal app, now I had it on the IoT devices network, but then made a special guest network that will serve that machine and any guest that comes to my place instead of connecting to the regular network, but as soon as that machine was out of the other networks the Home app started working. Again, I say, it may be a coincidence, but the timing was just right.

As I see the local link to ff02:fb creating states and working, I’m inclined that that may have been the fix. I’m just questioning why the immense delay. But bottom line is, it’s working.

1 Like

I’ll be honest. A lot of that was above my understanding of networking. BUT - I’m glad you got it to work!! :slight_smile: