Skip to content

Commit

Permalink
Simplify implementation (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
inverse authored Jan 4, 2025
1 parent 94b9d79 commit 29caa79
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions custom_components/premium_bond_checker/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ def __init__(
@property
def is_on(self) -> bool:
"""Return if won"""
data: Result = self.coordinator.data.results[self._bond_period]
_LOGGER.debug(f"Got {self.data.won} for {self.data.bond_period}")

_LOGGER.debug(f"Got {data.won} for {data.bond_period}")
return self.data.won

return data.won
@property
def data(self) -> Result:
return self.coordinator.data.results[self._bond_period]

@property
def name(self) -> str:
Expand All @@ -80,9 +82,7 @@ def unique_id(self) -> str:
@property
def extra_state_attributes(self) -> dict[str, Any]:
"""Return state attributes."""
data: Result = self.coordinator.data.results[self._bond_period]

return {
ATTR_HEADER: data.header,
ATTR_TAGLINE: data.tagline,
ATTR_HEADER: self.data.header,
ATTR_TAGLINE: self.data.tagline,
}

0 comments on commit 29caa79

Please sign in to comment.