From cbd9e1bdbce82e4825c2c5c201067f1ccd56048a Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 19 Oct 2026 09:20:20 +0200 Subject: [PATCH] Add serial number and software version to Hydrawise controller devices (#187292) --- homeassistant/components/hydrawise/__init__.py | 2 ++ homeassistant/components/hydrawise/entity.py | 7 ++++++- tests/components/hydrawise/conftest.py | 1 + tests/components/hydrawise/snapshots/test_diagnostics.ambr | 2 +- tests/components/hydrawise/test_device.py | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/hydrawise/__init__.py b/homeassistant/components/hydrawise/__init__.py index 52587c98d270..005191423fd2 100644 --- a/homeassistant/components/hydrawise/__init__.py +++ b/homeassistant/components/hydrawise/__init__.py @@ -84,6 +84,8 @@ async def async_setup_entry( manufacturer=MANUFACTURER, model=controller.hardware.model.description, name=controller.name, + serial_number=controller.hardware.serial_number or None, + sw_version=controller.software_version or None, ) # Register the controllers known at setup before the platforms construct diff --git a/homeassistant/components/hydrawise/entity.py b/homeassistant/components/hydrawise/entity.py index c7302382c291..1f482b0cacfd 100644 --- a/homeassistant/components/hydrawise/entity.py +++ b/homeassistant/components/hydrawise/entity.py @@ -52,7 +52,12 @@ class HydrawiseEntity(CoordinatorEntity[HydrawiseDataUpdateCoordinator]): ), manufacturer=MANUFACTURER, ) - if zone_id is not None: + if zone_id is None: + self._attr_device_info.serial_number = ( + controller.hardware.serial_number or None + ) + self._attr_device_info.sw_version = controller.software_version or None + else: # Only zones get their own device; sensor entities share the # controller device, so linking them to the controller would create # a self-referential via_device. diff --git a/tests/components/hydrawise/conftest.py b/tests/components/hydrawise/conftest.py index ad3a97fa6e0b..cee01b93c81e 100644 --- a/tests/components/hydrawise/conftest.py +++ b/tests/components/hydrawise/conftest.py @@ -102,6 +102,7 @@ def controller() -> Controller: ), last_contact_time=datetime.fromtimestamp(1693292420), online=True, + software_version="2.05", sensors=[], ) diff --git a/tests/components/hydrawise/snapshots/test_diagnostics.ambr b/tests/components/hydrawise/snapshots/test_diagnostics.ambr index 7ee07bd5972d..8fd752aab48e 100644 --- a/tests/components/hydrawise/snapshots/test_diagnostics.ambr +++ b/tests/components/hydrawise/snapshots/test_diagnostics.ambr @@ -88,7 +88,7 @@ }), }), ]), - 'software_version': '', + 'software_version': '2.05', 'status': None, 'zones': list([ dict({ diff --git a/tests/components/hydrawise/test_device.py b/tests/components/hydrawise/test_device.py index 1d6f867a68fc..5dde820cef0c 100644 --- a/tests/components/hydrawise/test_device.py +++ b/tests/components/hydrawise/test_device.py @@ -24,6 +24,8 @@ def test_zones_in_device_registry( assert device1 is not None assert device1.name == "Zone One" assert device1.manufacturer == "Hydrawise" + assert device1.serial_number is None + assert device1.sw_version is None device2 = device_registry.async_get_device_by_identifier( (DOMAIN, "5965395"), mock_added_config_entry.entry_id @@ -46,6 +48,8 @@ def test_controller_in_device_registry( assert device is not None assert device.name == "Home Controller" assert device.manufacturer == "Hydrawise" + assert device.serial_number == "0310b36090" + assert device.sw_version == "2.05" @pytest.mark.usefixtures("mock_pydrawise")