Skip to content

Commit

Permalink
Remove attributes from Nuki entities (#125348)
Browse files Browse the repository at this point in the history
* Remove attributes from Nuki entities

* remove tests
  • Loading branch information
steffenrapp authored Sep 6, 2024
1 parent 9777ed2 commit f8c94fd
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 48 deletions.
18 changes: 1 addition & 17 deletions homeassistant/components/nuki/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import NukiEntity, NukiEntryData
from .const import ATTR_NUKI_ID, DOMAIN as NUKI_DOMAIN
from .const import DOMAIN as NUKI_DOMAIN


async def async_setup_entry(
Expand Down Expand Up @@ -51,14 +51,6 @@ def unique_id(self) -> str:
"""Return a unique ID."""
return f"{self._nuki_device.nuki_id}_doorsensor"

# Deprecated, can be removed in 2024.10
@property
def extra_state_attributes(self):
"""Return the device specific state attributes."""
return {
ATTR_NUKI_ID: self._nuki_device.nuki_id,
}

@property
def available(self) -> bool:
"""Return true if door sensor is present and activated."""
Expand Down Expand Up @@ -91,14 +83,6 @@ def unique_id(self) -> str:
"""Return a unique ID."""
return f"{self._nuki_device.nuki_id}_ringaction"

# Deprecated, can be removed in 2024.10
@property
def extra_state_attributes(self):
"""Return the device specific state attributes."""
return {
ATTR_NUKI_ID: self._nuki_device.nuki_id,
}

@property
def is_on(self) -> bool:
"""Return the value of the ring action state."""
Expand Down
18 changes: 1 addition & 17 deletions homeassistant/components/nuki/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import NukiEntity, NukiEntryData
from .const import (
ATTR_BATTERY_CRITICAL,
ATTR_ENABLE,
ATTR_NUKI_ID,
ATTR_UNLATCH,
DOMAIN as NUKI_DOMAIN,
ERROR_STATES,
)
from .const import ATTR_ENABLE, ATTR_UNLATCH, DOMAIN as NUKI_DOMAIN, ERROR_STATES
from .helpers import CannotConnect


Expand Down Expand Up @@ -75,15 +68,6 @@ def unique_id(self) -> str | None:
"""Return a unique ID."""
return self._nuki_device.nuki_id

# Deprecated, can be removed in 2024.10
@property
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the device specific state attributes."""
return {
ATTR_BATTERY_CRITICAL: self._nuki_device.battery_critical,
ATTR_NUKI_ID: self._nuki_device.nuki_id,
}

@property
def available(self) -> bool:
"""Return True if entity is available."""
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/nuki/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import NukiEntity, NukiEntryData
from .const import ATTR_NUKI_ID, DOMAIN as NUKI_DOMAIN
from .const import DOMAIN as NUKI_DOMAIN


async def async_setup_entry(
Expand All @@ -38,12 +38,6 @@ def unique_id(self) -> str:
"""Return a unique ID."""
return f"{self._nuki_device.nuki_id}_battery_level"

# Deprecated, can be removed in 2024.10
@property
def extra_state_attributes(self):
"""Return the device specific state attributes."""
return {ATTR_NUKI_ID: self._nuki_device.nuki_id}

@property
def native_value(self) -> float:
"""Return the state of the sensor."""
Expand Down
2 changes: 0 additions & 2 deletions tests/components/nuki/snapshots/test_binary_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Community door Ring Action',
'nuki_id': 2,
}),
'context': <ANY>,
'entity_id': 'binary_sensor.community_door_ring_action',
Expand Down Expand Up @@ -131,7 +130,6 @@
'attributes': ReadOnlyDict({
'device_class': 'door',
'friendly_name': 'Home',
'nuki_id': 1,
}),
'context': <ANY>,
'entity_id': 'binary_sensor.home',
Expand Down
4 changes: 0 additions & 4 deletions tests/components/nuki/snapshots/test_lock.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
# name: test_locks[lock.community_door-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'battery_critical': False,
'friendly_name': 'Community door',
'nuki_id': 2,
'supported_features': <LockEntityFeature: 1>,
}),
'context': <ANY>,
Expand Down Expand Up @@ -84,9 +82,7 @@
# name: test_locks[lock.home-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'battery_critical': False,
'friendly_name': 'Home',
'nuki_id': 1,
'supported_features': <LockEntityFeature: 1>,
}),
'context': <ANY>,
Expand Down
1 change: 0 additions & 1 deletion tests/components/nuki/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'attributes': ReadOnlyDict({
'device_class': 'battery',
'friendly_name': 'Home Battery',
'nuki_id': 1,
'unit_of_measurement': '%',
}),
'context': <ANY>,
Expand Down

0 comments on commit f8c94fd

Please sign in to comment.