QR Code missing for HomeKit integration

Hi,

I tried to install the HomeKit integration from this tutorial: https://www.openhab.org/addons/integrations/homekit/ an found that the QR Code was missing in Safari and Chrome. I followed this suggestion: https://community.openhab.org/t/qr-code-not-shown-in-homekit-config-in-oh3/114864/13 and installed the version 3.1.0.202106230532 of HomeKit AddOn but still can’t see the QR code. The system is the latest stable 3.1. installed with the openhabian flash.
Any suggestions?
Thanks for your help.

Can we get more information, like OS version and safari version. if your OS is older then 10.13.6 its possible the version of safari is just to old to work well anymore.

Some quick solutions that might work:

  1. Make sure Safari software is updated as far as possible (Use Software update to check for Safari updates).
  2. Goto Safari (in menu bar) → Preferences → Privacy, Click on “Manage Website Data” Button and then wait for the list to load (it can be slow) and click the “Remove All” Button.
  3. Goto Safari (in menu bar) → Preferences → Advanced then make sure the checkbox for “Show Develop menu in menu bar” is on. then Choose Develop (again in menu bar at top) and select Empty Cache
  4. Quit Safari, Start Safari and try again.
  5. Reboot computer into safemode (Hold shift when booting up for off). This will clear some systems caches.

If problem still persists and OS/Version is good. try:

Use Fontbook Software in Applications folder to verify fonts.

  1. Open Fontbook
  2. Select all font on the left
  3. Select all font in the list
  4. Choose “Validate Font” option in File menu bar item.
  5. Remove any Red Fonts, Reboot and try again.

These steps typically resolve most local web browser related issues that may cause all types of weird problems. If the problem persists I usually find the issue is aged software that simply don’t know how to read the new websites.

I currently use Safari and have no issues with the QR-Code. I have systems running 10.13.6, 10.15. and 11.5.1 with the most recent versions of safari I they can run.

I have the BigSur (11.4) with Safari (Version 14.1.1 (16611.2.7.1.4)) and Chrome (Version 92.0.4515.107 (Official Build) (x86_64)). I also tried the solutions you mentioned and I also don’t have any red fonts. I also tried to turn off the package filter but it didn’t work.
Any other idea what could cause it?

can you share the screenshot of the page without the QR code? do you have PIN there?

Well it seems your up to date and the steps i proposed before did not resolve the issue, My next steps require some more diagnostics but should point towards the root of the problem.

Lets figure out if the server has problems or If the computer your attempting to view the QR Code is:

For a test:

  • Does this issue happen on multiple systems? Have you tried to load the QR Code from a different system entirely? even Safari on an iPhone should work, or another computer all together.

I recommend Backing up before trying anything below Possibly Both Hab Server and System you are trying to get the QR Code to load on depending on the path you follow below (and of course assuming their is 2 separate computers, the Server for OpenHab and the computer your viewing OpenHab UI with).

If QR Codes do not load on other systems (Unsuccessful)

OpenHab itself has an issue most likely.

Here are the steps I would take from least destructive to most destructive in an attempt to fix this.

  • To log into the OSGI Console issue this command from the terminal in MacOS
    ssh -p8101 openhab@localhost
    (Password is habopen ) by default.
  • You should, after a bit be shown a ASCII graphic and given another prompt.
  • When I say to issue the command in OSGI this is where I am referring to.
  1. Quick Test
  • This is an older trick, not sure its still useful in OH3, but a while back I did have an issue getting OH added as a Hub in Home Kit, problem is not identical but may still play a role in you’re QR code problem, issuing the command below via OSGI and rebooting OH might be worth a try as a non destructive attempt.
    smarthome:homekit allowUnauthenticated true
  1. Enable a more detailed debugging log
  • Inside OSGI issue command
    log:set TRACE org.openhab.io.homekit.internal
  • Then I would shutdown openhab, with command in OSGI system:shutdown.
  • Then back in the MacOS Terminal find the openhab.log file and issue the command
    tail -f /pathToOpenhab.log
    This will cause the terminal to update the screen when new log files are added but will keep that terminal window occupied until closed. So just leave it up and watch the log files as it roll in
T.M.I
  • I use this technique frequently to help find issues I would normally miss, I use it for non Homekit issues too
  • Makes my OpenHab more stable at the same time :slight_smile:
  • Then open another terminal window to MacOS if you’ve not already and start Openhab
    ./start.sh
    in OH application folder via MacOS terminal.
  • Then watch the logs for entries from homekit.internal you may possibly have to load the settings page where the QR Code should be before a possible clue might show up in the logs.
  • If you find an issue with the QR code score we got a lead and nothing really destructive has to happen.
  • I would set the log level back to ERROR when done to reduce log file spam.
  1. Reset Pairings
  • In OSGI issue command
    smarthome:homekit clearPairings
  • This will force OpenHab to clear its settings for HomeKit (this will cause the Homekit Add-on to need to be re-added as a Hub in Home App).
  • A reboot of openhab is recommended after this (OSGI system:shutdown)
Why perform Steps 2 and 3 together rather then sequentialy
  • Saves the time to shutdown & reboot a 2nd time
  • Performing steps 2 and 3 would be close to a full uninstall/reinstall of the Homekit Binding, Additionally removing the cache files would be part of a “Full Uninstall”, I would just avoid clearing the caches unless steps 2 and 3 failed. just to save some headaches.
  1. Uninstall the Homekit Add-on via the OH3 UI
  • I have found most of the meaty data that is used for connections and ID and stuff is located in the
    “openHAB application”/userdata/jsondb/homekit.json
    file and I suspect removing that file and any manually installed Homekit.jar files in the Addon folder after uninstalling the current homekit binding may be enough.
  • Manual removal of files should be done with OpenHab shutdown (OSGI system:shutdown).
  • Im am pretty sure that the QR Code is generated from data in that .json file. At this point I would start OpenHab and reinstall the Homekit Binding via the UI in openhab3 then test again as the next step will sometime affect parts of the OpenHab System that are not related to HomeKit.
  1. Clear Opehab cache files
  • I find there to be quite a few issues that need to resolve after I resort to this option.
  • Here is a good thread on how to Clear the cache files for OpenHab:
    Clear the Cache
  1. Last Restort
  • At this point I would refer to any additional suggestions that @yfre might have and from there, Nuke your OpenHab install and start fresh cringe as a last resort.
If QR Codes do load on other systems (Successful)
  1. The first thing I would try would be to make sure I am not using a VPN or any sort of software firewall,
  2. Then I would make sure my system is free of Malware, Malwarebytes MacOS download: Malwarebytes is a good free to (check/remove known malware) software.
More on Malwarebytes
  • I have been using it for a some years now. Been selling it to my customers. - Paid Version will actively scan for Malware not just cleanup after the fact.
  • Thus far have no reasons to believe they are not trustworthy.
  • I have seen some malware that will affect networking settings (Enable SOCKS proxies etc).
  1. Check the System Preferences for a Pane Called Profiles (is only visible if a profile is installed so it may not be seen), look in it, if you see anything you don’t recognize in the list remove it.

  2. I would also check and make sure I have no 3rd party extensions for Safari or Chrome installed.

  3. Sometimes creating a new location inside System Preference Network Pane and then clicking the apply button will fix random issues related to network (not to much of an issue if you use DHCP, if not your probably savvy enough to recreate the desired settings manually).

  4. If the issue still persists: You can try to create another user in the “Users & Groups” System Preference Pane. Logout of the current user and login with the new user. Once again attempt to load the QR code, if it works then you have an issue someone in the user settings of the previous user.

  5. If the problem still persists: Then the problem is deeper in the MacOS system, and the next step is to update to latest version of MacOS 11.5.1 (just use software updater in system preferences).

  6. If problem still persists then reinstall MacOS overtop itself (Reboot computer hold command+r key on keyboard (assuming Intel based Mac).

  7. Still persisting then the next step is to wipe the drive out (or better solution would be to start fresh on an external hard drive as described at the end of this post), I would reformat at the same time and reinstall MacOS with a clean version.

  8. If the problem still persists, we where wrong and MacOS was not the problem and we can rule it out 100%, at the expense of some time to rebuild OpenHab.

Worst Case scenario this article explains how to add OpenHab as a HomeKit Accessory without using the QR Code. How to Add HomeKit Accessory Without QR Code by using the PIN instead of the QR Code.

If you do end up getting to the solutions that are majorly destructive, I would encourage you to get an external HD that can be erased at will, and use that for your boot drive to rebuild the your hab server or system software so that you can keep the original unmodified (mostly) just incase. Hard Drives are pretty cheap these days and IMHO well worth the saved time. In order to reinstall MacOS and or OpenHab should easily fit onto any HD larger then 64Gigs (Probably less but I like to play it safe).

Note If you are able to successfully get HomeKit connected and setup, I would Highly recommend Backing up a copy of that homekit.json file. I believe there is an issue that can make your HomeKit Add-on disconnect from Apple’s HomeKit App. Usually the hub (Homekit Add-on) goes offline and all the items attached to it are unresponsive. If that happens, and I’ve seen a lot of posts that complain about it (I was suffering from it myself at one point) the solution is to shutdown Openhab and replace that homekit.json file with a copy of the one you backed up. Doing that would bring the Homekit Add-on back into sync with Apple and everything would keep working after that point without a need to remove and re-include. I think it would be wise to create a new Backup of the .json file if new Hubs for homekit arrive (IE, a new HomePod comes in, or AppleTV, or any of the devices that Apple uses as the LocalHub for Homekit), I personally have not see this as an issue, but I am also not sure I have added any new Apple Hub devices recently.

Hi Mike,

thanks for the very detailed description. With this I was able to solve it.
The problem was, and I realised it by typing smarthome:homekit allowUnauthenticated true in the OSGI which resulted in a not found error, that the SmartHome integration was not properly installed (Although I installed it through the GUI…). So I uninstalled the HomeKit and reinstalled it again. And now the QR Code shows up :slight_smile:

Now I only have to learn how to set up the meta, but that is a different story.

1 Like

Good to hear! Im glad the solution was one of the non-descructive steps near the beginning.

Im not the creator of this add-on but I have been able to get a few of my smart items properly connected to HomeKit via this add-on if you do end up needing tips. So far I have integrated my Rachio Sprinkler, Nest Thermostats, My GD004-Z Garage Door Opener, Working on my whole House Fan now, obviously Switches, Lights and the previously supported item types.

1 Like

Mike, if you have a link to a documentation how to set up the metadata would be great.
Thanks a lot for your help.

There isn’t a really good source that I’ve found that just lays it out there in a simple manner. Probably the most concise is in the Bindings official documents @ HomeKit Add-on Honestly watching the log file is probably the best teacher.

Here is a copy/paste replica of Apple's official developer documentation listing the supported items in homeKit.(as of July 30, 2021)

Accessory Service Types

The service types supported by HomeKit.

Framework

  • HomeKit

On This Page

Overview

An HMService instance’s read-only serviceType property contains one of the values listed below to tell you what the service does.

Don’t confuse these values with the accessory categories found in Accessory Category Types. Despite the similarities, they describe different things. Accessories are the physical objects that the user installs in the home, like a garage door opener. Accessories belong to a particular category, like HMAccessoryCategoryTypeGarageDoorOpener.

Accessories have one or more services that perform tasks. The garage door opener accessory has a garage door opener service with service type HMServiceTypeGarageDoorOpener, given below. The same accessory might also have an attached light providing a light bulb service with service type HMServiceTypeLightbulb, also given below.

Topics

Light

let HMServiceTypeLightbulb: String

A light bulb service.

let HMServiceTypeLightSensor: String

A light sensor service.

Power and Switches

let HMServiceTypeSwitch: String

A switch service.

let HMServiceTypeBattery: String

A battery service.

let HMServiceTypeOutlet: String

An outlet service.

let HMServiceTypeStatefulProgrammableSwitch: String

A stateful programmable switch service.

let HMServiceTypeStatelessProgrammableSwitch: String

A stateless programmable switch service.

Air Quality and Smoke Detection

let HMServiceTypeAirPurifier: String

An air purifier service.

let HMServiceTypeAirQualitySensor: String

An air quality sensor service.

let HMServiceTypeCarbonDioxideSensor: String

A carbon dioxide sensor service.

let HMServiceTypeCarbonMonoxideSensor: String

A carbon monoxide sensor service.

let HMServiceTypeSmokeSensor: String

A smoke sensor service.

Temperature and Humidity

let HMServiceTypeHeaterCooler: String

A heater or cooler service.

let HMServiceTypeTemperatureSensor: String

A temperature sensor service.

let HMServiceTypeThermostat: String

A thermostat service.

let HMServiceTypeFan: String

A fan service.

let HMServiceTypeFilterMaintenance: String

A filter maintenance service.

let HMServiceTypeHumidifierDehumidifier: String

A humidifier or dehumidifier service.

let HMServiceTypeHumiditySensor: String

A humidity sensor service.

let HMServiceTypeVentilationFan: String

A ventilation fan service.

Windows

let HMServiceTypeWindow: String

A window service.

let HMServiceTypeWindowCovering: String

A window covering service.

let HMServiceTypeSlats: String

A slats service.

Water

let HMServiceTypeFaucet: String

A faucet service.

let HMServiceTypeValve: String

A valve service.

let HMServiceTypeIrrigationSystem: String

An irrigation system service.

let HMServiceTypeLeakSensor: String

A leak sensor service.

Locks and Openers

let HMServiceTypeDoor: String

A door service.

let HMServiceTypeDoorbell: String

A doorbell service.

let HMServiceTypeGarageDoorOpener: String

A garage door opener service.

let HMServiceTypeLockManagement: String

A lock management service.

let HMServiceTypeLockMechanism: String

A lock mechanism service.

Saftey and Security

let HMServiceTypeMotionSensor: String

A motion sensor service.

let HMServiceTypeOccupancySensor: String

An occupancy sensor service.

let HMServiceTypeSecuritySystem: String

A security system service.

let HMServiceTypeContactSensor: String

A contact sensor service.

Video and Audio

let HMServiceTypeCameraControl: String

A camera control service.

let HMServiceTypeCameraRTPStreamManagement: String

A stream management service.

let HMServiceTypeMicrophone: String

A microphone service.

let HMServiceTypeSpeaker: String

An audio speaker service.

Information

let HMServiceTypeLabel: String

A label namespace service used when an accessory supports multiple services of the same type.

let HMServiceTypeAccessoryInformation: String

An accessory information service.

See Also

Getting the Service Type

var serviceType: String

The type of the service.

var localizedDescription: String

The localized description of the service.

My Technique

  1. In Terminal find the openhab.log file and issue the command
    tail -f /pathToOpenhab.log
    My Specific command is
    tail -f ~/openhab/userdata/logs/openhab.log
    This will cause the terminal to update the screen when new log files are added but will keep that terminal window occupied until closed. So just leave it up and watch the log entries roll in.
  2. I have figured out (from watching the log) any time I make a change to an item with Homekit metadata the binding republishes all the items with Homekit metadata, at that point all the errors that are preventing your items from being properly configured in HomeKit should appear in the log file.
  3. Fix the errors that show up in the log for your Homekit items and then you know that at least those items are configured in such a way that they will work. At least with the options you’ve added to Homekit Metadata for. If a Device such as a Thermostat is missing a required datapoint it will show in the log, but if you meet the requirements for a Thermostat, that doesn’t necessarily mean all the possible datapoint are filled… just the required ones to make the item work.

I have noticed there appears to be a hierarchy for Homekit Metadata. For example, I made a group of items that represent the thermostat. Set point, Mode, etc … I added Homekit Metadata to the group for a thermostat type item. Then the Set point inside the group I set the metadata on Homekit and since the set point was within the thermostat group ( I did not have to set the metadata as both thermostat and thermostat set point on the same item, the requirement for having a set point for the thermostat is meet (just an example there are more points that are required for a thermostat). I could make the item both a Thermostat, and Thermostat Set Point (ignoring the group’s Metadata for Homekit) in the MetaData and it will not show errors in the log, but I feel this is improper and i am trying to stick to 1 HomeKit metadata entry per item if at all possible. I am still trying to figure the hierarchy out completely, as I am just going by feel and haven’t looked for any official information on it. I believe U can also add multiple datapoints to an item.

To add Homekit Metadata when looking at an item in the OH UI there is a blue “Add Metadata” button if you select that it will show options for all the Metadata choices. If you want more then 1 Metadata point per Item you need to check the checkbox for multiple, otherwise it will only let you select 1 Datapoint per item.

So to summerize, Use the log with a DEBUG or TRACE Level set for homekit to fix errors in your metadata, and use Apple Developer data to try to find used data points that are not required but may make using them easier. Example would be a garage door opener requires a opener but optionally has a light built in too. So the Opener would work after getting the opener metadata added, and will not work without it, but you can’t control the light for the door, unless it too gets metadata for Homekit added to it.

Hi - after a while, I was trying to install Homekit again. I was positively surprised to see the QR-Code is now shown without any further installation steps (I am on OH3 Main and just updated befor). However, when trying to scan the QR code, and after accepting the first message saying OH is not a certified system, I only get an error message that the device can not be added because of incompatibility.

Any suggestions?

do you have device with colour temperature? or try first with one simple device, like simple light, and add other after the pairing

seems I was not precise enough: the error occurs when adding OpenHAB as device to Homekit

correct, if you add openhab as device to homekit, home app request a list of all accessories from openhab and if home app get something it does not understand it say, that openhab cannot be added.

we had to cases which have confused home app

  • no items marked with homekit tag
  • items tagged with “colour temperature” tag