From d7960859239440efefa021bbf40b107761b3693a Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Sat, 24 Feb 2024 22:07:46 +0100 Subject: [PATCH] Bump pydiscovergy to 3.0.0 (#111305) --- homeassistant/components/discovergy/coordinator.py | 4 +++- homeassistant/components/discovergy/manifest.json | 2 +- homeassistant/components/discovergy/sensor.py | 4 ++-- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/discovergy/const.py | 4 ++-- tests/components/discovergy/snapshots/test_diagnostics.ambr | 4 ++-- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/discovergy/coordinator.py b/homeassistant/components/discovergy/coordinator.py index 5a3448a9e4b..e5e161a5d40 100644 --- a/homeassistant/components/discovergy/coordinator.py +++ b/homeassistant/components/discovergy/coordinator.py @@ -38,7 +38,9 @@ class DiscovergyUpdateCoordinator(DataUpdateCoordinator[Reading]): async def _async_update_data(self) -> Reading: """Get last reading for meter.""" try: - return await self.discovergy_client.meter_last_reading(self.meter.meter_id) + return await self.discovergy_client.meter_last_reading( + meter_id=self.meter.meter_id + ) except InvalidLogin as err: raise ConfigEntryAuthFailed( f"Auth expired while fetching last reading for meter {self.meter.meter_id}" diff --git a/homeassistant/components/discovergy/manifest.json b/homeassistant/components/discovergy/manifest.json index f70a531215e..da9fb117353 100644 --- a/homeassistant/components/discovergy/manifest.json +++ b/homeassistant/components/discovergy/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/discovergy", "integration_type": "service", "iot_class": "cloud_polling", - "requirements": ["pydiscovergy==2.0.5"] + "requirements": ["pydiscovergy==3.0.0"] } diff --git a/homeassistant/components/discovergy/sensor.py b/homeassistant/components/discovergy/sensor.py index 00513db484b..365a67fe552 100644 --- a/homeassistant/components/discovergy/sensor.py +++ b/homeassistant/components/discovergy/sensor.py @@ -156,7 +156,7 @@ ADDITIONAL_SENSORS: tuple[DiscovergySensorEntityDescription, ...] = ( device_class=SensorDeviceClass.TIMESTAMP, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, - value_fn=lambda reading, key, scale: reading.time_with_timezone, + value_fn=lambda reading, key, scale: reading.time, ), ) @@ -212,7 +212,7 @@ class DiscovergySensor(CoordinatorEntity[DiscovergyUpdateCoordinator], SensorEnt self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, meter.meter_id)}, name=f"{meter.measurement_type.capitalize()} {meter.location.street} {meter.location.street_number}", - model=meter.type, + model=meter.meter_type, manufacturer=MANUFACTURER, serial_number=meter.full_serial_number, ) diff --git a/requirements_all.txt b/requirements_all.txt index 73e908daa65..c6464f14fa4 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1767,7 +1767,7 @@ pydelijn==1.1.0 pydexcom==0.2.3 # homeassistant.components.discovergy -pydiscovergy==2.0.5 +pydiscovergy==3.0.0 # homeassistant.components.doods pydoods==1.0.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8b8d6be22a3..1281705424a 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1369,7 +1369,7 @@ pydeconz==114 pydexcom==0.2.3 # homeassistant.components.discovergy -pydiscovergy==2.0.5 +pydiscovergy==3.0.0 # homeassistant.components.hydrawise pydrawise==2024.2.0 diff --git a/tests/components/discovergy/const.py b/tests/components/discovergy/const.py index 5e596d7970f..3c9f696fb02 100644 --- a/tests/components/discovergy/const.py +++ b/tests/components/discovergy/const.py @@ -8,7 +8,7 @@ GET_METERS = [ meter_id="f8d610b7a8cc4e73939fa33b990ded54", serial_number="abc123", full_serial_number="abc123", - type="TST", + meter_type="TST", measurement_type="ELECTRICITY", load_profile_type="SLP", location=Location( @@ -34,7 +34,7 @@ GET_METERS = [ meter_id="d81a652fe0824f9a9d336016587d3b9d", serial_number="def456", full_serial_number="def456", - type="PIP", + meter_type="PIP", measurement_type="GAS", load_profile_type="SLP", location=Location( diff --git a/tests/components/discovergy/snapshots/test_diagnostics.ambr b/tests/components/discovergy/snapshots/test_diagnostics.ambr index e8d4eab1909..c12509dec5b 100644 --- a/tests/components/discovergy/snapshots/test_diagnostics.ambr +++ b/tests/components/discovergy/snapshots/test_diagnostics.ambr @@ -19,8 +19,8 @@ 'location': '**REDACTED**', 'measurement_type': 'ELECTRICITY', 'meter_id': 'f8d610b7a8cc4e73939fa33b990ded54', + 'meter_type': 'TST', 'serial_number': '**REDACTED**', - 'type': 'TST', }), dict({ 'additional': dict({ @@ -39,8 +39,8 @@ 'location': '**REDACTED**', 'measurement_type': 'GAS', 'meter_id': 'd81a652fe0824f9a9d336016587d3b9d', + 'meter_type': 'PIP', 'serial_number': '**REDACTED**', - 'type': 'PIP', }), ]), 'readings': dict({