diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dc6cbf0d..87609ba97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ Versions from 0.40 and up -## Ongoing +## v0.62.0 -- Extended feature: extent/improve Plugwise groups, via PR[#976](https://github.com/plugwise/plugwise-beta/pull/976) and plugwise [v1.11.0](https://github.com/plugwise/python-plugwise/releases/tag/v1.11.0) +- Block Plugwise switch-groups, use HA group-helper instead, via PR [#978](https://github.com/plugwise/plugwise-beta/pull/978) +- Extended feature: extent/improve Plugwise groups, via PR [#976](https://github.com/plugwise/plugwise-beta/pull/976) and plugwise [v1.11.0](https://github.com/plugwise/python-plugwise/releases/tag/v1.11.0) - DeviceInfo: show configuration_url on gateway only, via PR [#975](https://github.com/plugwise/plugwise-beta/pull/975) ## v0.61.0 diff --git a/custom_components/plugwise/const.py b/custom_components/plugwise/const.py index ab4fac9c6..5fa165bb7 100644 --- a/custom_components/plugwise/const.py +++ b/custom_components/plugwise/const.py @@ -146,6 +146,7 @@ RELAY: Final = "relay" COOLING_ENA_SWITCH: Final ="cooling_ena_switch" SWITCHES: Final = "switches" +SWITCH_GROUPS: Final[tuple[str, str]] = ("report", "switching") # Default directives DEFAULT_PORT: Final[int] = 80 diff --git a/custom_components/plugwise/manifest.json b/custom_components/plugwise/manifest.json index 5e9ac079e..f765628df 100644 --- a/custom_components/plugwise/manifest.json +++ b/custom_components/plugwise/manifest.json @@ -8,6 +8,6 @@ "iot_class": "local_polling", "loggers": ["plugwise"], "requirements": ["plugwise==1.11.0"], - "version": "0.61.0", + "version": "0.62.0", "zeroconf": ["_plugwise._tcp.local."] } diff --git a/custom_components/plugwise/sensor.py b/custom_components/plugwise/sensor.py index 6e7fe6b45..151847abe 100644 --- a/custom_components/plugwise/sensor.py +++ b/custom_components/plugwise/sensor.py @@ -29,6 +29,7 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from .const import ( + DEV_CLASS, DHW_SETPOINT, DHW_TEMP, EL_CONS_INTERVAL, @@ -66,6 +67,7 @@ OUTDOOR_TEMP, RETURN_TEMP, SENSORS, + SWITCH_GROUPS, TARGET_TEMP, TARGET_TEMP_HIGH, TARGET_TEMP_LOW, @@ -482,6 +484,9 @@ def _add_entities() -> None: device = coordinator.data[device_id] if not (sensors := device.get(SENSORS)): continue + # block switch-groups, user HA group helper instead + if device.get(DEV_CLASS) in SWITCH_GROUPS: + continue for description in PLUGWISE_SENSORS: if description.key not in sensors: continue diff --git a/custom_components/plugwise/switch.py b/custom_components/plugwise/switch.py index af67e7c4e..47206c01e 100644 --- a/custom_components/plugwise/switch.py +++ b/custom_components/plugwise/switch.py @@ -18,11 +18,13 @@ from .const import ( COOLING_ENA_SWITCH, + DEV_CLASS, DHW_CM_SWITCH, LOCK, LOGGER, # pw-beta MEMBERS, RELAY, + SWITCH_GROUPS, SWITCHES, ) @@ -97,6 +99,9 @@ def _add_entities() -> None: device = coordinator.data[device_id] if not (switches := device.get(SWITCHES)): continue + # block switch-groups, user HA group helper instead + if device.get(DEV_CLASS) in SWITCH_GROUPS: + continue for description in PLUGWISE_SWITCHES: if description.key not in switches: continue diff --git a/pyproject.toml b/pyproject.toml index f348e8152..7ba98f147 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "plugwise-beta" -version = "0.61.0" +version = "0.62.0" description = "Plugwise beta custom-component" readme = "README.md" requires-python = ">=3.13" diff --git a/tests/components/plugwise/snapshots/test_sensor.ambr b/tests/components/plugwise/snapshots/test_sensor.ambr index 113fba03b..6e79ca599 100644 --- a/tests/components/plugwise/snapshots/test_sensor.ambr +++ b/tests/components/plugwise/snapshots/test_sensor.ambr @@ -1216,118 +1216,6 @@ 'state': '37.0', }) # --- -# name: test_adam_sensor_snapshot[platforms0-False-m_adam_heating][sensor.test_electricity_consumed-entry] - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'config_subentry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.test_electricity_consumed', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'labels': set({ - }), - 'name': None, - 'options': dict({ - 'sensor': dict({ - 'suggested_display_precision': 0, - }), - }), - 'original_device_class': , - 'original_icon': None, - 'original_name': 'Electricity consumed', - 'platform': 'plugwise', - 'previous_unique_id': None, - 'suggested_object_id': None, - 'supported_features': 0, - 'translation_key': 'electricity_consumed', - 'unique_id': 'e8ef2a01ed3b4139a53bf749204fe6b4-electricity_consumed', - 'unit_of_measurement': , - }) -# --- -# name: test_adam_sensor_snapshot[platforms0-False-m_adam_heating][sensor.test_electricity_consumed-state] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'power', - 'friendly_name': 'Test Electricity consumed', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.test_electricity_consumed', - 'last_changed': , - 'last_reported': , - 'last_updated': , - 'state': '16.5', - }) -# --- -# name: test_adam_sensor_snapshot[platforms0-False-m_adam_heating][sensor.test_electricity_produced-entry] - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': dict({ - 'state_class': , - }), - 'config_entry_id': , - 'config_subentry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'sensor', - 'entity_category': None, - 'entity_id': 'sensor.test_electricity_produced', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'labels': set({ - }), - 'name': None, - 'options': dict({ - 'sensor': dict({ - 'suggested_display_precision': 0, - }), - }), - 'original_device_class': , - 'original_icon': None, - 'original_name': 'Electricity produced', - 'platform': 'plugwise', - 'previous_unique_id': None, - 'suggested_object_id': None, - 'supported_features': 0, - 'translation_key': 'electricity_produced', - 'unique_id': 'e8ef2a01ed3b4139a53bf749204fe6b4-electricity_produced', - 'unit_of_measurement': , - }) -# --- -# name: test_adam_sensor_snapshot[platforms0-False-m_adam_heating][sensor.test_electricity_produced-state] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'power', - 'friendly_name': 'Test Electricity produced', - 'state_class': , - 'unit_of_measurement': , - }), - 'context': , - 'entity_id': 'sensor.test_electricity_produced', - 'last_changed': , - 'last_reported': , - 'last_updated': , - 'state': '0.0', - }) -# --- # name: test_adam_sensor_snapshot[platforms0-False-m_adam_heating][sensor.tom_badkamer_battery-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/plugwise/snapshots/test_switch.ambr b/tests/components/plugwise/snapshots/test_switch.ambr index 51068a94d..72dbf5d46 100644 --- a/tests/components/plugwise/snapshots/test_switch.ambr +++ b/tests/components/plugwise/snapshots/test_switch.ambr @@ -440,55 +440,6 @@ 'state': 'on', }) # --- -# name: test_adam_switch_snapshot[platforms0][switch.test_relay-entry] - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': None, - 'config_entry_id': , - 'config_subentry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'switch', - 'entity_category': None, - 'entity_id': 'switch.test_relay', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'labels': set({ - }), - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': None, - 'original_name': 'Relay', - 'platform': 'plugwise', - 'previous_unique_id': None, - 'suggested_object_id': None, - 'supported_features': 0, - 'translation_key': 'relay', - 'unique_id': 'e8ef2a01ed3b4139a53bf749204fe6b4-relay', - 'unit_of_measurement': None, - }) -# --- -# name: test_adam_switch_snapshot[platforms0][switch.test_relay-state] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'switch', - 'friendly_name': 'Test Relay', - }), - 'context': , - 'entity_id': 'switch.test_relay', - 'last_changed': , - 'last_reported': , - 'last_updated': , - 'state': 'on', - }) -# --- # name: test_adam_switch_snapshot[platforms0][switch.usg_smart_plug_lock-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -979,104 +930,6 @@ 'state': 'on', }) # --- -# name: test_stretch_switch_snapshot[platforms0][switch.schakel_relay-entry] - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': None, - 'config_entry_id': , - 'config_subentry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'switch', - 'entity_category': None, - 'entity_id': 'switch.schakel_relay', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'labels': set({ - }), - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': None, - 'original_name': 'Relay', - 'platform': 'plugwise', - 'previous_unique_id': None, - 'suggested_object_id': None, - 'supported_features': 0, - 'translation_key': 'relay', - 'unique_id': 'd03738edfcc947f7b8f4573571d90d2d-relay', - 'unit_of_measurement': None, - }) -# --- -# name: test_stretch_switch_snapshot[platforms0][switch.schakel_relay-state] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'switch', - 'friendly_name': 'Schakel Relay', - }), - 'context': , - 'entity_id': 'switch.schakel_relay', - 'last_changed': , - 'last_reported': , - 'last_updated': , - 'state': 'on', - }) -# --- -# name: test_stretch_switch_snapshot[platforms0][switch.stroomvreters_relay-entry] - EntityRegistryEntrySnapshot({ - 'aliases': set({ - }), - 'area_id': None, - 'capabilities': None, - 'config_entry_id': , - 'config_subentry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'switch', - 'entity_category': None, - 'entity_id': 'switch.stroomvreters_relay', - 'has_entity_name': True, - 'hidden_by': None, - 'icon': None, - 'id': , - 'labels': set({ - }), - 'name': None, - 'options': dict({ - }), - 'original_device_class': , - 'original_icon': None, - 'original_name': 'Relay', - 'platform': 'plugwise', - 'previous_unique_id': None, - 'suggested_object_id': None, - 'supported_features': 0, - 'translation_key': 'relay', - 'unique_id': 'd950b314e9d8499f968e6db8d82ef78c-relay', - 'unit_of_measurement': None, - }) -# --- -# name: test_stretch_switch_snapshot[platforms0][switch.stroomvreters_relay-state] - StateSnapshot({ - 'attributes': ReadOnlyDict({ - 'device_class': 'switch', - 'friendly_name': 'Stroomvreters Relay', - }), - 'context': , - 'entity_id': 'switch.stroomvreters_relay', - 'last_changed': , - 'last_reported': , - 'last_updated': , - 'state': 'on', - }) -# --- # name: test_stretch_switch_snapshot[platforms0][switch.vaatwasser_2a1ab_lock-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ diff --git a/tests/components/plugwise/test_init.py b/tests/components/plugwise/test_init.py index 8800929cb..407b64be9 100644 --- a/tests/components/plugwise/test_init.py +++ b/tests/components/plugwise/test_init.py @@ -297,11 +297,11 @@ async def test_update_device( assert ( len(er.async_entries_for_config_entry(entity_registry, mock_config_entry.entry_id)) - == 56 + == 53 ) assert ( len(dr.async_entries_for_config_entry(device_registry, mock_config_entry.entry_id)) - == 11 + == 10 ) # Add a 2nd Tom/Floor @@ -321,11 +321,11 @@ async def test_update_device( assert ( len(er.async_entries_for_config_entry(entity_registry, mock_config_entry.entry_id)) - == 63 + == 60 ) assert ( len(dr.async_entries_for_config_entry(device_registry, mock_config_entry.entry_id)) - == 12 + == 11 ) item_list: list[str] = [] for device_entry in device_registry.devices.values(): @@ -348,11 +348,11 @@ async def test_update_device( assert ( len(er.async_entries_for_config_entry(entity_registry, mock_config_entry.entry_id)) - == 56 + == 53 ) assert ( len(dr.async_entries_for_config_entry(device_registry, mock_config_entry.entry_id)) - == 11 + == 10 ) item_list: list[str] = [] for device_entry in device_registry.devices.values():