HomePod Mini Temperature/Humidity Sensor to HA

https://pvieito.com/2019/12/extract-homekit-pairing-keys

You’ll need the keys and you could than manually pair it with HomeKit Controller

Its probably more trouble than its worth

1 Like

Any news on this yet?

1 Like

Curious if there is work being done on this?

2 Likes

Not sure, but I sure hope so! There’s plenty people clearly want it. Seems all the work atm is done on Alexa :thinking:

There is a bit of a back door way to get this enabled where you have extract the keys and manually pair it with HomeKit controller, but it isn’t for the faint of heart and not what we are all really looking for as an integration.

Hope someone can fill this gap and either figure out a way to get this shown in HomeKit controller as another entity in the HomePod or have Apple tell us how it is exposed.

I think I’ve seen this too, but I’d rather wait!

1 Like

Has anyone tried this method can confirm the temperature is exposed in HA?

Maybe with the WTH month approaching we can bring this issue to the forefront of their attention.

1 Like

Thread cleanup done - please don’t make “+1” posts, please just vote.

3 Likes

I’m thinking a really hacky/time consuming way to do this is to create a bunch of dummy switches in HA representing the humidity level and have HomeKit automations trip the correct one, and unsetting the others as humidity changes.
Amount of switches depending on the granularity you want. Or just a few representing the values you need for HA automation

Edit- I was able to do this by creating an input number in HA and setting that via iOS shortcuts to the humidity level ( and running that every 5 minutes). Then deriving that in HA as a template sensor. Was it worth it? Eh

1 Like

Can you share some more details about how you did this? The idea seems good enough for me

Turns out it’s pretty simple. I made something shareable.

You have to make an input_number in Home Assistant, and have a user token handy.

I should have given it a different name, and you’ll have to manually change the sensor, didn’t think to make that a question in the shortcut.

2 Likes

How do you get the user token?

You do that in Home Assistant.

Tap your username at the bottom of the Home Assistant sidebar, scroll allll the way to the bottom until you see “Long-lived access tokens”, tap “Create Token”, give it a name (I went with “Shortcuts App”), then copy that token to wherever you store passwords, and that’s your user token.

Thanks for that! Might give it a try

That’s great! It works!
Now i just have to add all my 8 HomePods and an automation, that updates the values every hour.

I haven’t gotten to that part yet on my setup, but I did find out you can use a variety of things:

launchd, cron, iCal, all do it for free. You just have to execute shortcuts run 'your shortcut name'. You could write one shell script that calls shortcuts run ... for all of your shortcuts to help manage things.

Shortery can do it but it costs $13CAD/year to access timed triggers.

I was able to make that work with the extraction of the HomeKit keys. A few things changed since 2019, I’ll contact Pedro to see if he can update his article, otherwise I’ll post modified instructions here. Took me a couple hours, but with better instructions you can probably make it in less than one.

4 Likes

Could you post the updated instructions?

1 Like

Prerequisit of this tutorial

  • You have a Mac available that is connected to your HomeKit home that has the HomePod mini
  • You have a working Apple Developer account
  • You know know how to use git, ssh, etc.

Follow along in Petro’s post with the following modifications (in bold). The rest are clarifications.

To disable System Integrity Protection and AMFI :

  • Reboot in Recovery OS and disable System Integrity Protection with csrutil disable
  • Reboot in your main OS and disable AMFI with sudo nvram boot-args=amfi_get_out_of_my_way=0x1
  • Reboot again in your main OS

In the article, we get the keys first, but there’s no way to know which keys belong to which device at that step. So you can install HomeKit Python (python3 -m pip install "homekit[IP]" --user) and discover devices (python3 -m homekit.discover) to find the device ID that you want. Note that I had to use python 3.11.6, the 3.8 version I had locally didn’t work with HomeKit Python.

Then you can actually find the keys. You can use my branch of KeychainTool that include some modification to make it build on newer version of Xcode : GitHub - gcamp/KeychainKit: Swift framework and tool to extract or dump items from the iCloud Keychain.

As mentionned in the post, to run the KeychainTool I had to specify my CODESIGNKIT_DEFAULT_IDENTITY. The final command was something like this CODESIGNKIT_DEFAULT_IDENTITY="Apple Development: <My Name> (<Your DeveloperID>)" swift run KeychainTool -g com.apple.hap.pairing

My keychain had mutiple HomeKit Pairing Identity, so I had to trial and error each of them until I found the correct one.

When you’re testing access with HomeKit Python and it works, you can move to adding the device manually to Home Assistant.

Adding the Mini to Home Assistant

Note that this step I figured by myself and involves editing core.config_entries which is not something that should be done lightly. There might be a simpler way to do this but couldn’t figure it out otherwise.

First, do a full backup of your Home Assistant. If you screw something in the files, you will loose state. Then, stop Home Assistant Core. If you’re running haos, you can do that by calling the homeassistant.stop service.

Then, you can edit your core.config_entries which is inside the .storage folder. You need to add a new entry in the “entries” list. You can copy one of the domain=homekit_controller entry or use the example below. Probably safer to copy one of the entry and modify it, especially if you’re following this on version higher than 2023.11.2 which this was tested on.

This was the entry I added :

      {
        "entry_id": "ab4e836e793fb05116ca5cf0f4dcdd92",
        "version": 1,
        "domain": "homekit_controller",
        "title": "HomePod mini Cuisine",
        "data": {
          "AccessoryPairingID": "A3:2A:F5:6B:BC:D7",
          "AccessoryLTPK": "67495108fe34abe8a4bfe1c47d272c1fe6e70b941af500e295dd2abf5e76",
          "iOSPairingId": "AF2E9A-0035-4C53-81F4-647F1BBA57",
          "iOSDeviceLTSK": "8af9906a7260534a4e7c7fb646ae19133a492036cbf5a6966d3f5ee4d964",
          "iOSDeviceLTPK": "5dee1803c6149c198bef18d342d558e90058544e6a1502294f80635654a5",
          "AccessoryIP": "10.0.0.105",
          "AccessoryPort": 56633,
          "Connection": "IP"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "zeroconf",
        "unique_id": "a3:2a:f5:6b:bc:d7",
        "disabled_by": null
      },

I had to modify

  • the “entry_id” value to put a new random value (change anything as long as it’s unique)
  • the “title” to identify your HomePod
  • the “data” dict should contain what you created in your pairing.json from HomeKit Python
  • the “unique_id” should be your AccessoryPairingID with lowercase letters (no idea if this is actually required)

Make sure you’re JSON file is valid with https://jsonlint.com or whatever you prefer. If you’re already in your SSH session to edit files, you can now reboot your device and that should start HA again.

You’re done! There should be a new device unceremoniously added in the “HomeKit Device” integration. :tada:

5 Likes