From 4efd7c137ce88807ea058e559e26a278490ecab2 Mon Sep 17 00:00:00 2001 From: SukramJ Date: Tue, 11 Jan 2022 19:54:47 +0100 Subject: [PATCH] Mark secondary channels name with a V --> Vch (#163) * Mark secondary channels name with a V --> Vch * Reduce logging --- changelog.txt | 3 +++ hahomematic/device.py | 4 ++-- hahomematic/entity.py | 5 +++-- hahomematic/helpers.py | 9 ++++++--- setup.py | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index af9576f7..7a7611e6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +Version 0.19.0 (2022-01-10) +- Mark secondary channels name with a V --> Vch + Version 0.18.1 (2022-01-10) - Reduce some log_level - Fix callback to notify un_reach diff --git a/hahomematic/device.py b/hahomematic/device.py index e4ca40f5..e9a818cd 100644 --- a/hahomematic/device.py +++ b/hahomematic/device.py @@ -643,12 +643,12 @@ def create_devices(central: hm_central.CentralUnit) -> None: new_entities: list[BaseEntity] = [] for interface_id, client in central.clients.items(): if not client: - _LOGGER.warning( + _LOGGER.debug( "create_devices: Skipping interface %s, missing client.", interface_id ) continue if not central.paramsets.get_by_interface(interface_id=interface_id): - _LOGGER.warning( + _LOGGER.debug( "create_devices: Skipping interface %s, missing paramsets.", interface_id, ) diff --git a/hahomematic/entity.py b/hahomematic/entity.py index 46775f0e..4d7b0585 100644 --- a/hahomematic/entity.py +++ b/hahomematic/entity.py @@ -470,19 +470,20 @@ def __init__( device_has_multiple_channels = hm_custom_entity.is_multi_channel_device( device_type=self._device.device_type, sub_type=self._device.sub_type ) + self.usage = self._custom_entity_usage() self.name = get_custom_entity_name( central=self._central, device_address=self.device_address, unique_id=self.unique_id, channel_no=channel_no, device_type=self.device_type, - is_primary_channel=check_channel_is_only_primary_channel( + is_only_primary_channel=check_channel_is_only_primary_channel( current_channel=channel_no, device_def=device_def, device_has_multiple_channels=device_has_multiple_channels, ), + usage=self.usage, ) - self.usage = self._custom_entity_usage() self.data_entities: dict[str, GenericEntity] = {} self._init_entities() diff --git a/hahomematic/helpers.py b/hahomematic/helpers.py index e03563e2..71a7df60 100644 --- a/hahomematic/helpers.py +++ b/hahomematic/helpers.py @@ -19,6 +19,7 @@ ATTR_NAME, ATTR_TYPE, ATTR_VALUE, + HmEntityUsage, ) import hahomematic.devices.entity_definition as hm_entity_definition from hahomematic.exceptions import HaHomematicException @@ -199,7 +200,8 @@ def get_custom_entity_name( unique_id: str, channel_no: int, device_type: str, - is_primary_channel: bool, + is_only_primary_channel: bool, + usage: HmEntityUsage, ) -> str: """Rename name for custom entity""" if custom_entity_name := _get_base_name_from_channel_or_device( @@ -207,9 +209,10 @@ def get_custom_entity_name( channel_address=f"{device_address}:{channel_no}", device_type=device_type, ): - if is_primary_channel and ":" in custom_entity_name: + if is_only_primary_channel and ":" in custom_entity_name: return custom_entity_name.split(":")[0] - return custom_entity_name.replace(":", " ch") + marker = " ch" if usage == HmEntityUsage.CE_PRIMARY else " vch" + return custom_entity_name.replace(":", marker) _LOGGER.info( "Helper.get_custom_entity_name: Using unique_id for %s %s %s", diff --git a/setup.py b/setup.py index 2c6a5a8e..8d6df812 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def readme(): }, PACKAGE_NAME = "hahomematic" HERE = os.path.abspath(os.path.dirname(__file__)) -VERSION = "0.18.1" +VERSION = "0.19.0" PACKAGES = find_packages(exclude=["tests", "tests.*", "dist", "build"])