mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Remove extra_state_attributes from Litter-Robot vacuum entities (#136196)
This commit is contained in:
parent
940a0f85e9
commit
e7345dd44a
@ -79,13 +79,6 @@ class LitterRobotCleaner(LitterRobotEntity[LitterRobot], StateVacuumEntity):
|
|||||||
"""Return the state of the cleaner."""
|
"""Return the state of the cleaner."""
|
||||||
return LITTER_BOX_STATUS_STATE_MAP.get(self.robot.status, VacuumActivity.ERROR)
|
return LITTER_BOX_STATUS_STATE_MAP.get(self.robot.status, VacuumActivity.ERROR)
|
||||||
|
|
||||||
@property
|
|
||||||
def status(self) -> str:
|
|
||||||
"""Return the status of the cleaner."""
|
|
||||||
return (
|
|
||||||
f"{self.robot.status.text}{' (Sleeping)' if self.robot.is_sleeping else ''}"
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_start(self) -> None:
|
async def async_start(self) -> None:
|
||||||
"""Start a clean cycle."""
|
"""Start a clean cycle."""
|
||||||
await self.robot.set_power_status(True)
|
await self.robot.set_power_status(True)
|
||||||
@ -121,13 +114,3 @@ class LitterRobotCleaner(LitterRobotEntity[LitterRobot], StateVacuumEntity):
|
|||||||
)
|
)
|
||||||
.timetz()
|
.timetz()
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
def extra_state_attributes(self) -> dict[str, Any]:
|
|
||||||
"""Return device specific state attributes."""
|
|
||||||
return {
|
|
||||||
"is_sleeping": self.robot.is_sleeping,
|
|
||||||
"sleep_mode_enabled": self.robot.sleep_mode_enabled,
|
|
||||||
"power_status": self.robot.power_status,
|
|
||||||
"status": self.status,
|
|
||||||
}
|
|
||||||
|
@ -11,7 +11,6 @@ import pytest
|
|||||||
from homeassistant.components.litterrobot import DOMAIN
|
from homeassistant.components.litterrobot import DOMAIN
|
||||||
from homeassistant.components.litterrobot.vacuum import SERVICE_SET_SLEEP_MODE
|
from homeassistant.components.litterrobot.vacuum import SERVICE_SET_SLEEP_MODE
|
||||||
from homeassistant.components.vacuum import (
|
from homeassistant.components.vacuum import (
|
||||||
ATTR_STATUS,
|
|
||||||
DOMAIN as PLATFORM_DOMAIN,
|
DOMAIN as PLATFORM_DOMAIN,
|
||||||
SERVICE_START,
|
SERVICE_START,
|
||||||
SERVICE_STOP,
|
SERVICE_STOP,
|
||||||
@ -52,23 +51,11 @@ async def test_vacuum(
|
|||||||
vacuum = hass.states.get(VACUUM_ENTITY_ID)
|
vacuum = hass.states.get(VACUUM_ENTITY_ID)
|
||||||
assert vacuum
|
assert vacuum
|
||||||
assert vacuum.state == VacuumActivity.DOCKED
|
assert vacuum.state == VacuumActivity.DOCKED
|
||||||
assert vacuum.attributes["is_sleeping"] is False
|
|
||||||
|
|
||||||
ent_reg_entry = entity_registry.async_get(VACUUM_ENTITY_ID)
|
ent_reg_entry = entity_registry.async_get(VACUUM_ENTITY_ID)
|
||||||
assert ent_reg_entry.unique_id == VACUUM_UNIQUE_ID
|
assert ent_reg_entry.unique_id == VACUUM_UNIQUE_ID
|
||||||
|
|
||||||
|
|
||||||
async def test_vacuum_status_when_sleeping(
|
|
||||||
hass: HomeAssistant, mock_account_with_sleeping_robot: MagicMock
|
|
||||||
) -> None:
|
|
||||||
"""Tests the vacuum status when sleeping."""
|
|
||||||
await setup_integration(hass, mock_account_with_sleeping_robot, PLATFORM_DOMAIN)
|
|
||||||
|
|
||||||
vacuum = hass.states.get(VACUUM_ENTITY_ID)
|
|
||||||
assert vacuum
|
|
||||||
assert vacuum.attributes.get(ATTR_STATUS) == "Ready (Sleeping)"
|
|
||||||
|
|
||||||
|
|
||||||
async def test_no_robots(
|
async def test_no_robots(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user