Skip to content

Remove "Nabu Casa" from device name - #539

Merged
puddly merged 3 commits into
zigpy:devfrom
TheJulianJES:tjj/ignore_nabu_casa_in_name
Oct 9, 2025
Merged

puddly merged 3 commits into
zigpy:devfrom
TheJulianJES:tjj/ignore_nabu_casa_in_name

Conversation

@TheJulianJES

@TheJulianJES TheJulianJES commented Oct 9, 2025 •

Copy link
Copy Markdown
Contributor

Proposed change

For any devices with the "Nabu Casa" manufacturer string, this PR removes that value from the full device name that's used to create device entries in Home Assistant.

Do note that both the independent manufacturer and model values stay untouched. This only affects the "combined name".

This PR also combines the following tests:

  • test_coordinator_info_uses_node_info
  • test_coordinator_info_generic_name
  • test_name_nabu_casa_devices (temporarily added in 7cffa90 (#539))

Other options for tests

We can also revert the latest commit that combines these tests (a505b8b (#539)) and do this in another PR if we prefer that.

By expanding the tests cases, I've also noticed that we currently include a leading space for the full name if the manufacturer name is not provided. We should fix this in a follow-up PR, but for now, the unchanged behavior is at least seen in tests.
This likely hasn't caused us any actual issues so far, since HA might strip leading and trailing spaces from device names.

Additional information

This is done to avoid the ZHA coordinator device entry being called "Nabu Casa Home Assistant Connect ZBT-2" by default.
Since all devices with the "Nabu Casa" manufacturer include a "brand name" (HA Connect) in the model name, we can remove that from the "name" completely.

I also don't necessarily think we should hard-code all the "Home Assistant Connect ZBT-X" model names for the check, since what I mentioned above should apply to all Nabu Casa devices AFAIK. We can do this if required, of course.
If we can (/want to) move this into quirks in the future (see thought below), we'll do it there.

If we want to tighten the check, but keep it in a generic way for onw, we could also check that model includes just "Home Assistant" or "Home Assistant Connect" before removing "Nabu Casa" from the "combined name".

Backlog issue

Fixes: zigpy/backlog#44

Other implementation possibilities

I previously played around with implementing that in Home Assistant's ZHA integration, but had nothing that I liked really much. Since ZHA is the base for the "{manf} {model}" string, and we already have special cases for active coordinators in ZHA, it makes the most sense to implement this here IMO.

Another thought was that we may be able to move this out of ZHA into quirks at some point. Right now, friendly_name only supports overriding the manufacturer and model individually, and we shouldn't set the manufacturer to an empty string, as that will break the "by Nabu Casa" text in HA.
But we could consider expanding this in quirks v2 in the future, since we may be able to use this for other devices, where having both the manufacturer and model name combined is redundant, for example.

See below for a sample implementation in HA's ZHA integration within the device_info method:

Possible `device_info` implementation (click to open)

    @property
    def device_info(self) -> dict[str, Any]:
        """Return a device description for device."""
        # ...
        name = self.device.name or ieee
        if self.device.manufacturer == "Nabu Casa":
            name = self.device.model
        return {
           # ...
            ATTR_MANUFACTURER: self.device.manufacturer,
            ATTR_MODEL: self.device.model,
            ATTR_NAME: name,
            # ...
        }

@codecov

codecov Bot commented Oct 9, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.91%. Comparing base (cd86906) to head (a505b8b).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #539   +/-   ##
=======================================
  Coverage   96.91%   96.91%           
=======================================
  Files          63       63           
  Lines       10498    10500    +2     
=======================================
+ Hits        10174    10176    +2     
  Misses        324      324           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@puddly

puddly commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

I think this is fine. We could also explore introducing a new firmware command for "display name" or something and have this info be provided verbatim by the device.

@puddly
puddly merged commit 30be1a6 into zigpy:dev Oct 9, 2025
9 checks passed
puddly pushed a commit to puddly/zha that referenced this pull request Oct 24, 2025
* Remove "Nabu Casa" from device name

* Add `test_name_nabu_casa_devices` test

* Combine coordinator naming tests using `parametrize`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adjust ZHA coordinator device entry name for ZBT-2

2 participants