Skip to content

Commit

Permalink
Bump hahomematic to 2024.9.10
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ committed Sep 23, 2024
1 parent aec70b2 commit 0b4a12b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 22 deletions.
9 changes: 7 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
- Use service get_link_paramset to read direct connections

## What's Changed
- Bump hahomematic to 2024.9.9
- Bump hahomematic to 2024.9.10
- Add bind_collector to all relevant methods with option to disable it
- Add check for link paramsets
- Add getLinkPeers XmlRPC method
- Add missing PayloadMixin
- Add name to channel
- Add paramset_key to entity_key
- Adjust payload and path
- Avoid permanent cache save on remove device
- Catch bind address errors of xml rpc server
- Check rx_mode
- Do not create update entities that are not updatable (manually remove obsolete update entities)
- Ensure only one load/save of cache file at time
Expand All @@ -23,15 +25,18 @@
- Mark only level as relevant entity for DALI
- Only try device update refresh if device is updatable
- Refactor device/entity to extract channel
- Refactor get_events, get_new_entities
- Refactor update entity
- Remove unnecessary checks
- Rename value_property to state_property
- Replace device_type by model
- Shorten names
- Small definition fix for DALI
- Switch typing of paramset_key from str to ParamsetKey
- Use channel instead of channel_addresses
- Use TypedDict for device_description
- Use TypedDict for parameter_data
- Use channel instead of channel_addresses
- Use paramset_description from channel
- Use validator for local schema
- Add services get_link_peers, get_link_paramset, put_link_paramset
- Improve german descriptions by @baxxy13
Expand Down
2 changes: 1 addition & 1 deletion custom_components/homematicip_local/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from homeassistant.const import Platform

DOMAIN: Final = "homematicip_local"
HMIP_LOCAL_MIN_VERSION: Final = "2024.6.0dev0"
HMIP_LOCAL_MIN_VERSION: Final = "2024.9.0dev0"

DEFAULT_DEVICE_FIRMWARE_CHECK_ENABLED: Final = True
DEFAULT_DEVICE_FIRMWARE_CHECK_INTERVAL: Final = 21600 # 6h
Expand Down
10 changes: 8 additions & 2 deletions custom_components/homematicip_local/control_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ParamsetKey,
SystemInformation,
)
from hahomematic.exceptions import BaseHomematicException
from hahomematic.platforms.entity import CallbackEntity
from hahomematic.support import check_config

Expand Down Expand Up @@ -123,8 +124,13 @@ async def start_central(self) -> None:
"Starting central unit %s",
self._instance_name,
)
await self._central.start()
_LOGGER.info("Started central unit for %s", self._instance_name)
try:
await self._central.start()
_LOGGER.info("Started central unit for %s", self._instance_name)
except BaseHomematicException:
_LOGGER.warning(
"START_CENTRAL: Failed to start central unit for %s", self._instance_name
)

async def stop_central(self, *args: Any) -> None:
"""Stop the control unit."""
Expand Down
28 changes: 14 additions & 14 deletions custom_components/homematicip_local/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
EVENT_INTERFACE_ID,
HmPlatform,
)
from hahomematic.platforms.device import HmChannel, HmDevice
from hahomematic.platforms.event import GenericEvent

from homeassistant.components.event import EventDeviceClass, EventEntity
Expand All @@ -38,7 +39,7 @@ async def async_setup_entry(
control_unit: ControlUnit = entry.runtime_data

@callback
def async_add_event(hm_entities: tuple[list[GenericEvent], ...]) -> None:
def async_add_event(hm_entities: tuple[tuple[GenericEvent, ...], ...]) -> None:
"""Add event from Homematic(IP) Local."""
_LOGGER.debug("ASYNC_ADD_EVENT: Adding %i entities", len(hm_entities))

Expand All @@ -61,9 +62,7 @@ def async_add_event(hm_entities: tuple[list[GenericEvent], ...]) -> None:

for event_type in ENTITY_EVENTS:
async_add_event(
hm_entities=control_unit.central.get_channel_events(
event_type=event_type, registered=False
)
hm_entities=control_unit.central.get_events(event_type=event_type, registered=False)
)


Expand All @@ -80,40 +79,41 @@ class HaHomematicEvent(EventEntity):
def __init__(
self,
control_unit: ControlUnit,
hm_channel_events: list[GenericEvent],
hm_channel_events: tuple[GenericEvent, ...],
) -> None:
"""Initialize the event."""
self._cu: ControlUnit = control_unit
self._attr_event_types = [event.parameter.lower() for event in hm_channel_events]
self._hm_primary_entity: GenericEvent = hm_channel_events[0]
self._hm_channel: HmChannel = hm_channel_events[0].channel
self._hm_device: HmDevice = hm_channel_events[0].channel.device
self._hm_channel_events = hm_channel_events
self._attr_translation_key = self._hm_primary_entity.event_type.value.replace(".", "_")

self._attr_unique_id = f"{DOMAIN}_{self._hm_primary_entity.channel.unique_id}"
self._attr_unique_id = f"{DOMAIN}_{self._hm_channel.unique_id}"
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, self._hm_primary_entity.device.identifier)},
identifiers={(DOMAIN, self._hm_device.identifier)},
)
self._attr_extra_state_attributes = {
EVENT_INTERFACE_ID: self._hm_primary_entity.device.interface_id,
EVENT_ADDRESS: self._hm_primary_entity.channel.address,
EVENT_MODEL: self._hm_primary_entity.device.model,
EVENT_INTERFACE_ID: self._hm_device.interface_id,
EVENT_ADDRESS: self._hm_channel.address,
EVENT_MODEL: self._hm_device.model,
}
self._unregister_callbacks: list[CALLBACK_TYPE] = []
_LOGGER.debug(
"init: Setting up %s %s",
self._hm_primary_entity.device.name,
self._hm_primary_entity.name_data.channel_name,
self._hm_device.name,
self._hm_channel.name,
)

@property
def available(self) -> bool:
"""Return if event is available."""
return self._hm_primary_entity.device.available
return self._hm_device.available

@property
def name(self) -> str | UndefinedType | None:
"""Return the name of the entity."""

return self._hm_primary_entity.name_data.channel_name

async def async_added_to_hass(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/homematicip_local/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/danielperna84/hahomematic/issues",
"loggers": ["hahomematic"],
"requirements": ["hahomematic==2024.9.9"],
"requirements": ["hahomematic==2024.9.10"],
"ssdp": [
{
"manufacturer": "EQ3",
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Homematic(IP) Local",
"hide_default_branch": false,
"homeassistant": "2024.6.0dev0",
"homeassistant": "2024.9.0dev0",
"hacs": "1.34.0"
}
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r requirements_test_pre_commit.txt

async-upnp-client==0.40.0
hahomematic==2024.9.9
hahomematic==2024.9.10
homeassistant==2024.9.2
mypy==1.11.2
mypy-dev==1.11.0a9
Expand Down

0 comments on commit 0b4a12b

Please sign in to comment.