diff --git a/homeassistant/components/plugwise/__init__.py b/homeassistant/components/plugwise/__init__.py index 28389ffa357..3140e518688 100644 --- a/homeassistant/components/plugwise/__init__.py +++ b/homeassistant/components/plugwise/__init__.py @@ -49,8 +49,16 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: def async_migrate_entity_entry(entry: er.RegistryEntry) -> dict[str, Any] | None: """Migrate Plugwise entity entries. - - Migrates unique ID from old relay switches to the new unique ID + - Migrates old unique ID's from old binary_sensors and switches to the new unique ID's """ + if entry.domain == Platform.BINARY_SENSOR and entry.unique_id.endswith( + "-slave_boiler_state" + ): + return { + "new_unique_id": entry.unique_id.replace( + "-slave_boiler_state", "-secondary_boiler_state" + ) + } if entry.domain == Platform.SWITCH and entry.unique_id.endswith("-plug"): return {"new_unique_id": entry.unique_id.replace("-plug", "-relay")} diff --git a/homeassistant/components/plugwise/binary_sensor.py b/homeassistant/components/plugwise/binary_sensor.py index d32ae94160f..01ebc736dbe 100644 --- a/homeassistant/components/plugwise/binary_sensor.py +++ b/homeassistant/components/plugwise/binary_sensor.py @@ -64,8 +64,8 @@ BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = ( entity_category=EntityCategory.DIAGNOSTIC, ), PlugwiseBinarySensorEntityDescription( - key="slave_boiler_state", - translation_key="slave_boiler_state", + key="secondary_boiler_state", + translation_key="secondary_boiler_state", entity_category=EntityCategory.DIAGNOSTIC, ), PlugwiseBinarySensorEntityDescription( diff --git a/homeassistant/components/plugwise/manifest.json b/homeassistant/components/plugwise/manifest.json index 888f813760a..1eb1cf6e8b6 100644 --- a/homeassistant/components/plugwise/manifest.json +++ b/homeassistant/components/plugwise/manifest.json @@ -7,6 +7,6 @@ "integration_type": "hub", "iot_class": "local_polling", "loggers": ["plugwise"], - "requirements": ["plugwise==0.37.1"], + "requirements": ["plugwise==0.37.2"], "zeroconf": ["_plugwise._tcp.local."] } diff --git a/homeassistant/components/plugwise/strings.json b/homeassistant/components/plugwise/strings.json index 7d26f5a624c..ef2d6458441 100644 --- a/homeassistant/components/plugwise/strings.json +++ b/homeassistant/components/plugwise/strings.json @@ -48,7 +48,7 @@ "cooling_state": { "name": "[%key:component::climate::entity_component::_::state_attributes::hvac_action::state::cooling%]" }, - "slave_boiler_state": { + "secondary_boiler_state": { "name": "Secondary boiler state" }, "plugwise_notification": { diff --git a/requirements_all.txt b/requirements_all.txt index d51dc0225ed..b2c21c1239d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1548,7 +1548,7 @@ plexauth==0.0.6 plexwebsocket==0.0.14 # homeassistant.components.plugwise -plugwise==0.37.1 +plugwise==0.37.2 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 7b04e7cf037..664467ea0a5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1225,7 +1225,7 @@ plexauth==0.0.6 plexwebsocket==0.0.14 # homeassistant.components.plugwise -plugwise==0.37.1 +plugwise==0.37.2 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json b/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json index d655f95c79b..d496edb4149 100644 --- a/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json +++ b/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json @@ -25,7 +25,7 @@ "dhw_state": false, "flame_state": false, "heating_state": true, - "slave_boiler_state": false + "secondary_boiler_state": false }, "dev_class": "heater_central", "location": "a57efe5f145f498c9be62a9b63626fbf", diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json index 92c95f6c5a9..ef7af8a362b 100644 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json +++ b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json @@ -25,7 +25,7 @@ "dhw_state": false, "flame_state": false, "heating_state": false, - "slave_boiler_state": false + "secondary_boiler_state": false }, "dev_class": "heater_central", "location": "a57efe5f145f498c9be62a9b63626fbf", diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json b/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json index be400b9bc98..8f2e6a75f3f 100644 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json +++ b/tests/components/plugwise/fixtures/m_anna_heatpump_idle/all_data.json @@ -25,7 +25,7 @@ "dhw_state": false, "flame_state": false, "heating_state": false, - "slave_boiler_state": false + "secondary_boiler_state": false }, "dev_class": "heater_central", "location": "a57efe5f145f498c9be62a9b63626fbf", diff --git a/tests/components/plugwise/fixtures/stretch_v31/all_data.json b/tests/components/plugwise/fixtures/stretch_v31/all_data.json index f42cde65b39..a875324fc13 100644 --- a/tests/components/plugwise/fixtures/stretch_v31/all_data.json +++ b/tests/components/plugwise/fixtures/stretch_v31/all_data.json @@ -136,7 +136,6 @@ "gateway": { "gateway_id": "0000aaaa0000aaaa0000aaaa0000aa00", "item_count": 83, - "notifications": {}, "smile_name": "Stretch" } } diff --git a/tests/components/plugwise/test_init.py b/tests/components/plugwise/test_init.py index 4eb0b2cb56a..b206b36be89 100644 --- a/tests/components/plugwise/test_init.py +++ b/tests/components/plugwise/test_init.py @@ -12,9 +12,8 @@ from plugwise.exceptions import ( import pytest from homeassistant.components.plugwise.const import DOMAIN -from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN -from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.config_entries import ConfigEntryState +from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er @@ -22,6 +21,9 @@ from tests.common import MockConfigEntry HEATER_ID = "1cbf783bb11e4a7c8a6843dee3a86927" # Opentherm device_id for migration PLUG_ID = "cd0ddb54ef694e11ac18ed1cbce5dbbd" # VCR device_id for migration +SECONDARY_ID = ( + "1cbf783bb11e4a7c8a6843dee3a86927" # Heater_central device_id for migration +) async def test_load_unload_config_entry( @@ -77,7 +79,7 @@ async def test_gateway_config_entry_not_ready( [ ( { - "domain": SENSOR_DOMAIN, + "domain": Platform.SENSOR, "platform": DOMAIN, "unique_id": f"{HEATER_ID}-outdoor_temperature", "suggested_object_id": f"{HEATER_ID}-outdoor_temperature", @@ -118,7 +120,18 @@ async def test_migrate_unique_id_temperature( [ ( { - "domain": SWITCH_DOMAIN, + "domain": Platform.BINARY_SENSOR, + "platform": DOMAIN, + "unique_id": f"{SECONDARY_ID}-slave_boiler_state", + "suggested_object_id": f"{SECONDARY_ID}-slave_boiler_state", + "disabled_by": None, + }, + f"{SECONDARY_ID}-slave_boiler_state", + f"{SECONDARY_ID}-secondary_boiler_state", + ), + ( + { + "domain": Platform.SWITCH, "platform": DOMAIN, "unique_id": f"{PLUG_ID}-plug", "suggested_object_id": f"{PLUG_ID}-plug",