Skip to content

Add network MAC connection to Rain Bird controller#173672

Draft
jasonjhofmann wants to merge 1 commit into
home-assistant:devfrom
jasonjhofmann:rainbird-network-mac-connection
Draft

Add network MAC connection to Rain Bird controller#173672
jasonjhofmann wants to merge 1 commit into
home-assistant:devfrom
jasonjhofmann:rainbird-network-mac-connection

Conversation

@jasonjhofmann

@jasonjhofmann jasonjhofmann commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Proposed change

Register the Rain Bird controller with its network MAC address as a connection so
the MAC is shown on the device page and other integrations can attach to the same
device.

The controller's config entry unique id is already the formatted MAC (derived
from the device's Wi-Fi MAC during setup) and is used as the device identifier,
but the device was registered without any connections. As a result, Home
Assistant did not display the MAC on the device page, and integrations that key
off the network MAC (for example, the UniFi Network integration) created a
separate device for the same physical unit. Adding the CONNECTION_NETWORK_MAC
connection fixes both.

The connection is added to the controller device only. The per-zone switch
devices remain linked to the controller via via_device, so no connection tuple
is duplicated across devices.

This is the same change applied to Aranet in #173066 and to AirVisual Pro in
#173071.

Please re-classify it as a Bugfix if deemed appropriate (as one could argue a
network device should always carry its network MAC connection).

Tested on real hardware (a Rain Bird ESP-ME3 controller). With the change
applied, the controller's device page shows its MAC address, and the UniFi
Network integration's client device merges onto the same device via the new
connection instead of remaining a separate entry. The change is also covered by
a new device-registry snapshot test that asserts the network MAC connection is
registered on the controller device.

Below, the controller device page before and after the change. Before: no MAC,
Rain Bird only. After: the MAC is shown and the UniFi Network integration has
merged onto the same device.

Before:
RainBird Before

After:
RainBird After

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue:
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @konikvranik, @allenporter, mind taking a look at this pull request as it has been labeled with an integration (rainbird) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of rainbird can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign rainbird Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds a network MAC connection to the Rain Bird controller's device registry entry, allowing Home Assistant to associate the device with its network MAC address for improved device identification and tracking.

Changes:

  • Added CONNECTION_NETWORK_MAC to the DeviceInfo in the coordinator so the device registry includes the MAC address as a network connection.
  • Added a new test (test_device_registry) to verify the controller device registry entry includes the MAC connection.
  • Added a snapshot file for the new device registry test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
homeassistant/components/rainbird/coordinator.py Adds connections field with CONNECTION_NETWORK_MAC to the device info using the existing unique ID (which is a MAC address).
tests/components/rainbird/test_init.py Adds a new test to validate the device registry entry, including the MAC connection.
tests/components/rainbird/snapshots/test_init.ambr Snapshot for the new device registry test.

@jasonjhofmann jasonjhofmann marked this pull request as ready for review June 13, 2026 10:33

@allenporter allenporter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great thing to fix, thank you! Though i have some caveats, and have requested a change below.

return DeviceInfo(
name=self.device_name,
identifiers={(DOMAIN, self._unique_id)},
connections={(CONNECTION_NETWORK_MAC, self._unique_id)},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unique id is /currently/ the mac address but in the past was the serial number. Instead can you pull this from entry.data.get(CONF_MAC)? It needs to be done conditionally in case it is not set.

@home-assistant home-assistant Bot marked this pull request as draft June 13, 2026 15:23
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants