Skip to content

Commit

Permalink
Ensure custom integrations are assigned the custom IQS scale (home-as…
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Nov 28, 2024
1 parent 1d09a5b commit 9d387ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homeassistant/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,9 @@ def loggers(self) -> list[str] | None:
@cached_property
def quality_scale(self) -> str | None:
"""Return Integration Quality Scale."""
# Custom integrations default to "custom" quality scale.
if not self.is_built_in or self.overwrites_built_in:
return "custom"
return self.manifest.get("quality_scale")

@cached_property
Expand Down
4 changes: 4 additions & 0 deletions tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def test_integration_properties(hass: HomeAssistant) -> None:
],
"mqtt": ["hue/discovery"],
"version": "1.0.0",
"quality_scale": "gold",
},
)
assert integration.name == "Philips Hue"
Expand Down Expand Up @@ -585,6 +586,7 @@ def test_integration_properties(hass: HomeAssistant) -> None:
assert integration.is_built_in is True
assert integration.overwrites_built_in is False
assert integration.version == "1.0.0"
assert integration.quality_scale == "gold"

integration = loader.Integration(
hass,
Expand All @@ -595,6 +597,7 @@ def test_integration_properties(hass: HomeAssistant) -> None:
"domain": "hue",
"dependencies": ["test-dep"],
"requirements": ["test-req==1.0.0"],
"quality_scale": "gold",
},
)
assert integration.is_built_in is False
Expand All @@ -607,6 +610,7 @@ def test_integration_properties(hass: HomeAssistant) -> None:
assert integration.ssdp is None
assert integration.mqtt is None
assert integration.version is None
assert integration.quality_scale == "custom"

integration = loader.Integration(
hass,
Expand Down

0 comments on commit 9d387ac

Please sign in to comment.