Fix attribute name

This commit is contained in:
G Johansson 2024-04-16 17:39:28 +00:00
parent 721dc313e0
commit 8620a53c44
3 changed files with 5 additions and 4 deletions

View File

@ -24,6 +24,7 @@ from .const import DEFAULT_NAME, DEVICE_ID, DOMAIN, EVENT_TAG_SCANNED, TAG_ID
_LOGGER = logging.getLogger(__name__)
LAST_SCANNED = "last_scanned"
LAST_SCANNED_BY_DEVICE_ID = "last_scanned_by_device_id"
STORAGE_KEY = DOMAIN
STORAGE_VERSION = 1
TAGS = "tags"
@ -256,7 +257,7 @@ class TagEntity(Entity):
@property
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the state attributes of the sun."""
return {TAG_ID: self._tag_id, DEVICE_ID: self._last_device_id}
return {TAG_ID: self._tag_id, LAST_SCANNED_BY_DEVICE_ID: self._last_device_id}
async def async_add_initial_state(self) -> None:
"""Add initial state."""

View File

@ -7,8 +7,8 @@
"tag_id": {
"name": "Tag ID"
},
"device_id": {
"name": "Device ID"
"last_scanned_by_device_id": {
"name": "Last scanned by device ID"
}
}
}

View File

@ -175,7 +175,7 @@ async def test_entity(
assert entity.state == now.isoformat(timespec="milliseconds")
assert entity.attributes == {
"tag_id": "test tag id",
"device_id": "device id",
"last_scanned_by_device_id": "device id",
"friendly_name": "test tag name",
}