Hi everyone
Since nothing happened I tried to solve the problem myself
ChatGPT helped me to create a patch
1st: NO GUARANTEES! Make a complete backup before use! Use at own risk!
2nd: Patch needs to be reinstalled after every core update. Thats intended, since I hope for a official solution soon.
Steps to reproduce (Hass OS):
- open SSH (security mode disabled)
- write
docker exec -it homeassistant bash and press enter
- make backup of file, we’re going to change:
cp /usr/local/lib/python3.13/site-packages/aiohomekit/protocol/statuscodes.py \
/usr/local/lib/python3.13/site-packages/aiohomekit/protocol/statuscodes.py.bak
- insert patch:
cat > /usr/local/lib/python3.13/site-packages/aiohomekit/protocol/statuscodes.py <<'PYCODE'
#
# Copyright 2019 aiohomekit team
#
# Licensed under the Apache License, Version 2.0 (the "License");
#
import logging
from aiohomekit.enum import EnumWithDescription
from types import SimpleNamespace
logger = logging.getLogger(__name__)
class HapStatusCode(EnumWithDescription):
SUCCESS = 0, "This specifies a success for the request."
INSUFFICIENT_PRIVILEGES = -70401, "Request denied due to insufficient privileges."
UNABLE_TO_COMMUNICATE = (
-70402,
"Unable to communicate with requested service, e.g. the power to the accessory was turned off.",
)
RESOURCE_BUSY = -70403, "Resource is busy, try again."
CANT_WRITE_READ_ONLY = -70404, "Cannot write to read only characteristic."
CANT_READ_WRITE_ONLY = -70405, "Cannot read from a write only characteristic."
NOTIFICATION_NOT_SUPPORTED = (
-70406,
"Notification is not supported for characteristic.",
)
OUT_OF_RESOURCES = -70407, "Out of resources to process request."
TIMED_OUT = -70408, "Operation timed out."
RESOURCE_NOT_EXIST = -70409, "Resource does not exist."
INVALID_VALUE = -70410, "Accessory received an invalid value in a write request."
INSUFFICIENT_AUTH = -70411, "Insufficient Authorization."
NOT_ALLOWED_IN_CURRENT_STATE = -70412, "Not allowed in current state"
UNKNOWN = -1, "Unknown or undefined status code"
def to_status_code(status_code: int):
normalized = abs(status_code) * -1
try:
return HapStatusCode(normalized)
except ValueError as exc:
mapping = {
-6: "INVALID_REQUEST",
}
label = mapping.get(status_code, "UNKNOWN")
logger.warning(
"aiohomekit_patch: Unbekannter HapStatusCode %r (%s), benutze Platzhalter %s",
status_code, exc, label
)
return HapStatusCode.UNKNOWN
class _HapBleStatusCodes:
SUCCESS = 0x00
UNSUPPORTED_PDU = 0x01
MAX_PROCEDURES = 0x02
INSUFFICIENT_AUTHORIZATION = 0x03
INVALID_INSTANCE_ID = 0x04
INSUFFICIENT_AUTHENTICATION = 0x05
INVALID_REQUEST = 0x06
def __init__(self) -> None:
self._codes = {
_HapBleStatusCodes.SUCCESS: "The request was successful.",
_HapBleStatusCodes.UNSUPPORTED_PDU: "The request failed as the HAP PDU was not recognized or supported.",
_HapBleStatusCodes.MAX_PROCEDURES: "The request failed as the accessory has reached the limit on the simultaneous procedures it can handle.",
_HapBleStatusCodes.INSUFFICIENT_AUTHORIZATION: "Characteristic requires additional authorization data.",
_HapBleStatusCodes.INVALID_INSTANCE_ID: "The HAP Request's characteristic Instance Id did not match the addressed characteristic's instance Id",
_HapBleStatusCodes.INSUFFICIENT_AUTHENTICATION: "Characteristic access required a secure session to be established.",
_HapBleStatusCodes.INVALID_REQUEST: "Accessory was not able to perform the requested operation",
}
self._categories_rev = {self._codes[k]: k for k in self._codes.keys()}
def __getitem__(self, item):
if item in self._codes:
return self._codes[item]
raise KeyError(f"Item {item} not found")
PYCODE
- Restart HA
- Readd Buttons using bluetooth and then migrate them to thread
This worked for me and my buttons finally stay available and responsive after migrating to thread again 
Might work for other thread-devices with issues too, can’t test that.