mirror of
https://github.com/home-assistant/core.git
synced 2025-05-04 05:59:16 +00:00
Use shorthand attributes in buienradar camera (#100205)
This commit is contained in:
parent
085a584d98
commit
e2f7b3c6f8
@ -58,6 +58,9 @@ class BuienradarCam(Camera):
|
|||||||
[0]: https://www.buienradar.nl/overbuienradar/gratis-weerdata
|
[0]: https://www.buienradar.nl/overbuienradar/gratis-weerdata
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
_attr_entity_registry_enabled_default = False
|
||||||
|
_attr_name = "Buienradar"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, latitude: float, longitude: float, delta: float, country: str
|
self, latitude: float, longitude: float, delta: float, country: str
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -67,8 +70,6 @@ class BuienradarCam(Camera):
|
|||||||
"""
|
"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self._name = "Buienradar"
|
|
||||||
|
|
||||||
# dimension (x and y) of returned radar image
|
# dimension (x and y) of returned radar image
|
||||||
self._dimension = DEFAULT_DIMENSION
|
self._dimension = DEFAULT_DIMENSION
|
||||||
|
|
||||||
@ -94,12 +95,7 @@ class BuienradarCam(Camera):
|
|||||||
# deadline for image refresh - self.delta after last successful load
|
# deadline for image refresh - self.delta after last successful load
|
||||||
self._deadline: datetime | None = None
|
self._deadline: datetime | None = None
|
||||||
|
|
||||||
self._unique_id = f"{latitude:2.6f}{longitude:2.6f}"
|
self._attr_unique_id = f"{latitude:2.6f}{longitude:2.6f}"
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
"""Return the component name."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
def __needs_refresh(self) -> bool:
|
def __needs_refresh(self) -> bool:
|
||||||
if not (self._delta and self._deadline and self._last_image):
|
if not (self._delta and self._deadline and self._last_image):
|
||||||
@ -187,13 +183,3 @@ class BuienradarCam(Camera):
|
|||||||
async with self._condition:
|
async with self._condition:
|
||||||
self._loading = False
|
self._loading = False
|
||||||
self._condition.notify_all()
|
self._condition.notify_all()
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return the unique id."""
|
|
||||||
return self._unique_id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def entity_registry_enabled_default(self) -> bool:
|
|
||||||
"""Disable entity by default."""
|
|
||||||
return False
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user