Update PyMicroBot to 0.0.23 (#148700)

This commit is contained in:
Marc Mueller 2025-07-13 22:12:00 +02:00 committed by GitHub
parent 611f86cf8c
commit b2fe17c6d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 34 deletions

View File

@ -2,42 +2,14 @@
from __future__ import annotations from __future__ import annotations
from collections.abc import Generator from microbot import MicroBotApiClient
from contextlib import contextmanager
import bleak
from homeassistant.components import bluetooth from homeassistant.components import bluetooth
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_ADDRESS, Platform from homeassistant.const import CONF_ACCESS_TOKEN, CONF_ADDRESS, Platform
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
from .coordinator import MicroBotConfigEntry, MicroBotDataUpdateCoordinator
@contextmanager
def patch_unused_bleak_discover_import() -> Generator[None]:
"""Patch bleak.discover import in microbot. It is unused and was removed in bleak 1.0.0."""
def getattr_bleak(name: str) -> object:
if name == "discover":
return None
raise AttributeError
original_func = bleak.__dict__.get("__getattr__")
bleak.__dict__["__getattr__"] = getattr_bleak
try:
yield
finally:
if original_func is not None:
bleak.__dict__["__getattr__"] = original_func
with patch_unused_bleak_discover_import():
from microbot import MicroBotApiClient
from .coordinator import ( # noqa: E402
MicroBotConfigEntry,
MicroBotDataUpdateCoordinator,
)
PLATFORMS: list[str] = [Platform.SWITCH] PLATFORMS: list[str] = [Platform.SWITCH]

View File

@ -16,5 +16,5 @@
"integration_type": "hub", "integration_type": "hub",
"iot_class": "assumed_state", "iot_class": "assumed_state",
"loggers": ["keymitt_ble"], "loggers": ["keymitt_ble"],
"requirements": ["PyMicroBot==0.0.17"] "requirements": ["PyMicroBot==0.0.23"]
} }

2
requirements_all.txt generated
View File

@ -70,7 +70,7 @@ PyMetEireann==2024.11.0
PyMetno==0.13.0 PyMetno==0.13.0
# homeassistant.components.keymitt_ble # homeassistant.components.keymitt_ble
PyMicroBot==0.0.17 PyMicroBot==0.0.23
# homeassistant.components.mobile_app # homeassistant.components.mobile_app
# homeassistant.components.owntracks # homeassistant.components.owntracks

View File

@ -67,7 +67,7 @@ PyMetEireann==2024.11.0
PyMetno==0.13.0 PyMetno==0.13.0
# homeassistant.components.keymitt_ble # homeassistant.components.keymitt_ble
PyMicroBot==0.0.17 PyMicroBot==0.0.23
# homeassistant.components.mobile_app # homeassistant.components.mobile_app
# homeassistant.components.owntracks # homeassistant.components.owntracks

View File

@ -178,7 +178,6 @@ OSI_APPROVED_LICENSES = {
} }
EXCEPTIONS = { EXCEPTIONS = {
"PyMicroBot", # https://github.com/spycle/pyMicroBot/pull/3
"PySwitchmate", # https://github.com/Danielhiversen/pySwitchmate/pull/16 "PySwitchmate", # https://github.com/Danielhiversen/pySwitchmate/pull/16
"PyXiaomiGateway", # https://github.com/Danielhiversen/PyXiaomiGateway/pull/201 "PyXiaomiGateway", # https://github.com/Danielhiversen/PyXiaomiGateway/pull/201
"chacha20poly1305", # LGPL "chacha20poly1305", # LGPL