1 """Base Sensor for the Xbox Integration."""
3 from __future__
import annotations
10 from .const
import DOMAIN
11 from .coordinator
import PresenceData, XboxUpdateCoordinator
15 """Base Sensor for the Xbox Integration."""
18 self, coordinator: XboxUpdateCoordinator, xuid: str, attribute: str
20 """Initialize Xbox binary sensor."""
27 entry_type=DeviceEntryType.SERVICE,
28 identifiers={(DOMAIN,
"xbox_live")},
29 manufacturer=
"Microsoft",
35 def data(self) -> PresenceData | None:
36 """Return coordinator data for this console."""
37 return self.coordinator.data.presence.get(self.
xuidxuid)
40 def name(self) -> str | None:
41 """Return the name of the sensor."""
48 attr_name =
" ".join([part.title()
for part
in self.
attributeattribute.split(
"_")])
49 return f
"{self.data.gamertag} {attr_name}"
53 """Return the gamer pic."""
64 if url.host ==
"images-eds.xboxlive.com":
65 url = url.with_host(
"images-eds-ssl.xboxlive.com").with_scheme(
"https")
66 query =
dict(url.query)
67 query.pop(
"mode",
None)
68 return str(url.with_query(query))
None __init__(self, XboxUpdateCoordinator coordinator, str xuid, str attribute)
_attr_entity_registry_enabled_default
PresenceData|None data(self)
str|None entity_picture(self)