1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 09:38:58 +01:00

Mark entity capability/state attribute type hints as mandatory (#163300)

Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
epenet
2026-02-19 17:02:38 +01:00
committed by GitHub
parent 0188f2ffec
commit 9e87fa75f8
2 changed files with 5 additions and 1 deletions
@@ -1,6 +1,7 @@
"""Support for Wireless Sensor Tags."""
import logging
from typing import Any
from wirelesstagpy import SensorTag
@@ -77,7 +78,7 @@ class WirelessTagBaseSensor(Entity):
self._state = self.updated_state_value()
@property
def extra_state_attributes(self):
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the state attributes."""
return {
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
@@ -683,14 +683,17 @@ _ENTITY_MATCH: list[TypeHintMatch] = [
TypeHintMatch(
function_name="capability_attributes",
return_type=["Mapping[str, Any]", None],
mandatory=True,
),
TypeHintMatch(
function_name="state_attributes",
return_type=["dict[str, Any]", None],
mandatory=True,
),
TypeHintMatch(
function_name="extra_state_attributes",
return_type=["Mapping[str, Any]", None],
mandatory=True,
),
TypeHintMatch(
function_name="device_info",