Migrating from HomeKit to Home Assistant
I recently went through the process of migrating from Apple HomeKit to my own Home Assistant server.
This post is currently a draft in need of improvement.
Step one: Buy the hardware to run Home Assistant
I ordered the Home Assistant Green, which is supposed to be plug and play. However, it wasn't. So I needed to get a microSD card to performa a factory reset and I got it working.
Some initial config:
- [ ] Enable advanced mode
- [ ] Install “Advanced Terminal & SSH” (remember to disable protection mode and add username and password to config tab)
Zigbee devices
Level: Easy!
How: Just reset each device while keeping the ZHA device search page open. It automatically appears in HA.
Matter devices
Difficulty level: It doesn’t get easier
You need to use the HA app on your phone, then Add device > Add Matter device. The easiest is to not even scan the code, but to click the Other button and you can already see your Matter devices listed there. Select and you’re set!
Thread HomeKit devices
Difficulty level: I’m stuck!
How it’s supposed to work:
- If you haven’t already, setup and pair with the device with HomeKit.
- Once added, remove the device from HomeKit. The device still remembers the Apple Thread network
- Add to HA through the Apple > HomeKit Device option (it should show up immediately after removing from Apple Home)
That all works, however I’m getting an error saying the device has already been added to another network (?)
Can it be related to not being able to set Preferred Thread Network?

It seems it’s not possible (or at least easy) to add the Apple network as the Preferred network. No easy way to get the relevant credentials from Apple, it seems. Discussion here. Could possibly get it if I had a Nanoleaf Thread device.
I was facing the issue with Eve Door & Window, but it was possible to migrate the device in the Eve app 
Troubleshooting
Issues setting Apple’s Thread network as Preferred
Use Nanoleaf app for getting the credentials, then run the following code in the Advanced Terminal & SSH add-on.
Install dependency:
pip install python-otbr-api
Then enter python and run the following code:
Code:
import python_otbr_api
from python_otbr_api import PENDING_DATASET_DELAY_TIMER, tlv_parser
from python_otbr_api.pskc import compute_pskc
from python_otbr_api.tlv_parser import MeshcopTLVType, MeshcopTLVItem
# Apple
CHANNEL = 25
PANID = "XXXXXXXX"
EXTPANID = "XXXXXXXX"
NETWORK_KEY = "XXXXXXXX"
NETWORK_NAME = "MyHome20"
PSKC = "XXXXXXXX"
TIMESTAMP = b'\x00\x00\x00\x00\x00\x03\x00\x00'
channel = MeshcopTLVItem(tag=0, data=CHANNEL.to_bytes(length=3, byteorder='big'))
pan_id= MeshcopTLVItem(tag=1, data=bytes.fromhex(PANID))
ext_pan_id = MeshcopTLVItem(tag=2, data=bytes.fromhex(EXTPANID))
network_name = MeshcopTLVItem(tag=3, data=str.encode(NETWORK_NAME))
pre_shared_key = MeshcopTLVItem(tag=4, data=bytes.fromhex(PSKC))
network_key = MeshcopTLVItem(tag=5, data=bytes.fromhex(NETWORK_KEY))
timestamp = MeshcopTLVItem(tag=14, data=TIMESTAMP)
tlv_new = {0: channel, 1: pan_id, 2: ext_pan_id, 3: network_name, 4: pre_shared_key, 5: network_key, 14: timestamp}
tlv = tlv_parser.encode_tlv(tlv_new)
print(tlv)
Note: If it’s hard to copy the output, you can run it by SSHing into the server and running python and copy from there:
ssh tkhome@homeassistant.local
The TLV for the cabin is:
XXXXXXXX
Issue enabling Terminal
“The add-on seems to not be ready, it might still be starting. Do you want to try again?”
https://community.home-assistant.io/t/not-able-to-start-advanced-ssh-web-terminal/576236/2
Need to add username/password to Configuration tab