Skip to content

Commit

Permalink
Bump hahomematic to 2024.5.1 (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ authored May 7, 2024
1 parent d6063da commit 53f70f7
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Version 1.61.0 (2024-05-07)

- Bump hahomematic to 2024.5.1
- Improve callback register/unregister

# Version 1.61.0 (2024-05-05)

- Bump hahomematic to 2024.5.0
Expand Down
6 changes: 4 additions & 2 deletions custom_components/homematicip_local/control_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from hahomematic.central import INTERFACE_EVENT_SCHEMA, CentralConfig, CentralUnit
from hahomematic.client import InterfaceConfig
from hahomematic.const import (
CALLBACK_TYPE,
CONF_PASSWORD,
CONF_USERNAME,
EVENT_ADDRESS,
Expand Down Expand Up @@ -114,7 +115,7 @@ def __init__(self, control_config: ControlConfig) -> None:
self._enable_system_notifications = self._config_data[CONF_ENABLE_SYSTEM_NOTIFICATIONS]
self._central: CentralUnit = self._create_central()
self._attr_device_info: DeviceInfo | None = None
self._unregister_callbacks: list[Callable] = []
self._unregister_callbacks: list[CALLBACK_TYPE] = []

async def start_central(self) -> None:
"""Start the central unit."""
Expand Down Expand Up @@ -231,7 +232,8 @@ async def stop_central(self, *args: Any) -> None:
self._scheduler.de_init()

for unregister in self._unregister_callbacks:
unregister()
if unregister is not None:
unregister()

await super().stop_central(*args)

Expand Down
14 changes: 10 additions & 4 deletions custom_components/homematicip_local/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

from __future__ import annotations

from collections.abc import Callable
import logging
from typing import Any

from hahomematic.const import ENTITY_EVENTS, EVENT_ADDRESS, EVENT_INTERFACE_ID, HmPlatform
from hahomematic.const import (
CALLBACK_TYPE,
ENTITY_EVENTS,
EVENT_ADDRESS,
EVENT_INTERFACE_ID,
HmPlatform,
)
from hahomematic.platforms.event import GenericEvent

from homeassistant.components.event import EventDeviceClass, EventEntity
Expand Down Expand Up @@ -93,7 +98,7 @@ def __init__(
EVENT_ADDRESS: self._hm_primary_entity.channel_address,
EVENT_MODEL: self._hm_primary_entity.device.device_type,
}
self._unregister_callbacks: list[Callable] = []
self._unregister_callbacks: list[CALLBACK_TYPE] = []
_LOGGER.debug(
"init: Setting up %s %s",
self._hm_primary_entity.device.name,
Expand Down Expand Up @@ -142,7 +147,8 @@ async def async_will_remove_from_hass(self) -> None:
"""Run when hmip device will be removed from hass."""
# Remove callback from device.
for unregister in self._unregister_callbacks:
unregister()
if unregister is not None:
unregister()

@callback
def _async_device_removed(self, *args: Any, **kwargs: Any) -> None:
Expand Down
14 changes: 8 additions & 6 deletions custom_components/homematicip_local/generic_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from __future__ import annotations

from collections.abc import Callable, Mapping
from collections.abc import Mapping
import logging
from typing import Any, Final, Generic

from hahomematic.const import CallSource
from hahomematic.const import CALLBACK_TYPE, CallSource
from hahomematic.platforms.custom.entity import CustomEntity
from hahomematic.platforms.entity import CallbackEntity
from hahomematic.platforms.generic.entity import GenericEntity
Expand Down Expand Up @@ -84,7 +84,7 @@ def __init__(
)

self._static_state_attributes = self._get_static_state_attributes()
self._unregister_callbacks: list[Callable] = []
self._unregister_callbacks: list[CALLBACK_TYPE] = []

_LOGGER.debug("init: Setting up %s", hm_entity.full_name)
if (
Expand Down Expand Up @@ -245,7 +245,8 @@ async def async_will_remove_from_hass(self) -> None:
"""Run when hmip device will be removed from hass."""
# Remove callback from device.
for unregister in self._unregister_callbacks:
unregister()
if unregister is not None:
unregister()

@callback
def _async_device_removed(self, *args: Any, **kwargs: Any) -> None:
Expand Down Expand Up @@ -314,7 +315,7 @@ def __init__(
self.entity_description = entity_description
self._attr_name = hm_hub_entity.name
self._attr_device_info = control_unit.device_info
self._unregister_callbacks: list[Callable] = []
self._unregister_callbacks: list[CALLBACK_TYPE] = []
_LOGGER.debug("init sysvar: Setting up %s", self.name)

@property
Expand All @@ -341,7 +342,8 @@ async def async_will_remove_from_hass(self) -> None:
"""Run when hmip sysvar entity will be removed from hass."""
# Remove callbacks.
for unregister in self._unregister_callbacks:
unregister()
if unregister is not None:
unregister()

@callback
def _async_hub_entity_updated(self, *args: Any, **kwargs: Any) -> None:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/homematicip_local/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/danielperna84/hahomematic/issues",
"loggers": ["hahomematic"],
"requirements": ["hahomematic==2024.5.0"],
"requirements": ["hahomematic==2024.5.1"],
"ssdp": [
{
"manufacturer": "EQ3",
"manufacturerURL": "http://www.homematic.com"
}
],
"version": "1.61.0",
"version": "1.62.0",
"zeroconf": []
}
8 changes: 4 additions & 4 deletions custom_components/homematicip_local/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from __future__ import annotations

from collections.abc import Callable
import logging
from typing import Any, Final

from hahomematic.const import DeviceFirmwareState, HmPlatform
from hahomematic.const import CALLBACK_TYPE, DeviceFirmwareState, HmPlatform
from hahomematic.platforms.update import HmUpdate

from homeassistant.components.update import UpdateEntity, UpdateEntityFeature
Expand Down Expand Up @@ -83,7 +82,7 @@ def __init__(
self._attr_extra_state_attributes = {
ATTR_FIRMWARE_UPDATE_STATE: hm_entity.firmware_update_state
}
self._unregister_callbacks: list[Callable] = []
self._unregister_callbacks: list[CALLBACK_TYPE] = []
_LOGGER.debug("init: Setting up %s", hm_entity.full_name)

@property
Expand Down Expand Up @@ -156,7 +155,8 @@ async def async_will_remove_from_hass(self) -> None:
"""Run when hmip device will be removed from hass."""
# Remove callback from device.
for unregister in self._unregister_callbacks:
unregister()
if unregister is not None:
unregister()

@callback
def _async_device_removed(self, *args: Any, **kwargs: Any) -> None:
Expand Down
6 changes: 3 additions & 3 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

async-upnp-client
coverage==7.5.0
hahomematic==2024.5.0
homeassistant==2024.5.1
hahomematic==2024.5.1
homeassistant==2024.5.2
mypy==1.10.0
pip==24.0
pre-commit==3.7.0
Expand All @@ -12,7 +12,7 @@ pylint-strict-informational==0.1
pylint==3.1.0
pytest-asyncio==0.23.6
pytest-cov==5.0.0
pytest-homeassistant-custom-component==0.13.121
pytest-homeassistant-custom-component==0.13.122
pytest-rerunfailures==14.0
pytest-socket==0.7.0
pytest-timeout==2.3.1
Expand Down

0 comments on commit 53f70f7

Please sign in to comment.