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:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user