mirror of
https://github.com/home-assistant/core.git
synced 2025-09-09 14:51:34 +02:00
Ignore vacuum entities that properly deprecate battery (#150043)
This commit is contained in:
committed by
GitHub
parent
9d8e253ad3
commit
ffb2a693f4
@@ -79,6 +79,8 @@ DEFAULT_NAME = "Vacuum cleaner robot"
|
||||
_DEPRECATED_STATE_IDLE = DeprecatedConstantEnum(VacuumActivity.IDLE, "2026.1")
|
||||
_DEPRECATED_STATE_PAUSED = DeprecatedConstantEnum(VacuumActivity.PAUSED, "2026.1")
|
||||
|
||||
_BATTERY_DEPRECATION_IGNORED_PLATFORMS = ("template",)
|
||||
|
||||
|
||||
class VacuumEntityFeature(IntFlag):
|
||||
"""Supported features of the vacuum entity."""
|
||||
@@ -321,7 +323,11 @@ class StateVacuumEntity(
|
||||
|
||||
Integrations should implement a sensor instead.
|
||||
"""
|
||||
if self.platform:
|
||||
if (
|
||||
self.platform
|
||||
and self.platform.platform_name
|
||||
not in _BATTERY_DEPRECATION_IGNORED_PLATFORMS
|
||||
):
|
||||
# Don't report usage until after entity added to hass, after init
|
||||
report_usage(
|
||||
f"is setting the {property} which has been deprecated."
|
||||
@@ -341,7 +347,11 @@ class StateVacuumEntity(
|
||||
Integrations should remove the battery supported feature when migrating
|
||||
battery level and icon to a sensor.
|
||||
"""
|
||||
if self.platform:
|
||||
if (
|
||||
self.platform
|
||||
and self.platform.platform_name
|
||||
not in _BATTERY_DEPRECATION_IGNORED_PLATFORMS
|
||||
):
|
||||
# Don't report usage until after entity added to hass, after init
|
||||
report_usage(
|
||||
f"is setting the battery supported feature which has been deprecated."
|
||||
|
@@ -603,7 +603,9 @@ async def test_battery_level_template(
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_single_attribute_state_vacuum")
|
||||
async def test_battery_level_template_repair(
|
||||
hass: HomeAssistant, issue_registry: ir.IssueRegistry
|
||||
hass: HomeAssistant,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test battery_level template raises issue."""
|
||||
# Ensure trigger entity templates are rendered
|
||||
@@ -618,6 +620,7 @@ async def test_battery_level_template_repair(
|
||||
assert issue.severity == ir.IssueSeverity.WARNING
|
||||
assert issue.translation_placeholders["entity_name"] == TEST_OBJECT_ID
|
||||
assert issue.translation_placeholders["entity_id"] == TEST_ENTITY_ID
|
||||
assert "Detected that integration 'template' is setting the" not in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
Reference in New Issue
Block a user